Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am bradfordbarr on github.
  • I am bradfordbarr (https://keybase.io/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
bradfordbarr / memoized.py
Created Dec 13, 2014
Memoize for indirect recursion
View memoized.py
'''Memoization, based on https://wiki.python.org/moin/PythonDecoratorLibrary#Memoize
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
bradfordbarr / conver.py
Created Nov 24, 2014
Pelican to Jekyll helper
View conver.py
#!/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 (https://keybase.io/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
bradfordbarr / brew-openocd.md
Last active Aug 29, 2015
brew openocd doesn't detect libusb
View brew-openocd.md

Config

~ brew --config
HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/Homebrew/homebrew.git
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
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
.text
.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
bradfordbarr / blinky.s
Last active Aug 29, 2015
Assembly code for flashing the Stellaris Launchpad LED
View blinky.s
.text
.word 0x2000000 // Initial stack pointer
.word start + 1 // Address of the reset vector '+ 1' denotes THUMB instructions vs ARM instructions.
start:
mov r0, #0x00 // Loads 0x00 into register r0
mov r1, #0xFF // Loads 0xFF into register r1
@bradfordbarr
bradfordbarr / test.c
Last active Aug 29, 2015
AVR Hello World
View test.c
/* Borrowed from: http://wiki.hacdc.org/index.php/AVR_Lesson:_Output_Pins_I */
/* 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
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
bradfordbarr / post-receive
Last active Dec 20, 2015
Git hooks for deploying a Django application.
View post-receive
#! /bin/bash
# CONSTS:
# Which server prefix should be used for this post-recieve hook
SERVER="production"
# Which port the local gunicorn instance should use (need to use a different
# port per server).
PORT=8001