Skip to content

Instantly share code, notes, and snippets.

@ddm
ddm / 16step.coffee
Created March 8, 2012 15:09 — forked from peterc/16step.coffee
Simple 16 step drum machine using CoffeeScript and Node
# Simple 16 step drum machine experiment with Node and CoffeeScript
# by Peter Cooper - @peterc
#
# Inspired by Giles Bowkett's screencast at
# http://gilesbowkett.blogspot.com/2012/02/making-music-with-javascript-is-easy.html
#
# Screencast demo of this code at http://www.youtube.com/watch?v=qWKkEaKL6DQ
#
# Required:
# node, npm and coffee-script installed
@ddm
ddm / css_transition_callback.js
Created October 16, 2013 09:17
CSS transition callback
$el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function callback () {
// Executed after CSS transition
});
@ddm
ddm / gist:e837207cb673024c245c
Created May 8, 2014 15:35
Python profiling
The Python 2.7 documentation recommends the use of cProfile to profile Python code with reasonnably low overhead: https://docs.python.org/release/2.7/library/profile.html
If you use virtualenv, dont forget to activate it:
$ . bin/activate
How do you launch your script with cProfile enabled ?
$ python -m cProfile -o run.profile myscript.py
The output file (run.profile) will be generated when the execution terminates (including CTRL-C).
@ddm
ddm / Dockerfile
Last active December 22, 2016 16:54
CM13 bacon
FROM debian:jessie
RUN apt-get update
RUN apt-get -y upgrade
RUN apt-get install -y python git-core gnupg flex bison gperf libesd0-dev build-essential zip curl libncurses5-dev zlib1g-dev libncurses5-dev gcc-multilib g++-multilib parted kpartx debootstrap pixz qemu-user-static abootimg cgpt vboot-kernel-utils vboot-utils bc lzma lzop automake autoconf m4 dosfstools rsync u-boot-tools schedtool git e2fsprogs device-tree-compiler ccache dos2unix debootstrap
RUN git clone --depth 1 https://github.com/offensive-security/kali-nethunter.git /nethunter
WORKDIR /nethunter/nethunter-fs/
RUN ./build.sh -f
DIR=`dirname $0`
gcc -g \
`pkg-config --cflags --libs gtk+-3.0` \
-I$DIR \
-lMPSSE \
-lftd2xx \
-L$DIR \
-o spixio \
spixio-gtk.c spixio-gui.c spixio.c
@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 / nrf51.openocd.cfg
Created December 12, 2016 11:13
NRF51 openocd SWD config
source programmer.cfg
transport select swd
set WORKAREASIZE 0
set CHIPNAME nrf51822
source [find target/nrf51.cfg]
reset_config srst_only srst_nogate
adapter_nsrst_delay 100
adapter_nsrst_assert_width 100
@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
@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 / apk.sh
Created February 8, 2017 08:22
Unpack or pack an apk
#!/usr/bin/env bash
DIR=`dirname $0`
TARGET_APK="target.apk"
TARGET_DIR="target"
if [[ ! "$1" =~ ^(unpack|pack)$ ]]; then
echo "Choose 'unpack' or 'pack'"
exit 1
fi