Things I read, 2022

TLDR: Leaving a PhD gives someone a lot of time to read new things. Here's some of my takeaways:

  • ChatGPT and StableDiffusion are scary and new and cool.
  • Philip Rogaway's work presents some important ethical considerations for cryptographers.
  • ThreeBlueOneBrown is one of many educational YouTubers that I'm enjoying.
  • Anyone writing Rust would benefit from reading the cursed words in the Rustonomicon.
  • As usual, 538 podcasts are worth listening to around elections.
  • Audiobooks are good actually.
  • TV is also really good now.
  • Outer Wilds is the best game, I reckon.
  • Nope (the movie) is really really good.
Read more  ↩︎

❖◈◆◈❖

❖◈◈❖

Python on your phone sucks less with `ooo.py` and the `-i` flag.

TLDR: Copy the script below, and run it as python -i ooo.py. This will give you a bunch of useful imports with short aliases, and throw you into an interactive shell.

'''Run as `python3 -i ooo.py`

I use this when writing Python scripts on my phone (through Termux). The point is to minimize the keypresses needed when writing Python on a phone.

This will start Python, import a bunch of modules with short names, and then throw you into an interpreter.
'''

import numpy as np
import pandas as pd
import math as mt
import random as rd
import time
import itertools as it
import functools as ft
import re
import os
import sys
import glob
import pickle as pl
import hashlib as hl
import secrets as ss
import socket as sk

print("imported numpy as np, pandas as pd, math as mt, random as rd, time, itertools as it, functools as ft, re, os, sys, glob, pickle as pl, hashlib as hl, secrets as ss, and socket as sk!")

A = np.array

PI = mt.pi
TAU = mt.tau
E = mt.e

print("Constants available: PI, TAU, E .")

H = help
Q = quit

print("Functions `help(...)` and `quit()` available as `H(...)` and `Q()`.")
Read more  ↩︎

❖◈◆◈❖

❖◈◈❖

You can sort in linear time!

A log-scale graph showing the runtime (ns) of sorting N elements for different integer depths. They all show a trend towards linear runtime for large N.
A log-scale graph showing the linear runtime of count-sort

TLDR: Yes-- you can sort numbers in linear time. Yes, including floats! The proof that you can sort in $O(n \log n)$ time is still true, but that assumes you're sorting on the infinite set of real numbers (or integers.) We can sort in linear time because we work with finite sets: Floats and ints. The algorithm is very simple, and is called counting sort (or bin sort or radix sort.)

See the Python notebook wrapping an unoptimized Rust countsort implementation:

--

Is this truly $O(n)$? Yes!

  • Counting sort is not a randomized algorithm, it always outputs the correct solution.
  • Counting sort is not a parallelized algorithm. (And you can't use parallelism to speed past a worst-case big-O run time anyway!)
  • Counting sort is not an amortized algorithm. It is truly $O(n)$, not 'expected' or 'amortized' $O(n)$.
  • Counting sort is technically $Θ(n)$, that is, the worst and best case running time is linear.
  • This can be used in the real world.
  • However, it is not an in-place sorting algorithm.
Read more  ↩︎

❖◈◆◈❖

❖◈◈❖

`reso`, a colorful pixel-art circuit simulator

Reso is a circuit design language and simulator where the inputs and outputs are bitmap images!

Reso logo, incrementing over a truth table in an artistically-crafted circuit. Outputting AND, OR, and XOR to the diamonds.

Reso is a pet project of mine that I've been working on in my free time for a little while. This logo is actually an animation of the execution of a Reso circuit.

Read more  ↩︎

❖◈◆◈❖

❖◈◈❖

Oh no, dating spam sites are abusing improperly-configured internal search engines

tldr: Malicious entities are abusing sites internal search engines to promote their own URLs. This effectively allows them to advertise using the target site's domain in the search results of major search engines. If you own such a site, fix this by putting a disallow entry in your robots.txt, or adding the noindex meta tag.

Read more  ↩︎

❖◈◆◈❖

❖◈◈❖