Skip to content

Instantly share code, notes, and snippets.

@blha303
blha303 / irccloud-colorize.js
Last active November 8, 2018 13:13
IRCCloud replace & with formatting characters | &b is bold, &r is reset, &<number from 0 to 15> is a color | I'm going to regret this.
var inputbox = $('#bufferInputView' + cb().bid());
var msg = inputbox.val();
inputbox.val("");
var cc = "\u0003";
var bold = "\u0002";
var reset = "\u000f";
var italic = "\u0016";
var underline = "\u001f";
cb().say(msg.replace(/&b/g,bold).replace(/&r/g,reset).replace(/&i/g,italic).replace(/&u/g,underline).replace(/&/g,cc));
@blha303
blha303 / torrentdirsum.py
Last active August 29, 2015 13:55
Sum up the total size of the contents of a folder of torrents
import libtorrent as lt
from os import listdir
import json
def sizeof_fmt(num):
for x in ['bytes','KB','MB','GB']:
if num < 1024.0 and num > -1024.0:
return "%3.1f%s" % (num, x)
num /= 1024.0
return "%3.1f%s" % (num, 'TB')
@blha303
blha303 / showprocess.py
Last active August 29, 2015 13:56
Script to rename daily show episodes to "<show name> sXXeXX"
import os
import requests
import XML2Dict # The PyPI installer doesn't work; get this from http://blha303.com.au/XML2Dict.zip
from sys import argv
apikey = argv[1] # Get your API key from http://www.thetvdb.com/wiki/index.php?title=Programmers_API
ids = {"The.Daily.Show": "71256", "The.Colbert.Report": "79274", "Craig.Ferguson": "73387"}
eplookupurl = "http://thetvdb.com/api/GetEpisodeByAirDate.php?apikey=%s&seriesid=%s&airdate=%s"
srslookupurl = "http://thetvdb.com/data/series/%s/en.xml"
# I hate working with XML, so let's make them dicts.
@blha303
blha303 / bropages.py
Created February 27, 2014 13:16
Get all bropages entries and output to folder
import requests
from os import mkdir, sep, listdir
from BeautifulSoup import BeautifulSoup as Soup
# Load page
soup = Soup(requests.get("http://bropages.org/browse").text)
# Get rows excluding header
rows = soup.findAll('tr')[1:]
cmds = []
# iterate over rows, get commands, save list without duplicates
for a in rows:
@blha303
blha303 / mp3list.php
Last active August 29, 2015 13:57
Produce list of MP3 files in current and sub directories, playable by clicking
<?php
if (isset($_GET['print'])) {
highlight_file(__FILE__);
die();
}
function load_addon($filename) {
if (file_exists($filename)) {
include $filename;
}
}
@blha303
blha303 / bestgameever.py
Last active August 29, 2015 13:57
Best game ever.
# Usage: python bestgameever.py <password>
# Hint: It's alphanumeric, less than 5 characters.
from sys import argv
import hashlib
code = "98f588baf6859ca943164042560b6479dc277a8c481f186b6ef1b03cb5670dcdbeb226cd2e3808fd12f0b84eff6803290e667735b49fc4134206997e2add5ddf"
if len(argv) > 1:
if hashlib.sha512(hashlib.md5(argv[1]).hexdigest()).hexdigest() == code:
print "Yep."
else:
print "Nope."
@blha303
blha303 / README.md
Last active March 9, 2016 13:51
Skype<->IRC Bridge. Get ROOM id from https://gist.github.com/blha303/9913693. Getting an error? Remove Transport='x11'. Still getting an error? Join irc.esper.net #blha303 and ask.

Skype<->IRC Bridge

I hate Skype. So much. Words can't even describe. It's slow, it's bloated, people keep telling me to get on Skype, I keep telling them to get on IRC, but I never thought there was a way to bridge the two. But there is. And it's super simple. All you need is a VPS. Windows or Linux, doesn't matter, but I'm using Linux. Python is cross-platform and I tested the bot on Windows, so I can help out if you can't get this working there. irc.esper.net #blha303

  1. Install Python 2.7.*. I use 2.7.3 because it's installed by default in Ubuntu, among other reasons.
  2. Get pip or setuptools and install Skype4Py and irc.
  3. Get the script, the other file in this gist. (If you're not using X11 [for instance, if you're using Windows], remove Transport='x11' from near the bottom of the file. Not the whole line, just those exact characters.)
  4. See the ROOM variable on line 8? Know how to set that? Well, let's go.
  • This script lists all open chats, which includes both P2P and grou
@blha303
blha303 / skype_list_rooms.py
Last active August 29, 2015 13:57
List active chats with their IDs. Used with https://gist.github.com/blha303/9913570
import Skype4Py
skype = Skype4Py.Skype(Transport='x11')
print "\n\n".join(["%s: %s" % (a.Name, ", ".join([b.Handle for b in a.Members])) for a in skype.Chats])
@blha303
blha303 / clickviewvids.py
Created April 8, 2014 04:45
Get videos from Clickview server
import requests
import sys
import os
from bs4 import BeautifulSoup as Soup
if len(sys.argv) < 2:
print sys.argv[0] + " <IP of server / ID of video> [ID of video] - Second arg is needed if first arg is IP"
sys.exit(2)
CVSERVER = "10.232.66.197"
from twisted.words.protocols import irc
from twisted.internet import protocol, task, reactor
from twisted.application import internet, service
import subprocess
nick = "Nexus"
user = "Nexus"
passw = "bouncer password"
jenkins_nick = "HawkJenkins"
jenkins_job = "Nexus"