Skip to content

Instantly share code, notes, and snippets.

@mrled
mrled / about.md
Last active March 23, 2024 01:29
Ploopy Nano control by LED-Key BitMask shell script

A quick script to control lkbm firmware on the Ploopy Nano.

See this post for more features and more explanation.

Raspberry Pi 4 Alpine chroot scripts

🚨🚨🚨 I don't recommend this 🚨🚨🚨

I'm keeping it here so I can remember what I did, but I think a Docker container is a better way to go about it. I wrote a Dockerfile for this over here: https://github.com/mrled/alpine-rpi4-aports-docker

Scripts for building an Alpine chroot for building Alpine packages.

Who/what is this for?

@mrled
mrled / Extract-Alpine-Rpi-initrd.md
Last active December 5, 2020 23:55
Makefile which extracts an alpine initrd from the arm64 rpi tarball

Extract Alpine Linux ARM64 Raspberry Pi initrd

Want to see what's in the initrd without installing it?

This will extract it for you.

It also reminds me how to deal with cpio archives, which I can never remember.

@mrled
mrled / cryptdec.sh
Created October 10, 2017 17:37
Encrypt / decrypt a tarball in git
#!/bin/bash
# {En,De}crypt the private/ directory
# WARNING: I haven't used this script in a long time
# I'm putting it here because I found it on my hard drive from ages ago
# yolo I guess
# The private/ directory should not be stored in version control
# Instead, this scripts creates a private.tar.encrypted.asc file
# out of the private/ directory,
@mrled
mrled / gitconfig.markdown
Created October 10, 2017 01:26
Git configuration notes

Git configuration

FSCK objects

You probably want to enable object fscking, which will protect against some hypothetical attacks on SHA1

git config --global transfer.fsckobjects true
git config --global fetch.fsckobjects true
@mrled
mrled / invisible_states_of_america.tsv
Last active October 10, 2017 00:52
UEL ARAMCHEK's INVISIBLE STATES OF AMERICA tsv
STATE TOURISM GUIDE
WEST DAKOTA Here, goblets of diesel fuel are burned in offering to the railroad gods. Locals make omelettes using the eggs of rattlesnakes.
APSYLANIA A land of snow and rust where only water towers can survive. Their long, iron tentacles guard the tombs of forgotten presidents.
AGASSIZ A colossal lead heart that connects all sewers throbs just beneath this state's surface. Its palpitations are felt as earthquakes.
SELIMA Known for pan-fried hornets dipped in maple salsa. The Roosevelt National Labyrinth begins near its eastern border, and never ends.
OROCROIX Scarecrows stuffed with telephone wire fill the few ghost towns that remain here. They subsist on our expended alkaline batteries.
ELKANSAS In the famous Deepweather Caves, tornadoes slumber in jet-black chrysalises. Tourists can get up close and hear their heartbeats.
NEW BELARUS Every other summer, its sun-drunken residents gather together in the countryside and burn a cumulonimbus cloud to the ground.
MISUSCHAQUA The Sword of Chevr
@mrled
mrled / fix-elcapitan-vbox.sh
Last active October 10, 2017 00:30
Fix macOS El Capitan VirtualBox VM
#!/bin/sh
usage() {
cat <<ENDUSAGE
$0: Apply required virtual firmware changes so that El Capitan will run under VirtualBox
Usage: $0 <VM_NAME>
ENDUSAGE
}
if test $# -ne 1 || test "$1" == "-h" || test "$1" == "--help"; then
@mrled
mrled / iptricks.markdown
Created September 21, 2017 18:55
Linux `ip` tricks

Linux ip tricks

# call like 'getips <INTERFACE> <FAMILY>'
# e.g. 'getips eth0 inet' might return 192.168.1.1/24
# e.g. 'getips eth0 inet6' might return fe80::4008:c2ff:fee8:fc93/64
# Note that this will retur all IPs of the family assigned to the interface - possibly more than one
getips() {
    if test $# != 2; then
        return 1

fi

@mrled
mrled / python_converting_timezones.markdown
Last active August 3, 2023 13:34
[Converting timezones from Windows to IANA in Python]

Converting timezones from Windows to IANA and back in Python

Spoiler alert: I couldn't end up doing this, jesus christ timezones are such a mess

General notes

There are many mappings between timezones.

  1. Obviously I could maintain one myself, but it's sufficiently complex that I don't want to take this on
  2. Unicode maintains a mapping of Windows to IANA zones, but it only has entryes for standard timezone names ("Pacific Standard Time") and not DST timezone names ("Pacific Daylight Time"): https://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml
@mrled
mrled / Show-OctopusVariables.ps1
Created August 31, 2017 01:03
[Show Octopus Variables in Powershell] #powershell #octopus
<#
.synopsis
Show Octopus parameters defined in files
.parameter rootPath
Search recursively from here.
If the tree is large, this command will take a long time. If you're working in a Git repository of a project directory, it might be worth running 'git clean -fxd' beforehand. This will delete all your bin/ and obj/ directories (meaning any binaries you have built will be deleted), but will make this command run faster.
.parameter filePattern
Look for files whose name matches this pattern. By default, only look for *.Octopus.config files.
#>
function Show-OctopusVariables {