Skip to content

Instantly share code, notes, and snippets.

@geekman
geekman / ax3600_led_show.sh
Created Jul 29, 2020
"runway lights" for the Xiaomi AX3600 router
View ax3600_led_show.sh
#!/bin/sh
PREV=
while :; do
for a in led_blue net_blue led_ant led_yellow net_yellow led_ant; do
[ -n "$PREV" ] && echo 0 > /sys/class/leds/$PREV/brightness
echo 1 > /sys/class/leds/$a/brightness
PREV=$a
sleep 1
done
@geekman
geekman / fixup-posts.py
Created Jun 10, 2020
script to fix up blog post markdown files
View fixup-posts.py
#
# rewrite blog posts front matter to fix date format and title
# 2020.05.26 darell tan
#
import re
import os
import sys
import time
View rpmdump.go
/*******************************************************************************
*
* RPM File Dumper
* Adapted to run as a self-contained binary from Holo:
* https://github.com/holocm/holo-build
*
* 2020.05.30 darell tan
*
* Copyright 2015 Stefan Majewsky <majewsky@gmx.net>
*
@geekman
geekman / ida-analysis.py
Last active Jul 3, 2020
simple IDAPython script for scripting automated binary analysis
View ida-analysis.py
#
# ida-analysis.py
# a simple IDAPython binary analysis script
# 2020.05.24 darell tan
#
# invoke with:
# idat64 -c -A -S"ida-analysis.py $HOME/analysis.txt" <file.bin>
#
import sys
@geekman
geekman / dump_config.sh
Created May 14, 2020
snippet to look for effective config lines in config files
View dump_config.sh
# look for non-commented, non-empty lines
grep -v '^\s*\(#.*\)\?$' /etc/someconfig
@geekman
geekman / gen-link.sh
Created Apr 25, 2020
generate systemd network link files to avoid "s0" prefixes
View gen-link.sh
@geekman
geekman / rename-gerbers.cmd
Created Feb 14, 2020
rename KiCad gerbers to remove the layer names from filenames, just extension
View rename-gerbers.cmd
::
:: Rename Gerbers from "random-crap.ext" to "project-name.ext"
:: This also means you shouldn't have two files with the same extension.
::
:: 2019.09.24 darell tan
::
@echo off
setlocal EnableDelayedExpansion
@geekman
geekman / hexdump2bin.py
Created Nov 18, 2019
hexdump to binary file
View hexdump2bin.py
#
# reconstructs binary files from hex dumps
# designed to be more forgiving than `xxd -r`
# dump formats are flexible, whether grouped by 4 digits,
# with or without ASCII, etc.
#
# 2019.10.24 darell tan
#
import sys
@geekman
geekman / dumpscript-gen.py
Created Nov 18, 2019
minicom script generator for dumping firmware
View dumpscript-gen.py
#!/usr/bin/python2
#
# script to generate a minicom script that dumps entire flash
# problem is the stub seems to read all data into RAM first,
# so you can only do in batches
#
# 2019.10.24
# inc needs to be low enough to complete within `expect` timeout
inc = 0x20000
@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
You can’t perform that action at this time.