Skip to content

Instantly share code, notes, and snippets.

@stestagg
stestagg / starwars.py
Created March 25, 2016 17:41
micropython starwars
import gc
import machine
import pyb
import time
import network
# Configure GPIO pins 0 and 2 to be used for
# the I²C interface
iic = machine.I2C(pyb.Pin(2), pyb.Pin(0))
curl -L https://github.com/coreos/rocket/releases/download/v0.1.0/rocket-v0.1.0.tar.gz -o rocket-v0.1.0.tar.gz
$ rkt fetch https://github.com/coreos/etcd/releases/download/v0.5.0-alpha.4/etcd-v0.5.0-alpha.4-linux-amd64.aci
$ wget https://github.com/coreos/etcd/releases/download/v0.5.0-alpha.4/etcd-v0.5.0-alpha.4-linux-amd64.aci
$ rkt run https://github.com/coreos/etcd/releases/download/v0.5.0-alpha.4/etcd-v0.5.0-alpha.4-linux-amd64.aci
$ rkt run sha256-701c24b2d275f0e291b807a464ae2390bcd8d7c5b4f2d7e47e6fd917cd5e5588
$ rkt run -volume database:/tmp \
	https://github.com/coreos/rocket/releases/download/v0.1.0/ace-validator-main.aci \
	https://github.com/coreos/rocket/releases/download/v0.1.0/ace-validator-sidekick.aci
rkt run --volume bind:/opt/tenant1/database \
/*
* Your Stylesheet
*
* This stylesheet is loaded when Atom starts up and is reloaded automatically
* when it is changed.
*
* If you are unfamiliar with LESS, you can read more about it here:
* http://www.lesscss.org
*/
@stestagg
stestagg / gist:19165152c7567538a07d
Created October 26, 2014 23:00
Install wpa_supplicant for raspberry pi/arch from x86 machine
mount /dev/sdX2 root
cd root
pacman -r . --config etc/pacman.conf --arch armv6h -S wpa_actiond wpa_supplicant
@stestagg
stestagg / script.py
Created September 24, 2014 09:43
Template for shell script boilerplate
#!/usr/bin/env python
import sys
import argparse
def parse_args(args=None):
parser = argparse.ArgumentParser()
parser.add_argument("-v", "--verbose", action="count", default=0,
help="Increase verbosity", dest="verbosity")
@stestagg
stestagg / colorshift.less
Created April 25, 2014 16:11
Better color shifting for less-css
// Less color functions are absolute, i.e. if you lighten a really light color by 50%, you'll probably just get pure-white,
// because lighten works relative to the full scale from black -> white
// These functions shift a color relative to it's current value, (if you have a 50% grey, and shift it by 50%, you should end up with a 75% grey)
// Because less doesn't support functions as well as I would like, the solution is quite hacky.
// To set a property to a shifted value, call .color_shift, passing it in.
// For example: .color_shift(background, blue, 70%); produces: background: #b3b3ff; (light-blue)
@stestagg
stestagg / rediscopy.py
Created April 23, 2014 15:18
Fairly quickly clone a redis DB across hosts
#!/usr/bin/env python2.7
"""
Copy data from one redis instance to another
"""
import argparse
import sys
# pip install redis fin
@stestagg
stestagg / gil.pyx
Last active December 21, 2015 13:09
cdef extern from "unistd.h":
cdef void sleep(int time)
def lock(time):
print "starting to block"
sleep(10)
print "stop blocking"
<snippet>
<content><![CDATA[
package ${TM_FILEPATH/(.*((?<pfx>com|net|uk|org)\/))?(?<dir>[^\/]+)\/([^\/]+$)?/$+{pfx}.$+{dir}/g};
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>package</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.java</scope>
<description>Automatically calculate package line from file path</description>
</snippet>
#!/bin/bash
function error {
echo -e ">>>>>>>>>>>>>>>>>>>>>>\n$@\n<<<<<<<<<<<<<<<<<<<<<<"
}
set -e
if [ -e test ]; then
echo "'test/' already exists"