Skip to content

Instantly share code, notes, and snippets.

@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()
@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()
//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;
# 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):
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)
def ones(x):
if x:
print "1",
return ones(x-1)
@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
@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 / 0.check_keys.py_example.md
Last active December 25, 2015 00:59
Little python3.3 script to show information about ssh public keys from key files or known_hosts files.

SSH key info for pubkeys, known_hosts, and github users

Usage:
  check_keys.py hosts [<FILE>]
  check_keys.py key [<FILE>...]
  check_keys.py github <user>


$ check_hosts.py github cagerton
[
#!yaml
#
# Postgres 9.3 packages salt state
#
# Created 9/9/13
#
# author: Micah Hausler, micah.hausler@akimbo.io
postgres-pkgs:
pkg: