## ~rumpelsepp/homepage

ccafcd4d383328106803cbe5af907cd7affa7c23 — Stefan Tatschner 9 months ago
Small migration fixes

9 files changed, 8 insertions(+), 11 deletions(-)

M content/blog/2017-02-06-factorial.md
M content/blog/2017-02-10-prime-factors.md
M content/blog/2017-02-25-base64-encoder.md
A static/ceil.png
A static/factorial.png
A static/factorial_recursive.png
A static/prime-formula.png

M content/blog/2014-09-22-how-to-download-rtmp-streams.md => content/blog/2014-09-22-how-to-download-rtmp-streams.md +1 -1
@@ 42,7 42,7 @@ is:
For simplification I have written a little python wrapper which extracts these
parameters from a given URL and builds the rtmpdump command line string:

-
+ python
import re
import sys
import subprocess


M content/blog/2017-02-06-factorial.md => content/blog/2017-02-06-factorial.md +2 -2
@@ 24,7 24,7 @@ Week" or so.
Let's start with some simple math stuff. I decided to do some computation in
Python to get the factorial of a given number. The factorial is defined as such:

-{{< figure alt="Rendered LaTex Formula: n! = \prod_{k=1}^{n} k" src="https://files.rumpelsepp.org/factorial.png" width=100 >}}
+{{< figure alt="Rendered LaTex Formula: n! = \prod_{k=1}^{n} k" src="/factorial.png" width=100 >}}

That's pretty easy to implement in Python! Let's just do it!

@@ 40,7 40,7 @@ I also found out that this way of solving this problem is the so called
_iterative_ way. There is almost always another approach called _recursion_.
We can define the factorial also in a recursive manner:

-{{< figure alt="Rendered LaTex Formula" src="https://files.rumpelsepp.org/factorial_recursive.png" width=300 >}}
+{{< figure alt="Rendered LaTex Formula" src="/factorial_recursive.png" width=300 >}}

This means that we devide the problem into several problems of the same type;
each distinct problem is simpler to solve as the whole problem. This is


M content/blog/2017-02-10-prime-factors.md => content/blog/2017-02-10-prime-factors.md +1 -1
@@ 12,7 12,7 @@ First, what is prime factorization? [Wikipedia](https://en.wikipedia.org/wiki/In

In maths it would look somehow like this:

-{{< figure alt="Rendered LaTex Formula: n=p_{1}^{{\;\;e_{1}}}\cdot p_{2}^{{\;\;e_{2}}}\dotsm p_{M}^{{\ \ e_{M}}}=\prod _{{k=1}}^{{M}}p_{k}^{{\;\;e_{k}}}" src="https://files.rumpelsepp.org/prime-formula.png" width=300 >}}
+{{< figure alt="Rendered LaTex Formula: n=p_{1}^{{\;\;e_{1}}}\cdot p_{2}^{{\;\;e_{2}}}\dotsm p_{M}^{{\ \ e_{M}}}=\prod _{{k=1}}^{{M}}p_{k}^{{\;\;e_{k}}}" src="/prime-formula.png" width=300 >}}

There are a lot of methods to accomplish the given task of compositing a number
into a product of primes. I just want to present the IMO most naive and straight


M content/blog/2017-02-25-base64-encoder.md => content/blog/2017-02-25-base64-encoder.md +4 -7
@@ 68,13 68,12 @@ The padding was the part which took the most time to get right in the
C implementation...

One final hint, which is important. The length l of the encoded string
-can be calculated with the following macro; n is the length of the
+can be calculated with the following formula; n is the length of the
input string.

-I have implemented the ceil function in C with a macro:
-
-TODO: die latex geschichte weglassen
+{{< figure alt="Rendeder LaTex formula: l = \left \lceil{4 \cdot \frac{n}{3}}\right \rceil" src="/ceil.png" width=100 >}}

+I have implemented the ceil function in C with a macro:

 c
#define CEIL(x) ((x) - (int) (x) > 0 ? (int) ((x) + 1) : (int) (x))

@@ 89,9 88,7 @@ data must be dividable by 3, the padding length can be calculated with the
following formula; as before n is the length of the input data in number
of bytes:

-
-l_{\mathrm{pad}} = 3 - (n \mod 3)
-
+{{< figure alt="Rendeder LaTex formula: l_{\mathrm{pad}} = 3 - (n \mod 3)" src="/base64_padding.png" width=200 >}}

## Implementation in C


A static/base64_padding.png => static/base64_padding.png +0 -0
A static/ceil.png => static/ceil.png +0 -0
A static/factorial.png => static/factorial.png +0 -0
A static/factorial_recursive.png => static/factorial_recursive.png +0 -0
A static/prime-formula.png => static/prime-formula.png +0 -0`