Skip to content

Instantly share code, notes, and snippets.

@blha303
blha303 / ipxe-isodir.php
Created August 31, 2018 06:43
Loads a directory of isos and returns an ipxe-compatible boot list
<?php
header("Content-Type: text/plain");
$server = "http://192.168.1.1";
?>
#!ipxe
menu ISO Directory
<?php
$arr = array();
$urls = array();
@blha303
blha303 / lookingglass.py
Last active August 28, 2018 15:14
A Looking Glass implementation in Python3 and Flask. Vet code for security concerns before deploying, this isn't tested for vulnerabilities in any way
#!/usr/bin/env python3
from flask import Flask,request,make_response
from shlex import quote
from subprocess import check_output
import socket
from requests import post
app = Flask(__name__)
@app.route('/')
@blha303
blha303 / lyrics2ptr.py
Last active July 10, 2018 04:48
Takes lyrics and a subnet, returns djbdns PTR records for those lyrics
#!/usr/bin/env python
# v4
# known bugs:
# * very long words may break all the things or end up longer than the maximum limit
__usage__ = "{} $network <lyrics"
__example__ = """
$ {} 172.16.1.0/30 <<EOF
this is a test
this is only a test
@blha303
blha303 / get_world_quests.py
Created May 30, 2018 17:25
Gets current world quests active in NA and returns json. Doesn't get zone info yet
#!/usr/bin/env python3
import requests,json
page = requests.get("http://www.wowhead.com/world-quests/na").text
datasets,worldquest_raw = page.split("});\n\n//]]>")[0].split("\nvar lvWorldQuests")
datasets = [n.strip() for n in datasets.split("var _ = {};")][1:]
worldquests = json.loads(worldquest_raw.split("parent: 'list', data: ",1)[1].split("});\n\n//]]>",1)[0])
wq_items, wq_quests, wq_factions = {},{},{}
wq_types = {1: "Profession Quest", 2: "World Quest", 3: "PVP World Quest", 4: "Pet Battle", 5: "Emissary (Faction) Quest", 6: "Dungeon World Quest", 7: "?? Maybe world boss", 8: "Raid World Quest"}
@blha303
blha303 / toornamenter.py
Last active April 11, 2018 08:12
A scriptable program to add fields to a toornament
#!/usr/bin/env python3
# $ python3 toornamenter.py '1349047821760815104,Test label,test_label,1,1,1
# 1262174713922625536,Test label,test_label,1,1,1'
# yes that's a newline in there. takes csv as long as it's purely comma separated values,
# no quotes or escaped commas supported, sorry
import requests
from argparse import ArgumentParser
from os import environ
x = "custom_field_create[{}]"#
@blha303
blha303 / gmusicplay.py
Last active April 3, 2018 04:47
Google Music player in the terminal woopwoop | Individual song playback implemented, album support coming soon?
#!/usr/bin/env python3
from gmusicapi import Mobileclient
import os
from json import load
import sys
def mkdir_p(path):
import errno
try:
os.makedirs(path)
@blha303
blha303 / toornament_customfield.py
Last active March 12, 2018 09:24
Creating a custom field in Toornament (Python3+requests)
#!/usr/bin/env python3
import requests
toornament_id = input("Toornament ID: ")# "1262174713922625536"
email_addr = input("Email address: ")# "[email protected]"
password = input("Password: ")
customfield = {
x.format("label"): "Discord UN",
x.format("machineName"): "discord_un",
x.format("position"): 2,
x.format("required"): 1,
@blha303
blha303 / nbn.py
Last active February 10, 2018 00:57
Looks up addresses on nbnco.com.au
#!/usr/bin/env python
import requests # pip install requests, apt install python-requests
from time import time
from argparse import ArgumentParser
from sys import exit
headers = {"Referer": "https://www.nbnco.com.au/"}
parser = ArgumentParser()
parser.add_argument("address", nargs="*")
[Rainmeter]
Group=LIS
DynamicWindowSize=1
[Metadata]
Name=LIS Date
Author=suudo
License=CC0
;--------
@blha303
blha303 / fixagent.sh
Created January 22, 2018 15:49
A script to fix the Battle.Net Agent crashing constantly on OSX with no warning or error. The elevated instance of Agent dies suddenly, leaving the user-level version doing nothing, with the frozen download meter being the only indication to users
#!/bin/bash
while true; do
ps aux | grep Battle.net | grep Agent | grep root >/dev/null
if [[ "$?" -eq "1" ]]; then
echo "Fixing Agent at "`date +%H:%M:%S`
kill -9 `ps aux | grep Battle.net | grep Agent | grep $USER | awk '{print $2}'`
fi
sleep 5
done