Skip to content

Instantly share code, notes, and snippets.

View colegleason's full-sized avatar

Cole Gleason colegleason

View GitHub Profile
@colegleason
colegleason / .Xdefaults
Created April 11, 2012 13:20
Yay for urxvt
! Urxvt theme from: http://crunchbanglinux.org/forums/topic/9935/post-your-xdefaults-and-terminal-apps-colorschemes-with-screenshot/
URxvt.perl-ext-common: default,matcher,tabbedex
!enabling clickable links:
URxvt.urlLauncher: /usr/bin/firefox
URxvt.matcher.button: 1
!urxvt scrolling options and cursor style:
@colegleason
colegleason / post-checkout
Created July 25, 2012 21:05
Show stashed changes after checkout
#!/usr/bin/env python
#
# .git/hooks/post-checkout
import sys
import subprocess
git_name = subprocess.Popen(("git","name-rev","--name-only", "HEAD"),
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
branch_name = git_name.communicate()[0].strip('\n')
git_name.stdout.close()
@colegleason
colegleason / server.py
Last active December 27, 2015 21:49
simple websocket msgpack server
import gevent.monkey
gevent.monkey.patch_all()
import msgpack
from gevent import pywsgi
from geventwebsocket.handler import WebSocketHandler
def websocket_app(environ, start_response):
print('Connected')
if environ["PATH_INFO"] == '/':
ws = environ["wsgi.websocket"]
@colegleason
colegleason / glass.html
Last active August 29, 2015 13:56
[wearscript] vision for glass
<html style="width:100%; height:100%; overflow:hidden">
<head>
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>-->
<script src="https://api.picar.us/wearscriptdev/bower_components/msgpack-javascript/msgpack.js"></script>
</head>
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<canvas id="canvas" width="640" height="360"
style="display:block"></canvas>
<script>
@colegleason
colegleason / glass.html
Last active August 29, 2015 13:57
[wearscript] Serve SRT files to Glass.
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<script>
function cb(channel, msg) {
var tree = new WS.Cards();
tree.add(msg, '');
WS.cardTree(tree);
}
function server() {
@colegleason
colegleason / glass.html
Created March 24, 2014 03:28
[wearscript] MYO
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<script>
function server() {
WS.myoTrain()
// Currently one of {NONE, FIST, FINGERS_SPREAD, WAVE_IN, WAVE_OUT}
WS.gestureCallback('onMyo', function (x) {
WS.say(x);
});
// Value is a quaternion (w, x, y, z) and (pitch, yaw, roll) for convenience
@colegleason
colegleason / glass.html
Last active August 29, 2015 13:57 — forked from connerbrooks/glass.html
[wearscript] Pebble
<html style="width:100%; height:100%; overflow:hidden">
<head>
</head>
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<canvas id="canvas" width="640" height="360" style="display:block"></canvas>
<script>
function cb(data) {
WSRAW.log('x: ' + data['values'][0] + ' y: ' + data['values'][1] + ' z: ' + data['values'][2]);
WSRAW.pebbleSetBody('x: ' + data['values'][0] + ' y: '+ data['values'][1] + ' z: ' + data['values'][2], false);
@colegleason
colegleason / glass.html
Last active August 29, 2015 13:57
[wearscript] MYO Hue Tug of war
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<script data-require="jquery" data-semver="2.0.3" src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<script>
var HUE_ID = 1;
var PLAYER_A = 1;
var PLAYER_B = 3;
var TARGET = 2;
@colegleason
colegleason / glass.html
Last active August 29, 2015 13:57
[wearscript] Magnet
<html style="width:100%; height:100%; overflow:hidden">
<head>
<!-- You can include external scripts here like so... -->
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>-->
</head>
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<canvas id="canvas" width="640" height="360" style="display:block"></canvas>
<script>
@colegleason
colegleason / glass.html
Last active August 29, 2015 13:58
[wearscript] Vision (wizard)
<html style="width:100%; height:100%; overflow:hidden">
<head>
<!-- You can include external scripts here like so... -->
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>-->
</head>
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<style>
#container button {
width: 100%;