Skip to content

Instantly share code, notes, and snippets.

@metaquanta
metaquanta / openwrt_rescue.ttl
Last active November 24, 2018 15:48
Rescue TPL 3600
# Good stuff here: https://wiki.openwrt.org/toh/tp-link/tl-wdr4300
# (p3,5,7,9 on JTAG are GPIOs?)
J1: 1,2,3 (not 4) -> raspi: 10,8,6
minicom -D /dev/ttyAMA0 -b 115200
type: 'tpl<enter>' when uboot is preparing to load
# server should be 192.168.1.100
# see that with printenv
@metaquanta
metaquanta / bash_aliases
Last active November 25, 2020 07:52
Shell foo
# for each line of cmd1, pass it to cmd2.
# cmd1 | each cmd2 %
alias each="xargs -I% -d '\\n'"
# print the sizes of dirs(!) and files in cwd.
alias lsz="du -d 1 -h"
# this'll format /proc/xxx/cmdline as expected.
alias strs='strings -s \ -1'
# like `open` on a mac
alias open=xdg-open
@metaquanta
metaquanta / embed_wikipedia_midis.js
Created September 16, 2018 21:34
Inline Wikipedia's midis
// ==UserScript==
// @name Wikipedia: embed midi
// @namespace mqScripts
// @match *://*.wikipedia.org/*
// @grant none
// @require https://code.jquery.com/jquery-3.3.1.slim.min.js
// ==/UserScript==
// Requires that your browser knows what to do with midi audio tags.
// eg MIDI Player https://chrome.google.com/webstore/detail/midi-player/khppfbnjbaampmeeiocjhcodkklkcfjf
//
@metaquanta
metaquanta / mozilla-firefox-developer-edition.desktop
Last active August 11, 2019 19:08
firefox desktop file ( ~/.local/share/applications/.. )
[Desktop Entry]
Type=Application
Version=1.1
Name=Firefox Quantum: Developer Edition
GenericName=Web Browser
Categories=Network;WebBrowser;
Icon=/home/m/.opt/firefox/browser/chrome/icons/default/default128.png
Exec=/home/m/.opt/firefox/firefox-bin %u
Terminal=false
# From firefox-esr.desktop
/^\s*(-|\+)?\d*(\d|\.\d|\d\.)\d*(e(\+|-)?\d+)?\s*$/
@metaquanta
metaquanta / set_dual_monitor.sh
Created August 16, 2020 16:11
External monitor mode switching for HiDPI chromebook
#!/usr/bin/bash
# Favor internal HiDPI
# 0: +*eDP-1 3200/293x1800/165+3840+600 eDP-1
# 1: +DP-2 3840/546x2400/352+0+0 DP-2
#xrandr \
# --fb 7040x2400 \
# --output eDP-1 --mode 3200x1800 --pos 3840x600 \
# --output DP-2 --scale 2x2 --mode 1920x1200 --pos 0x0
import { AffineTransform } from "./math/2d/AffineTransform";
import { M } from "./math/2d/M";
import { V } from "./math/2d/V";
const R = [
M(1, 0, 0, 1),
M(0, 1, 1, 0),
M(0, 1, 1, 0),
M(-1, 0, 0, -1),
];
@metaquanta
metaquanta / autobacklight
Created October 17, 2020 06:20
Adjust backlight throughout the day to correspond to the location of the sun
#!/bin/bash
# /usr/local/bin/autobacklight
BL_DARK=15
BL_BRIGHT=187
SOLAR_NOON=17:15Z
now_s=$(date +%s)
noon_s=$(date -d "${SOLAR_NOON}" +%s)
@metaquanta
metaquanta / README.md
Last active November 20, 2020 23:31
Install Tails to local disk

In this example I'm installing Tails to the internal storage of an ASUS Chromebook C302 with mrchromebox's EFI firmware. The steps should be the same for any Tails-supported EFI computer. My internal disk is mmcblk0 and its first partition is mmcblk0p1 and my Tails USB drive is sda and its first partition is sda1. Yours may differ, so substitue appropriately.

The Tails installer doesn't seem to want to install to internal storage even though mine's recognized as an SD card.

  1. Boot Tails as normal but set a root password in "Additional Settings".

  2. Launch "Root Terminal".

  3. Create partitions on internal storage with the same geometry as the Tails partitions.

@metaquanta
metaquanta / git-buildpackage.md
Last active November 26, 2020 08:24
Playing Debian maintainer