Skip to content

Instantly share code, notes, and snippets.

import sys
import requests
from hurry.filesize import size, si
from bs4 import BeautifulSoup as Soup
total = 0
def add_to_total(uri, BASE=""):
global total
headers = requests.head(BASE + uri).headers
if "content-length" in headers:
@blha303
blha303 / gist:d866f334e8878a45ac4a
Last active August 29, 2015 14:06
(bookmarklet) Cheat at http://game.ioxapp.com/color/ (for people with bad eyesight or bad screens)
javascript:(function%20()%20{prev="";var%20arr=[].slice.call(document.getElementsByTagName('span')).slice(3);for(i=0;i<arr.length;i++){if(arr[i].style){if(prev!=arr[i].style["backgroundColor"]&&prev!=""){arr[i].style["backgroundColor"]%20=%20"rgb(255,%20255,%20255)";}else{prev%20=%20arr[i].style["backgroundColor"];}}}})()

image

@blha303
blha303 / cahplayer.py
Last active August 29, 2015 14:06
Autoplayer for RoyalDev's Cards Against Humanity IRC bot
from twisted.internet import reactor, task, defer, protocol
from twisted.python import log
from twisted.words.protocols import irc
from twisted.application import internet, service
import yaml, sys, random, re
with open(sys.argv[1] if len(sys.argv) > 1 else 'config.yml') as f:
config = yaml.load(f.read())
HOST, PORT = config['host'], config['port']

Keybase proof

I hereby claim:

  • I am blha303 on github.
  • I am blha303 (https://keybase.io/blha303) on keybase.
  • I have a public key whose fingerprint is C583 9EDD F1F9 D091 EDAF 3590 5930 C685 4030 FCD7

To claim this, I am signing this object:

@blha303
blha303 / tpparse.py
Last active August 29, 2015 14:03
Transperth offline bus stop data and example implementation
# Data can be retrieved (gzipped) from
# https://mega.co.nz/#!os4gjQBR!fspHcvoHZHDzN6IGtJgIXUh4N_ciIEL40tHoivqcKXg
# Currently this data only contains info for weekdays, as of 2014-06-20. I can't make the data
# collection process public, sadly, so please email me if you'd like saturday or sunday/holiday data.
#
# This is an example implementation of a program to read this data, in Python
# It replicates Transperth's service to look up the next five bus times to a stop, as seen here
# http://136213.mobi/Bus/StopResults.aspx?SN=14353
# Please direct questions to [email protected]
#
@blha303
blha303 / mediaserverindex.html
Created June 17, 2014 01:38
A drop-in media server index for apache that uses directory indexing and adds a HTML5 video player. loads directory changes with ajax
<html>
<head>
<script src="jquery.js"></script>
</head>
<body>
<span id="VideoList"></span>
<script>
var videosPath = "/Videos/";
var curdir = "";
function updateList(data) {
@blha303
blha303 / stv_panels.js
Created May 23, 2014 05:04
Speedrun.tv Twitch panels script
// Copying this into the browser console (when you have a chat tab selected) will open the Twitch panels in a new window.
$.getJSON("http://www.corsproxy.com/api.twitch.tv/api/channels/"+$('.selected')[0].textContent+"/panels",
function(result){
var out = [];
$.each(result,
function(i, field){
var outp = "";
if (field["data"]["link"]) {
outp += "<a href=\"" + field["data"]["link"] + "\">";
}
@blha303
blha303 / evelogparse.py
Created May 15, 2014 20:03
EVE Online unfinished chat log parser. Contains some useful functions.
import os
import time
# Config
NAME = ["Steven Kafshaz"]
LASTMSG = {}
def filesbychannel(dirlist):
out = {}
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"
@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"