Skip to content

Instantly share code, notes, and snippets.

@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 = {}
@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 / 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 / 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]
#

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 / 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']
@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

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 / gpstrack.php
Created March 3, 2015 13:19
Google Maps display for a csv-formatted list of dates/latitudes/longitudes/accuracy-in-metres.
<?php
$passwdfile = "/path/to/file";
$logpath = "/path/to/file"; // should be a csv file with date,lat,long,hor-acc
// For json
foreach (apache_request_headers() as $header => $value) { if ($header == "Accept") { $accept = $value; } }
// Variable checks
$allowed = isset($_GET['allowed']);
@blha303
blha303 / apache_mirror.py
Last active August 29, 2015 14:16
Script to mirror a directory visible over apache directory indexing. Creates a batch file containing urls and directory output locations
#!/usr/bin/env python2
# Usage: ./apache_mirror.py [BASE URL] [NUMBER OF COLUMNS]
# If the target site has more (or less) than three columns in the directory index, the second parameter is required.
import sys
import urllib2
from bs4 import BeautifulSoup as Soup
def do_iterate(curdir="", BASE="", COL="", fh=None):
print "Entering {}".format(BASE + curdir)