Skip to content

Instantly share code, notes, and snippets.

View bradfordbarr's full-sized avatar

Bradford Barr bradfordbarr

View GitHub Profile
@bradfordbarr
bradfordbarr / camera.html
Created September 5, 2011 04:37
ThreeJS Camera Issues
<!DOCTYPE html>
<html>
<head>
<title>Camera movement test | Threejs</title>
</head>
<body>
<div id="container"></div>
<script type="text/javascript" src="RequestAnimationFrame.js"></script>
<script type="text/javascript" src="Stats.js"></script>
<script type="text/javascript" src="Three.js"></script>
@bradfordbarr
bradfordbarr / post-receive
Last active December 20, 2015 08:38
Git hooks for deploying a Django application.
#! /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
@bradfordbarr
bradfordbarr / Makefile
Created February 24, 2014 06:42
Sample AVR 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 / test.c
Last active August 29, 2015 13:56
AVR Hello World
/* 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 / blinky.s
Last active August 29, 2015 14:01
Assembly code for flashing the Stellaris Launchpad LED
.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.s
Created May 8, 2014 03:11
Adding two numbers using ARM assembly
// 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 / brew-openocd.md
Last active August 29, 2015 14:02
brew openocd doesn't detect libusb

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
### 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 / conver.py
Created November 24, 2014 07:36
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
@bradfordbarr
bradfordbarr / memoized.py
Created December 13, 2014 03:52
Memoize for indirect recursion
'''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