Miscellaneous handy stuff, programming doodles, proofs of concept(s).

fnordomat b3e862f1b3 requirements.txt for mastodon toot download script 2 周之前
aaaa 564affbdd8 Added GPT-2 script 2 年之前
captive-be-gone e314b867bf captive-portal eating script updated + improved 1 年之前
cover 1d82920b6f fix 5 年之前
dotfiles 7045caa20c XMonad: swap workspaces 5 年之前
dsp b963699c1d plot a spectrogram 10 月之前
emacs 558f0a92ec highlight iptables rules in emacs 8 年之前
gaptexts 12bb79c52b Language learning game; update of README.md 5 月之前
haskell 6061064ec9 Visualization of Levenshtein edit distance 4 年之前
js f725536448 mouse hoover (hoover != hover)! 1 年之前
mastodon b3e862f1b3 requirements.txt for mastodon toot download script 2 周之前
multimedia 8d61b1f82d Shrink and resize image files (wrapper script because the CLI of ImageMagick is crap) 1 月之前
raspi 1d52b65b32 Happy Hardware Hacking :-) 4 年之前
rust 177441ded5 Shrink image files 1 月之前
satsolver 4ad8db04d3 Tiny, pedagogical DPLL SAT solver in C. 5 年之前
scheme a7b8eac2da Added weight-balanced trees implementation in scheme 4 年之前
tinform b2b08bdba3 Add tinform C code reshaper 4 年之前
torx 5a23898a9f ANSI colors 8 年之前
yourprobes 1d82920b6f fix 5 年之前
.gitignore 0c2d844265 .gitignore 9 月之前
LICENSE e820913490 Initial commit 8 年之前
README.md 177441ded5 Shrink image files 1 月之前
netthier_min.svg 4d74209446 fix spelling error 1 年之前

README.md

misc

Miscellaneous stuff, ranging from handy to useless.

aaaa

This folder contains:

  • aaaa/magpo.py: turn a text or word list into virtual magnetic poetry. The idea is to open the resulting random SVG in an interactive editor such as inkscape and play with the words on the screen.
  • aaaa/gpt2_finish_my_sentence_prompt.py: call GPT-2 to complete sentences you start ...

dsp

This folder contains:

  • dsp/demix/demix.py: very primitive approach to signal source separation. Input: stereo WAV file. Output: two mono WAVs that are linear combinations of the input channels minimizing correlation (globally over the whole length, not windowed or refined in any way)

satsolver

A very simple, easy to understand DPLL SAT solver in C. It was written on an android device while waiting for the bus.

raspi

This folder contains:

  • raspi/irpoll.c: decode 38kHz IR signals from a TV remote control. Not being a hardware buff, I tried the simplest thing that could possibly work, counting on and off periods in multiples of 1/38000 and comparing the resulting patterns with templates that I recorded with the same method. Turns out to work, and pretty reliably at that! Use with a TSOP48xx component (look up the correct type for 38kHz and how to connect it).

js/mini

This folder contains:

  • mandelbrot.html: interactive page that displays a colourful Mandelbrot fractal, with zoom (select rectangle or point) and undo/redo.
  • hoover.html: helps explain the difference between (mouse) hover and hoover.
  • and more

rust

This folder contains stuff written in rust, a non-garbage-collected, strongly typed language designed with safety and speed in mind.

  • rust/noisetokio: snow crate (noiseprotocol implementation) + tokio example program: close-to-minimal example of client/server communication in the async paradigm with post-quantum hybrid encryption as an added bonus
  • ~rust/dupes~: find probable duplicate files by SHA256 - this one is actually useful. Moved to its own repo
  • rust/ecc_test: trying out the Curve25519 / Ristretto implementation curve25519_dalek library available here
  • rust/ot_poc: oblivious transfer protocol using RSA, as described on Wikipedia. Disclaimer: I'm not a professional cryptographer! This might be all wrong.

captive-be-gone

