Skip to content

Instantly share code, notes, and snippets.

@blha303
blha303 / westnetusage.py
Last active December 18, 2015 13:09
ISP usage checker / router disabler
#!/usr/bin/env python2.7
version = "r7"
# This script gets usage from my ISP's website, checks to see if the current average for the month
# is above their recommended amount per day, then disables the wifi on my router if it is.
# I made this for a household of people who don't understand the consequences of their actions
# (namely, that if you abuse our awesome internet, we all have to suffer with being shaped :( )
# Please, modify this for your own ISP/router and set it up in your own house to help with your daily usage.
# -blha303
# Usage: python westnetusage.py [debug]
# Options:
@blha303
blha303 / xmailv1.py
Created July 6, 2013 07:50
xMail Python implementation
# xMail implementation v1 by blha303
# MIT license
# irc.esper.net #drtshock for questions
import json, urllib2, urllib
url = "http://xmail.turt2live.com/mail/index.php"
from random import randrange
def get_password(password):
return urllib2.urlopen("http://blha303.com.au/sha1.php?q=%s" % password).read()
# An alternative for this, on machines with PHP installed, is:
@blha303
blha303 / jtvrtmp.py
Last active December 19, 2015 22:58
#!/usr/bin/env python2
# rtmpdump parameter generator for justin.tv/twitch.tv streams v6
# * Usage: jtvrtmp.py channelname [quality]
# where channelname is the channel name ([twitch/justin].tv/channelname)
# and quality is an optional parameter with a valid quality setting
# (360p, 480p, 720p, etc) If quality isn't present, it selects 'live'.
# * if quality is 'live', it picks the quality setting with a +, which
# is a restream of the video being sent to jtv, no transcoding involved.
#
@blha303
blha303 / multicraft.py
Last active December 20, 2015 08:49
Multicraft Python Cloudbot plugin
# For use with CloudBot (http://git.io/cbgit), although it'll also work as a Python module
# ('import multicraft; data = multicraft.multicraft("METHOD PARAM=VALUE")')
# Full API documentation coming soon (better than Multicraft's PHP-specific documentation, I'm hoping)
# This file (multicraft.py) created by Steven Smith (blha303) 2013
# GPLv3 license (because CloudBot is GPL)
# http://opensource.org/licenses/GPL-3.0
# Updated to use hashlib instead of calling an external website for md5 hashing
# For a working example of this, join irc.esper.net #xD and ask blha303 for a demonstration of multicraft.py
@blha303
blha303 / raptr.py
Last active December 20, 2015 14:29
Raptr last-played lookup
# Raptr last-played info retriever
# For use with CloudBot (http://git.io/cbgit), although it'll also work as a Python module
# (from raptr import raptr; print raptr("blha303");)
# (after removing the 'from util' and '@hook.command' lines, and switching lines 19 and 20)
#
# This file (raptr.py) created by Steven Smith (blha303) 2013
# GPLv3 license (because CloudBot is GPL)
# http://opensource.org/licenses/GPL-3.0
#
# For a working example of this, join irc.esper.net #xD and ask blha303 for a demonstration of raptr.py
@blha303
blha303 / rssfeedrewrite.py
Created August 5, 2013 19:51
RSS feed rewriter
# RSS feed rewriter
# For adding more content from the target page that isn't included normally
# For an example output, compare
# http://www.escapistmagazine.com/rss/videos/list/1.xml
# and
# http://irc.lazle.co/xml/zeropunctuation.xml
# I added Escapist's embed code loaded from their site in the item description.
# A maybe better example is
# http://www.escapistmagazine.com/rss/articles/columns/extra-punctuation.xml
# and
@blha303
blha303 / mediacrush.py
Last active December 21, 2015 02:59
mediacru.sh API Python wrapper
# MIT license
# Created by Steven Smith (blha303) 2013
# r5: Return url if upload(blah, geturl=True)
# r4: Turns out I don't need cookielib.
# r3: Remove unneeded base64 import
# r2: Fixed file upload support, added __name__ == "__main__" section for easy testing or usage from other languages (?)
# r1: Initial. all functionality in place
import urllib2, urllib
# Terraria data ID lookup library
# Copyright 2013 Steven Smith (blha303). All Rights Reserved.
# New BSD license
# http://www.opensource.org/licenses/BSD-3-Clause
import difflib
items = {"Iron Pickaxe": "1", "Dirt Block": "2", "Stone Block": "3", "Iron Broadsword": "4", "Mushroom": "5", "Iron Shortsword": "6", "Iron Hammer": "7", "Torch": "8", "Wood": "9", "Iron Axe": "10", "Iron Ore": "11", "Copper Ore": "12", "Gold Ore": "13", "Silver Ore": "14", "Copper Watch": "15", "Silver Watch": "16", "Gold Watch": "17", "Depth Meter": "18", "Gold Bar": "19", "Copper Bar": "20", "Silver Bar": "21", "Iron Bar": "22", "Gel": "23", "Wooden Sword": "24", "Wooden Door": "25", "Stone Wall": "26", "Acorn": "27", "Lesser Healing Potion": "28", "Life Crystal": "29", "Dirt Wall": "30", "Bottle": "31", "Wooden Table": "32", "Furnace": "33", "Wooden Chair": "34", "Iron Anvil": "35", "Work Bench": "36", "Goggles": "37", "Lens": "38", "Wooden Bow": "39", "Wooden Arrow": "40", "Flaming Arrow": "41", "Shuriken": "42", "Suspicious L
@blha303
blha303 / minidlnagui.py
Last active July 13, 2018 13:26
MiniDLNA Python REST API server and associated Tkinter GUI for reading from it https://github.com/blha303/PythonMiniDLNARestAPI
# https://github.com/blha303/PythonMiniDLNARestAPI
# Run this on a client machine (not the media server)
# This is my first GUI!
# Copyright 2013 Steven Smith (blha303). All Rights Reserved.
# New BSD license
# http://www.opensource.org/licenses/BSD-3-Clause
from Tkinter import *
@blha303
blha303 / 4chanimage.py
Created September 9, 2013 09:15
Cloudbot plugin for autoresponding to image.4chan.org urls, and backing up the linked images to mediacrush (as 4chan images have a very short lifespan)
from util import hook, http
import urllib
import urllib2
import json
import re
BASE_URL = "https://mediacru.sh/"
API_URL = BASE_URL + "api/"