<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Notes about random things</title><link>https://blog.nickto.net/</link><description>Recent content on Notes about random things</description><generator>Hugo -- 0.146.1</generator><language>en-gb</language><lastBuildDate>Sun, 04 May 2025 00:46:26 +0300</lastBuildDate><atom:link href="https://blog.nickto.net/index.xml" rel="self" type="application/rss+xml"/><item><title>Setting up NextCloud on Raspberry Pi 4 using k3s</title><link>https://blog.nickto.net/2023-11-20-setting-up-nextcloud-on-raspberry-pi-4-using-k3s/</link><pubDate>Mon, 20 Nov 2023 14:30:00 +0200</pubDate><guid>https://blog.nickto.net/2023-11-20-setting-up-nextcloud-on-raspberry-pi-4-using-k3s/</guid><description>&lt;h2 id="introduction">Introduction&lt;/h2>
&lt;p>I was setting up a NextCloud instance on my Raspberry Pi 4, using k3s, and found
out that there are quite some step-by-step guides on how to do that, none of
them fully addressed all the issues I had, so I decided to write yet another
guide on how to that. Mostly for myself, but maybe it will be useful for someone
else. In particular, I faced the following issues:&lt;/p></description></item><item><title>OneDrive on Linux</title><link>https://blog.nickto.net/2021-02-11-onedrive-on-linux/</link><pubDate>Thu, 11 Feb 2021 19:37:53 +0200</pubDate><guid>https://blog.nickto.net/2021-02-11-onedrive-on-linux/</guid><description>&lt;h2 id="onedrive-sync-on-linux">OneDrive sync on Linux&lt;/h2>
&lt;p>There is no official client for OneDrive for Linux, but there are some open
source alternatives, e.g.:&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://github.com/abraunegg/onedrive">OneDrive Client for Linux&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://rclone.org/">Rclone&lt;/a>&lt;/li>
&lt;/ul>
&lt;h3 id="onedrive-client-for-linux">OneDrive Client for Linux&lt;/h3>
&lt;p>TL;DR does what you expect, available only for OneDrive.&lt;/p>
&lt;p>Syncs a local folder with remote OneDrive: monitors changes both locally and
remotely and synchronizes them.&lt;/p>
&lt;p>In short, does pretty much what you expect from a file hosting and syncing
service, similar to native clients.&lt;/p></description></item><item><title>Listing files and folders sorted by size</title><link>https://blog.nickto.net/2020-11-15-listing-files-and-folders-sorted-by-size/</link><pubDate>Sun, 15 Nov 2020 17:10:00 +0200</pubDate><guid>https://blog.nickto.net/2020-11-15-listing-files-and-folders-sorted-by-size/</guid><description>&lt;h2 id="sort-files-and-directories-by-size-on-disk">Sort files and directories by size on disk&lt;/h2>
&lt;p>The following command sorts files and directories in descending order by their
disk usage:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>du -hs * | sort -rh
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="explanation">Explanation&lt;/h2>
&lt;h3 id="du">&lt;code>du&lt;/code>&lt;/h3>
&lt;p>&lt;code>du&lt;/code> summarizes disk usage of files, and for directories it summarizes them
recursively. The &lt;code>-s&lt;/code> option tells &lt;code>du&lt;/code> to display &amp;ldquo;only a total for each
argument&amp;rdquo;. Without it, &lt;code>du&lt;/code> also displays recursively the sizes of each nested
directory. So for the following file structure&lt;/p></description></item><item><title>pathos.multiprocessing</title><link>https://blog.nickto.net/2020-08-09-pathos.multiprocessing/</link><pubDate>Sun, 09 Aug 2020 20:19:18 +0200</pubDate><guid>https://blog.nickto.net/2020-08-09-pathos.multiprocessing/</guid><description>&lt;h2 id="multiprocessing-in-python">Multiprocessing in Python&lt;/h2>
&lt;p>Although Python is not very well suited for parallel programming, sometimes it
could be useful.&lt;/p>
&lt;p>If it’s a computation, then we are probably better off using something like
&lt;a href="https://dask.org/">Dask&lt;/a>, &lt;a href="http://numba.pydata.org/">Numba&lt;/a>, etc. But if it’s
not computations, then there is a built-in solution in Python:
&lt;a href="https://docs.python.org/3/library/multiprocessing.html">multiprocessing&lt;/a>.&lt;/p>
&lt;p>We’ll stick with computations for examples though, since their are simpler.&lt;/p>
&lt;h3 id="comparison-of-parallel-and-not-parallel">Comparison of parallel and not parallel&lt;/h3>
&lt;p>A quick illustration of why parallelization is great when the problem is
embarrassingly parallel.&lt;/p></description></item><item><title>Acceptance-rejection method for generating random variables</title><link>https://blog.nickto.net/2017-02-10-acceptance-rejection-method-for-generating-random-variables/</link><pubDate>Fri, 10 Feb 2017 20:40:00 +0200</pubDate><guid>https://blog.nickto.net/2017-02-10-acceptance-rejection-method-for-generating-random-variables/</guid><description>&lt;p>&lt;a href="https://en.wikipedia.org/wiki/Rejection_sampling">Acceptance-rejection method&lt;/a>
is a method for generating samples from a distribution, for which the
probability density function is known, but inverse cumulative probability
function is not known, and thus, using the
&lt;a href="https://en.wikipedia.org/wiki/Inverse_transform_sampling">inverse CDF method&lt;/a>
is not possible.&lt;/p>
&lt;p>Although there is quite a lot of information on the topic available, I will try
to explain the method the way that I (a.k.a 5-year-old) understand.&lt;/p>
&lt;h2 id="idea">Idea&lt;/h2>
&lt;h3 id="majorizing-distribution">Majorizing distribution&lt;/h3>
&lt;p>Let us say that we want to draw numbers from some distribution&lt;sup id="fnref:1">&lt;a href="#fn:1" class="footnote-ref" role="doc-noteref">1&lt;/a>&lt;/sup> $ f(x)
$&amp;mdash;&lt;em>target distribution&lt;/em>&amp;mdash;but we have only distribution $ g(x) $, such that by
multiplying it with some constant $ c $ it is always larger than $ f(x) $,&lt;/p></description></item><item><title>LaTeX fonts in R Markdown plots</title><link>https://blog.nickto.net/2017-02-03-latex-fonts-in-r-markdown-plots/</link><pubDate>Fri, 03 Feb 2017 19:30:00 +0100</pubDate><guid>https://blog.nickto.net/2017-02-03-latex-fonts-in-r-markdown-plots/</guid><description>&lt;p>Let us be honest, one of the reasons we use
&lt;a href="http://rmarkdown.rstudio.com/">R Markdown&lt;/a> to compile documents into PDF is the
aesthetic pleasure provided by LaTeX. However, all the efforts can be ruined by
wrong fonts in plots that are not the same as in the rest of the document.
&lt;a href="https://blog.nickto.net/posts/2017-02-03-rmarkdown-plot-fonts/poor-fonts.pdf">For example&lt;/a>&lt;/p>
&lt;p>&lt;img alt="These are some ugly fonts!" loading="lazy" src="https://blog.nickto.net/posts/2017-02-03-rmarkdown-plot-fonts/poor-fonts-screenshot.png">&lt;/p>
&lt;p>Well, these are some ugly fonts (not by itself, but in combination with the rest
of the document). Would not it be much better to have something like
&lt;a href="https://blog.nickto.net/posts/2017-02-03-rmarkdown-plot-fonts/good-fonts.pdf">this&lt;/a>?&lt;/p></description></item><item><title>Table and figure captions in R Markdown</title><link>https://blog.nickto.net/2016-11-10-table-and-figure-captions-in-r-markdown/</link><pubDate>Thu, 10 Nov 2016 15:30:00 +0200</pubDate><guid>https://blog.nickto.net/2016-11-10-table-and-figure-captions-in-r-markdown/</guid><description>&lt;p>&lt;a href="http://rmarkdown.rstudio.com/">R Markdown&lt;/a> is an extremely useful tool for
producing reports using R. The problem is that decent quality reports require
captions for figures and tables, and it is not straightforward to do. The good
news is that it is still quite easy.&lt;/p>
&lt;h2 id="pandocs-markdown-numbered-captions">Pandoc&amp;rsquo;s Markdown: numbered captions&lt;/h2>
&lt;p>The key to adding captions is that
&lt;a href="https://cran.r-project.org/web/packages/knitr/index.html">knitr&lt;/a> actually
converts your &lt;code>.Rmd&lt;/code> file to &lt;code>.md&lt;/code> file first, and then uses
&lt;a href="http://pandoc.org/">pandoc&lt;/a> to conert it to html, pdf or another format.
Therefore, everything that works in Pandoc also works in R Markdown. It is worth
noting, though, that Pandoc uses its own extended version of Markdown called
&lt;a href="http://pandoc.org/MANUAL.html#pandocs-markdown">Pandoc&amp;rsquo;s Markdown&lt;/a>. Among other
things it allows captioning your figures and tables. This is done in the
following way for the figures&lt;/p></description></item></channel></rss>