Frenetic Array

The intersection of logic and imagination.

git blame (Someone Else)

From the developer:

Why admit fault when you can blame someone else?

Finally, a tool I can immediately use at work. Modifies not only the commit author but the listed committer. Brilliant.

Find it here.

Sleep Tracking With An Apple Watch

It’s no secret I am a giant advocate for tiny, smart devices on your wrist; they can track heart rate, push notifications, and can do fitness tracking very well. One thing I was very skeptical of was wearing it to bed — for sleep tracking.

After trying it for a week, I can safely say it is a success.

I currently use an Apple Watch (Series 4) with AutoSleep, and it works like a charm. I don’t have to open any app, or use any watch face. It just works.


Taking this a step further, I wondered what would happen if I used my Apple Watch as my sole alarm. Paranoid I would not get up, I set a backup alarm for several minutes later to make sure I was awake.

It works great.

I would be willing to say it works better than an audible alarm; I can filter audio pretty easily, not so much with a physical sensation on my wrist. Currently, I don’t have a backup alarm set. One alarm. Five in the morning. Every weekday.

As an added bonus, my heart rate is also tracked throughout the night. This is quite useful to not only see how well I slept, but how my metabolism acted throughout the night, something quite useful to determine if I ate too late on a weekend.

Heart Rate Recorded Throughout The Night.

Now, the only thing that can cause worry is the fact that an Apple Watch has a 18 hour battery life. I personally don’t find this a problem. I charge my watch during my shower in the morning, at my desk when I am sitting and working, and a little bit before bed. It charges fast enough throughout the day, I don’t really worry about it anymore.

A little tip as well: having a sleeping night face works pretty nicely.

My Personal Watch Face For Sleep.

A Curious Shebang

If you've ever written a shell script, you might top your script with your interpreter of choice (i.e. #!/bin/python or #!/bin/bash). What you might not have known that rm is also a valid interpreter. Take the following script.

echo "Hello, world"

It would simply interpret to be removed. Useful? No. Hilarious? Yes.

Calculating Euler's Number

We are well aware of Euler’s famous number,

$$e = 2.71828182845$$

There are also quite a few ways of deriving Euler’s Number. There’s the Taylor expansion method:

$$e = \sum_{k = 0} ^{\infty} \frac{1}{k!}$$

There is also the classical limit form:

$$e = \lim_{n \rightarrow \infty} \left( 1 + \frac{1}{n} \right)^n$$

Then there is another. Let $R$ be a random number generated between $[0, 1]$, inclusive. Then $e$ is the average of the number of $R$s it takes to sum greater than $1$.

With more rigor, for uniform $(0,, 1)$ random independent variables $R_1$, $R_2$, $\ldots$, $R_n$,

$$N = \min \left( n: \sum _{k = 1} ^n R_i > 1 \right)$$


$$e = \text{Average}(n)$$

The proof can be found here, but it’s pretty math-heavy. Instead, an easier method is to write a program to verify for large enough $n$.

n Sum Solution Limit Solution Random Uniform Variable
1 1 2 2
10 1.7182818011 2.5937424601 2.5
100 1.7182818284 2.7048138294 2.69
1000 1.7182818284 2.7169239322 2.717
10000 2.7181459268 2.7242
100000 2.7182682371 2.71643
1000000 2.7182804690 2.71961
10000000 2.7182816941 2.7182017
100000000 2.7182817983 2.71818689
1000000000 2.7182820520 2.718250315

Source Code

def e_sum(upper_bound):
	if upper_bound < 1:
		return 0

	return Decimal(1.0) / Decimal(math.factorial(upper_bound)) + Decimal(e_sum(upper_bound - 1))

def e_limit(n):
	return Decimal((1 + 1.0 / float(n))**n)

def find_greater_than_one(value=0, attempts=0):
	if value <= 1:
		return find_greater_than_one(value + random.uniform(0, 1), attempts + 1)

	return attempts


Remember Nyan Cat, that infamous Poptart cat that plagued the internet about seven years ago? Well, as it turns out, someone implemented in the terminal; and it is as awesome as you might think.

nyancat running in iTerm.

Even better? You can run it in the MacBook Pro Touch Bar.

Nyan Cat running on the MacBook Pro Touch Bar.