Skip to content

Instantly share code, notes, and snippets.

geekman

Block or report user

Report or block geekman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@geekman
geekman / til311-tester.ino
Created Sep 14, 2016
Arduino sketch for testing TIL311 / DIS1417 displays
View til311-tester.ino
/*
* TIL311 / DIS1417 tester
*
* MSB_PIN -> input D
* input C
* input B
* LSB_PIN -> input A
*
* also hook up LATCH_PIN and BLANKING_PIN accordingly
*
@geekman
geekman / parse_keybag.py
Created Mar 3, 2017
extract & parse the BackupKeyBag from an iTunes Backup
View parse_keybag.py
#!/usr/bin/env python
#
# extracts and parse BackupKeyBag
#
# 2017.02.04 darell tan
#
from plist import *
import struct
import sys
@geekman
geekman / bits.py
Created Sep 12, 2019
one-liner combining bits into an integer, the Python way
View bits.py
bits = [1,0,1,0,0,0,0,1]
v = reduce(lambda x, y: x | y,
[n << p for p, n in enumerate(reversed(bits))])
print '%02x' % v
@geekman
geekman / screen-hardstatus.md
Created Aug 6, 2019
simple GNU screen hard status line
View screen-hardstatus.md
@geekman
geekman / .sigrok toy decoder.md
Last active Jul 9, 2019
libsigrok toy decoder
View .sigrok toy decoder.md

libsigrok Toy Decoder

This is a very minimal example for writing your own quick-and-dirty decoder that you can use in PulseView.

This decoder displays annotations for a signal that's made up of 1 ms units. It annotates from one signal edge to another, without regard for time. If you want to handle the actual units of time, more logic is required and that's left as an exercise for the reader.

@geekman
geekman / myusbgadget
Created Jan 17, 2017
Pi Zero multiple USB gadgets minimal example
View myusbgadget
#!/bin/bash -e
modprobe libcomposite
cd /sys/kernel/config/usb_gadget/
mkdir g && cd g
echo 0x1d6b > idVendor # Linux Foundation
echo 0x0104 > idProduct # Multifunction Composite Gadget
echo 0x0100 > bcdDevice # v1.0.0
@geekman
geekman / fix-single-dialog.lua
Created Jun 13, 2019
Aegisub plugin to remove lone dash from single dialog
View fix-single-dialog.lua
--
-- usually a dash is used to indicate multiple parties talking in one sub
-- but oddly, sometimes a single dash is present, even if only a single person
-- is talking. this script fixes that.
--
script_name = "Fix single dialog"
script_description = "Remove dash for single party dialog"
script_author = "darell tan"
script_version = "1"
@geekman
geekman / subst-exec.sh
Created May 30, 2019
replaces patterns like "<? cmd ?>" by executing cmd
View subst-exec.sh
#
# awk one-liner to replace patterns like "<? cmd ?>" by executing cmd
# handy for use in config files "templates"
#
cat <<EOF | awk '{ if (match($0, /<\?(.*)?>/)) { cmd = substr($0, RSTART+2, RLENGTH-2-2); system(cmd) } else print }'
my directory has these files:
<? ls / ?>
EOF
@geekman
geekman / ffmpeg-snippets.md
Created May 22, 2019
some ffmpeg commands
View ffmpeg-snippets.md

create a list of filename,title list

for %f in (*.mp4) do @ffprobe -v error -of csv -show_entries format=filename:format_tags=title %f >> list.txt
@geekman
geekman / strip-query-snippet.js
Created May 22, 2019
strips query string from selected URLs on page
View strip-query-snippet.js
// strip query string (or search params) from "/xyz/..". URLs
for (let a of document.querySelectorAll('a[href^="/xyz/"]')) {
let u = new URL(a.href.toString());
u.search = '';
a.href = u;
}
You can’t perform that action at this time.