Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
if [ $# -eq 0 ]
then
echo "usage: $0 <disc number>"
exit
fi
discnumber=$(printf "%02d" $1)
discname="Disc $discnumber"
import random
class MarkovChainGenerator(object):
def __init__(self, fileHandle):
self.words = self.read_words(fileHandle)
self.create_database()
@staticmethod
def read_words(fileHandle):
fileHandle.seek(0)
@andmatand
andmatand / svn_tag.py
Last active September 23, 2016 18:53
#!/usr/bin/env python3
import re
import subprocess
import sys
from xml.etree import ElementTree
if len(sys.argv) == 2:
commitMessage = sys.argv[1]
else:
@andmatand
andmatand / torrent_rss.py
Last active November 14, 2015 06:07
Library for adding specific torrent magnet links from an RSS feed to Transmission
#!/usr/bin/env python3
import re
import sys
import subprocess
import urllib.request
from xml.etree import ElementTree
from gzip import GzipFile
from io import BytesIO
@andmatand
andmatand / steam-trade-notifier.py
Last active August 29, 2015 14:04
Send e-mail notifications for Steam trade offers, to be run as a cron job
#!/usr/bin/env python3
# Purpose: Send an e-mail notification when a Steam trade offer is accepted or
# received.
# Documentation URL:
# https://developer.valvesoftware.com/wiki/Steam_Web_API/IEconService
# Set these before running this script:
STEAM_API_KEY = 'your steam API Key'
STEAM_PROFILE = 'your public steam profile name'
// This work is licensed under the Creative Commons Attribution 3.0 United States License. To view
// a copy of this license, visit http://creativecommons.org/licenses/by/3.0/us/ or send a letter
// to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
// Copyright 2009 John Tantalo <[email protected]>
(function () {
// get selection
var selection = window.getSelection ? window.getSelection() :
document.getSelection ? document.getSelection() :
@andmatand
andmatand / save_rects.py
Created October 10, 2013 04:47
GIMP plugin to save layer info to a format used by Kitty Town engine
#!/usr/bin/env python
from gimpfu import *
def get_layer_fields(layer):
return [layer.name,
str(layer.offsets[0]),
str(layer.offsets[1]),
str(layer.width),
str(layer.height)]
@andmatand
andmatand / ftpupload.sh
Created April 21, 2013 03:52
Upload a file (given as the sole argument) to an ftp server, without requiring user intervention.
#!/bin/sh
SERVER=example.com
USERNAME=username
PASSWORD=password
FILENAME=$1
echo -n "Uploading $1..."
ftp -n $SERVER <<End-Of-Session
@andmatand
andmatand / gist:2560751
Created April 30, 2012 18:22
Replace tabs with 4 spaces
for i in *.lua; do expand -t 4 $i > $i.notabs && mv $i.notabs $i; done