This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating | |
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel | |
// MIT license | |
(function() { | |
var lastTime = 0; | |
var vendors = ['ms', 'moz', 'webkit', 'o']; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
# For example, to set 1920x1080 at 60Hz: | |
# . 1920 1080 60 | |
MODE=$(cvt $* | tail -n1) | |
NAME=$(echo $MODE | cut -d' ' -f2 | sed 's/"//g') | |
MODELINE=$(echo $MODE | cut -d' ' -f3-) | |
xrandr --newmode "$NAME" $MODELINE > /dev/null 2>&1 | |
xrandr --addmode VBOX0 $NAME > /dev/null 2>&1 | |
xrandr --output VBOX0 --mode $NAME |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset='utf-8'> | |
<head> | |
<title>Cubism + Websockets</title> | |
<script language='javascript' src='d3.min.js'></script> | |
<script language='javascript' src='cubism.v1.js'></script> | |
<script language='javascript'> | |
/* I can never seem to remember: | |
Array.push() appends to the end, and returns the new length |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# OK here's one that spawns it's own Python thread per request. But this | |
# obviously won't work because I have one synchronous, non-threadsafe | |
# handle to /dev/i2c-1. So I have to schedule each transaction myself. This | |
# sounds a lot like what Tornado is already doing | |
from tornado import web | |
from tornado import gen | |
from functools import wraps | |
import threading | |
def run_async(func): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
import sys | |
import random | |
import time | |
from urllib2 import Request, urlopen, URLError, HTTPError | |
CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghiklmnopqrstuvwxyz" | |
# functions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
syn on | |
set scrolloff=4 | |
set ruler | |
set smarttab | |
set softtabstop=4 | |
set autoindent | |
set expandtab | |
set tabstop=4 | |
set shiftwidth=4 | |
set undodir=~/.vim_runtime/undodir |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
''' Formats a number into its hex and binary representations. Possibly useful | |
for manipulating bit masks and writing assembly. | |
>>> hd(0xfdff) | |
65023 | |
0x f d f f | |
0b 1111 1101 1111 1111 | |
''' |