Skip to content

Instantly share code, notes, and snippets.


Keybase proof

I hereby claim:

  • I am bradfordbarr on github.
  • I am bradfordbarr ( on keybase.
  • I have a public key whose fingerprint is 17A8 500D 68FA 1975 1AF5 86DE F198 BCE9 02B7 E39E

To claim this, I am signing this object:

bradfordbarr /
Created Dec 13, 2014
Memoize for indirect recursion
'''Memoization, based on
Modified by me.
import collections
import functools
class memoized(object):
'''Decorator. Caches a function's return value each time it is called.
If called later with the same arguments, the cached value is returned
bradfordbarr /
Created Nov 24, 2014
Pelican to Jekyll helper
#!/usr/bin/env python2
import argparse
import dateutil.parser
import inflection
import os.path
import pypandoc
import re
from codecs import open
View gist:dbca9e2987591c488fc6
### Keybase proof
I hereby claim:
* I am 8bitsofme on github.
* I am jing ( on keybase.
* I have a public key whose fingerprint is 17A8 500D 68FA 1975 1AF5 86DE F198 BCE9 02B7 E39E
To claim this, I am signing this object:
bradfordbarr /
Last active Aug 29, 2015
brew openocd doesn't detect libusb


~ brew --config
HEAD: 98dc2cdb64256dfa4529bfce03447e4e52507c28
HOMEBREW_PREFIX: /opt/boxen/homebrew
HOMEBREW_CELLAR: /opt/boxen/homebrew/Cellar
CPU: 8-core 64-bit ivybridge
OS X: 10.9.3-x86_64
bradfordbarr / test.s
Created May 8, 2014
Adding two numbers using ARM assembly
View test.s
// Assembly generally has three sections in the source
// .text - This is where all of the code lives (Flash)
// .data - This is where all variables with value go (RAM)
// .bss - This is where uninitialized variables go (RAM)
// Since this program is super simple I just used the .text section
.word 0x20000000 // (address 0x0000.0000) This initializes the stack pointer
b start + 1 // (address 0x0000.0004) This instructs the CPU to branch to start at reset
bradfordbarr / blinky.s
Last active Aug 29, 2015
Assembly code for flashing the Stellaris Launchpad LED
View blinky.s
.word 0x2000000 // Initial stack pointer
.word start + 1 // Address of the reset vector '+ 1' denotes THUMB instructions vs ARM instructions.
mov r0, #0x00 // Loads 0x00 into register r0
mov r1, #0xFF // Loads 0xFF into register r1
bradfordbarr / test.c
Last active Aug 29, 2015
AVR Hello World
View test.c
/* Borrowed from: */
/* Blinker Demo */
#include <avr/io.h> /* Defines pins, ports, etc */
#define F_CPU 8000000UL /* Sets up the chip speed for delay.h */
#include <util/delay.h> /* Functions to waste time */
#define LED PB1 /* Defines pin PB4 for the LED. I
often incorporate a bunch of the circuit
info in the defines, which makes
bradfordbarr / Makefile
Created Feb 24, 2014
Sample AVR Makefile
View Makefile
# WinAVR Sample makefile written by Eric B. Weddington, Jörg Wunsch, et al.
# Modified (bringing often-changed options to the top) by Elliot Williams
# make all = Make software and program
# make clean = Clean out built project files.
# make program = Download the hex file to the device, using avrdude. Please
# customize the avrdude settings below first!
# Microcontroller Type
MCU = attiny13
bradfordbarr / post-receive
Last active Dec 20, 2015
Git hooks for deploying a Django application.
View post-receive
#! /bin/bash
# Which server prefix should be used for this post-recieve hook
# Which port the local gunicorn instance should use (need to use a different
# port per server).