Skip to content

Instantly share code, notes, and snippets.

@ddm
ddm / programmer.cfg
Last active December 28, 2023 15:45
rpi zero openocd SWD config
interface bcm2835gpio
# hexdump -s4 -n4 -e '\"0x\" 4/1 \"%02X\"\"\\n\"\" \"' /proc/device-tree/soc/ranges
bcm2835gpio_peripheral_base 0x20000000
# Transition delay calculation: SPEED_COEFF/khz - SPEED_OFFSET
# These depend on system clock, calibrated for stock 700MHz
# bcm2835gpio_speed SPEED_COEFF SPEED_OFFSET
bcm2835gpio_speed_coeffs 146203 36
@ddm
ddm / launch.sh
Created June 24, 2019 06:58
X11 Docker Apps with XQuartz xterm
#!/usr/bin/env bash
COMMAND=$1
pushd `dirname $0` > /dev/null
DIR=`pwd -P`
popd > /dev/null
cd $DIR
@ddm
ddm / share-vpn.sh
Last active May 9, 2018 22:09
Share openvpn/tunnelblick connection on Mac OSX Sierra
#!/usr/bin/env bash
DIR=`dirname $0`
echo 'nat on en0 from $localnet to any -> (en0)' > $DIR/share-vpn.rules
sudo pfctl -f $DIR/share-vpn.rules -e
echo "Use 'sudo pfctl -F all' to clear NAT rules"
@ddm
ddm / lpc1114.cfg
Last active October 15, 2017 06:53 — forked from RickKimball/lpc1114.cfg
configuration files for lpc812 using SWD from an stlink-v2 discovery board
#-----------------------------------------
# NXP lpc1114fn23 Cortex-M0 32k flash, 4k ram
set CHIPNAME lpc1114
set CPUTAPID 0x0BB11477
set CPUROMSIZE 0x8000
set CPURAMSIZE 0x1000
# After reset the chip is clocked by the ~12MHz internal RC oscillator.
# When board-specific code (reset-init handler or device firmware)
@ddm
ddm / JavaScript.ipynb
Last active September 22, 2017 21:19
docker run -p 127.0.0.1:8888:8888 -v `pwd`:/work dimdm/notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/bin/bash
# Create a complete OS .dmg file (it needs the Apple Developers Tools installed)
# usage:
# pkg-create.sh <contents-root-folder> <package-name> <package-version> <vendor-string>
#
CONTENTS=$1
shift
NAME=$1
shift
#!/usr/bin/env sh
/usr/bin/screen -S reverse-ssh-tunnel -d -m /usr/bin/autossh -M 65500 -o "ServerAliveInterval 20" -R 2222:localhost:22 server
@ddm
ddm / docker-compose.yml
Created August 1, 2017 19:39
Alpine cron
version: "3"
services:
cron:
image: alpine
command: sh -c "echo '* * * * * task > /proc/1/fd/1 2> /proc/1/fd/2' | crontab - && crond -f"
volumes:
- ./task.sh:/usr/local/bin/task:ro

Adventures in Python Core Dumping

After watching Bryan Cantrill's presentation on [Running Aground: Debugging Docker in Production][aground] I got all excited (and strangely nostalgic) about the possibility of core-dumping server-side Python apps whenever they go awry. This would theoretically allow me to fully inspect the state of the program at the point it exploded, rather than relying solely on the information of a stack trace.

@ddm
ddm / cm13-bacon.sh
Last active April 5, 2017 07:25
CM13 bacon
#!/usr/bin/env bash
sudo apt-get update && sudo apt-get install -y bc bison build-essential curl flex git gnupg gperf libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk3.0-dev libxml2 libxml2-utils lzop maven openjdk-8-jdk pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-dev lib32z1-dev android-sdk
if `hash adb &>/dev/null`; then
echo "Android tools found..."
else
echo "Installing android tools..."
echo "y" | android update sdk -u -a --filter tools
echo "y" | android update sdk -u -a --filter platform-tools