Skip to content

Instantly share code, notes, and snippets.

@reinhrst
reinhrst / create-password.sh
Last active April 21, 2023 07:45
Correct horse battery staple: creates a password of english words. First param is number of words to use (default=3)
TEMPDIR="$(mktemp -d)"
NR_WORDS=${1:-3}
cd "$TEMPDIR"
curl 'https://raw.githubusercontent.com/first20hours/google-10000-english/master/google-10000-english.txt' | grep -E "^.{4,8}$" | sort | uniq > wordlist.txt
NR_LINES="$(wc -l wordlist.txt | grep -oe '\d\+')"
POSS="$(echo "$NR_LINES^$NR_WORDS" | bc)"
BITS="$(echo "l($POSS)/l(2)" | bc -l)"
CHARS="$(echo "l($POSS)/l(72)" | bc -l)"
printf 'We have %d lines; we willl take %d words; there are %.3e possibilities (%.1f bits of entropy, comparable to %.1f completely random chars (lower/upper/number/special))\n' "$NR_LINES" "$NR_WORDS" "$POSS" "$BITS" "$CHARS"
if [[ $NR_LINES -lt "4000" ]]; then
@jasoncoon
jasoncoon / Doom Fire Eye
Last active September 11, 2022 11:07
Doom Fire Eye pattern for Pixelblaze & Lux Lavalier
/* DOOM Fire Eye
Slightly modified to polar coords by Jason Coon
Video demo here: https://twitter.com/jasoncoon_/status/1567672583436247046
Updated 2D Fire effect, with "enhanced" dragon's breath mode.
Now with More, Better fire! Version 2 has more dramatic flame,
and an improved wind algorithm.
The method is inspired by the low-res fire in the prehistoric PSX port of DOOM!
scale([4, 4, 1]) {
translate([20, 20, 0]) {linear_extrude (height=1) {circle(26);}};
color([0, 0, 0]) {
translate([0, 26, 0]) { linear_extrude (height=3){import("wifi.svg"); }; }
translate([2, 15, 1]) { linear_extrude (height=1){rotate(90){text("wifi", size=5); }}; }
translate([43, 12, 1]) { linear_extrude (height=1){rotate(90){text("hs3.pl", size=5); }}; }
translate([16, -2, 1]) { linear_extrude (height=1){text("QR", size=5); }; }
translate([28, 43, 1]) { linear_extrude (height=1){rotate(180)text("NFC", size=5);}; }
}
}
@jepler
jepler / 0000README.md
Last active March 13, 2024 15:09
Reading RP2040 BOOTSEL pin from code

It turns out you CAN read the pico BOOTSEL pin from software.

I became aware of this possibility after pimoroni tweeted that you could use the BOOTSEL button as a MIDI trigger on their upcoming "Tiny2040". We speculated whether there was a small HW circuit to accomplish this, or if it was SW only. Now I have the answer.

I was also heavily informed by the bootloader source, the body of the reading code is taken directly from there with adjusted timings.

The general idea:

  • Pressing the button applies a strong pull-down.
  • Normally after start-up, this pin is always being driven by the Pico's QSPI peripheral, so the button has no effect
@andrealbinop
andrealbinop / setup-modernie-vagrant-boxes.md
Last active May 28, 2023 01:54
Setup modern.ie vagrant boxes

Setup modern.ie vagrant boxes

Since modern.ie released vagrant boxes, it' no longer necessary to manually import the ova file to virtualbox, as mentioned here.

However, the guys at modern.ie didn't configured the box to work with WinRM. This how-to addresses that, presenting steps to proper repackage these boxes, adding WinRM support. Additionally configures chocolatey package manager and puppet provisioner.

Pre-requisites