Skip to content

Instantly share code, notes, and snippets.

@cagerton
cagerton / fade_test.py
Created November 12, 2012 07:47
Color fade test for PixelPusher
import socket
import time
from math import pi, sin
UDP_IP = '192.168.2.2'
UDP_PORT = 9897
def Push(messages):
"""Stolen from: https://github.com/robot-head/PixelPusher-python"""
assert type(messages) == list
@cagerton
cagerton / gist:1995257
Created March 7, 2012 19:17
Check your ssh public key fingerprint
# Run this command to check your ssh fingerprint.
ssh-keygen -l -f ~/.ssh/*.pub
def ones(x):
if x:
print "1",
return ones(x-1)
def publish_to_wall(user,unfriend):
"""Prints out a pretty unfriends notice"""
logging.info('Posting message to %s' % user.id)
args = {'access_token':user.access_token,
'message':'is no longer friends with %s.' % (unfriend['name']),
'picture':'http://graph.facebook.com/%s/picture' % unfriend['id'],
'link':'http://drama-lama.appspot.com',
'description': 'DramaLama - the unfriending monitor.',
}
post_args = urllib.urlencode(args)
# Steps to monitor who removes you from their friends list on facebook:
# Grab the new Facebook Python-SDK from github.
# Modify & run the appengine+oauth example/demo as follows:
# -in facebookoauth.py define _parse_json & _dump_json
# -in user add two db.TextProperty fields: friends, unfriends
# -swap the HomeHandler class for below...
# -update template to display as desired.
# run & reload every few days and see who doesn't like you anymore.
class HomeHandler(BaseHandler):
//MOSI:
#define DATAOUT 11
//MISO: (not used, but part of builtin SPI)
#define DATAIN 12
#define SPICLOCK 13
#define SLAVESELECT 10
#define LDAC 8
void setup() {
byte clr;
@cagerton
cagerton / mail.py
Created August 6, 2014 01:49
this saves 3 months of vpn setup
from flask import Flask, redirect, render_template, url_for, request
from flask_bootstrap import Bootstrap
import redis
import json
app = Flask(__name__)
Bootstrap(app)
r = redis.Redis()
@cagerton
cagerton / fetch_hostkey.py
Last active August 29, 2015 13:57
Simple script to fetch an ssh host key.
#!/usr/bin/env python2.7
"""Usage: fetch_hostkey.py <host> [<port>]"""
import paramiko, docopt
opt = docopt.docopt(__doc__)
host = opt['<host>']
port = int(opt['<port>'] or 22)
t = paramiko.Transport((host, port))
t.connect()