Skip to content

Instantly share code, notes, and snippets.

# Hey tripit, tell me what dates I have accommodation booked so I know the trip's covered
from pytripit import tripit
consumer_key = '---'
consumer_secret = '---'
authorized_token_key = '---'
authorized_token_secret = '---'
oauth_credential = tripit.OAuthConsumerCredential(consumer_key, consumer_secret, authorized_token_key, authorized_token_secret)
@mindsocket
mindsocket / deNaN.py
Created November 21, 2012 01:12
Quick script for removing NaN values from rrd files
#!/usr/bin/python
# Shell usage example:
# f=somefile.rrd
# rrdtool dump $f > /tmp/$f.xml && /tmp/deNaN.py /tmp/$f.xml > /tmp/$f.xml.new && mv $f{,.bak} && rrdtool restore /tmp/$f.xml.new $f
import fileinput
import re
lastval = ''
@mindsocket
mindsocket / wugcbot.py
Created July 11, 2012 01:56
WUGC_AUscorebot
'''
Created on 08/07/2012
@author: roger
'''
import requests
from lxml import etree
import lxml. html
import memcache
from twitter.oauth import OAuth
@mindsocket
mindsocket / ingdirect.py
Created June 29, 2012 04:51
Munin plugin to log in to ING Direct (Australia) account and extract account balances
#!/usr/bin/env python
# -*- python -*-
#
# Plugin to track account balances on ingdirect.com.au, using selenium gymnastics to log in
#
# E.g.
# ln -s /usr/share/munin/plugins/ingdirect.py /etc/munin/plugins/ingdirect
#
# Needs (hint: pip install):
# selenium
@mindsocket
mindsocket / rego.py
Created May 31, 2012 10:53
2Checkout.com Instant Notification Service - simple CGI processor - python
#!/usr/bin/env python
# Simple cgi script to process 2checkout.com's Instant Notification Service
# See: https://www.2checkout.com/static/va/documentation/INS/index.html
# This script is intended to demonstrate validation of the md5_hash and assumes a Fraud State Changed notification
# Disclaimer: YMMV
import cgi
print "Content-type: text/html"
print
@mindsocket
mindsocket / lastmatchwithnums.py
Created March 19, 2012 02:41
Use beets' acoustid plugin, musicbrainz lookup and lastfm api to determine playcounts for a collection
#!/home/roger/.virtualenvs/lastfm/bin/python -u
"""
File: lastmatchwithnums.py
Author: Roger Barnes
A simple program for using acoustid to fingerprint and look up metadata (esp. play counts)
for MP3 files via lastfm. Usage:
$ python lastmatchwithnums.py [folder] ...
@mindsocket
mindsocket / app.py
Created November 22, 2011 12:09
Basic web.py backend for @themaninblue's DrawPad
import web
import json
urls = (
'/', 'index',
'/post', 'post',
'/data', 'data',
)
def add_global_hook():