Welcome to the wonderful world of captive portal solving. Many hotels and other venues, instead of just partnering with a free mesh networking initiative who would provide then with truly free wifi at virtually no cost, have instead opted to put up quests for the aspiring programmer, called "captive portals". The reward for solving one is internet access. This folder contains a growing collection of shell scripts which can save you from ever having to undergo the ignominy of clicking through a captive portal manually. Caution: work in progress, unsanitized input might be used in unsafe ways.

  • captive-be-gone/WIFIonICE.sh: Deutsche Bahn ICE trains / icomera AB
  • captive-be-gone/CDWiFi.sh: Czech trains / ombord(?)
  • captive-be-gone/wifipass.py: "wifipass.org"
  • captive-be-gone/m3connect.sh: Accor group hotels / m3connect (works for some m3connect networks only, confirmed mid 2021)
  • captive-be-gone/m34.py: Accor group hotels / m3connect (works in Leipzig)
  • captive-be-gone/m34v2.py: Accor group and other hotels / m3connect (supersedes m34.py)
  • captive-be-gone/hospitality.thecloud.eu.py: generic / TheCloud WiFi
  • captive-be-gone/hospitality.thecloud.eu_mercure_free.py: variant for Mercure
  • captive-be-gone/ham-maximo.py: Hamburg Airport "free wifi"
  • captive-be-gone/mobyklick.py: "mobyklick"

Sadly, the m3connect scripts have stopped working. Their craptive portal is a full blown web app. Coming up with a lightweight solution that doesn't involve a full browser image exceeded my time budget at the time :-(

tinform

This folder contains:

  • tinform/tinform.c: tokenizes and reshapes C code to fit a pixmap given as a monochrome (P1 or P4) netpbm file. It will try to put whitespaces on white pixels and other symbols on black pixels. Run it on itself to generate a virtually unlimited range of equivalent programs in different shapes.
  • Makefile: some tests. run make doublecheck to confirm that it works as intended.

haskell

This folder contains stuff written in haskell. Purely recreational, none of it is intended for serious use.

  • haskell/comprviz: compresses input text file with gzip and outputs a HTML file where the background color of each character depends on the coding efficiency (red background = high number of bits, green = low number, blue channel indicates whether a backreference was used)
  • haskell/cyk: Cocke-Younger-Kasami like algorithm for experiments with context-free languages.
  • haskell/editdistviz: visualisation of edit distance (the Levenshtein string metric). the distance between two words is computed and the intermediary results are shown in a beautiful diagram. Output format is SVG.

scheme

This folder contains stuff written in scheme, a classical, extremely flexible, dynamically typed family of programming languages.

  • scheme/wb.scm: Weight-Balanced Trees implementation in scheme, and a proof of concept unit test facility (works with chicken but unfortunately define-syntax macros aren't part of the standard).

cover

  • cover/cover.py: Attempt to produce some cover traffic while using Tor. Actually I'm not at all sure how useful this approach is. I think I've already spotted an obvious flaw.

mastodon

  • mastodon/allmytoots.py: crappy script to download own toot history from a mastodon account to make it easier to find old toots by content. Works for me.
  • mastodon/toottree.py: download the toots belonging to a conversation and display them as a tree
  • mastodon/metabot.py: my first bot. or collection of bots, with multiplexer.

multimedia

  • multimedia/multimediareport.py: run ffmpeg on files to generate report with waveforms, e.g. to quickly spot files that lack an audio track
  • multimedia/shrink-image.sh: save disk space by shrinking images with imagemagick to a specified jpeg file size

torx

  • torx/CheckExit.py: collect tls certificates through tor (sometimes there are MitM attempts at exits and it's widely considered a good idea to document and report these). You might also be interested in other people's tools such as exitmap.

trackography

Unique identifiers considered harmful.

  • yourprobes/tea.py: a very simple script that reads probed ESSIDs aloud using text-to-speech. use case: get clueless users to acknowledge the dangers posed by excessive chattiness of their WIFI devices.

emacs

Highlighting iptables rules.

gaptexts

Web app that downloads a random article from Wikipedia in language 1 and uses the libretranslate API to get a translation in language 2, then hides every second word, showing only the length, and prompts the user to guess the missing words.

Inspired by one kind of exercise found in a certain series of language learning books.

This could one day become a fun game, right now only basic checking of the solution is implemented.