Skip to content

Instantly share code, notes, and snippets.

@aperson
aperson / update_lwjgl.sh
Last active February 4, 2024 20:20
Updates the lwjgl that minecraft uses.
#!/usr/bin/env bash
echo "Determining OS..."
if [[ "$(uname -s)" == "Linux" ]]; then
mcdir="$HOME/.minecraft/"
downloader="wget --no-check-certificate -q -O"
os="linux"
natives="libjinput-linux libjinput-linux64 liblwjgl liblwjgl64 libopenal libopenal64"
elif [[ "$(uname -s)" == "Darwin" ]]; then
@aperson
aperson / overviewer_filters.py
Created May 9, 2012 11:57
A set of marker filters for the Minecraft Overviewer
def screenshotFilter(poi):
'''This looks for signs that have their first line in the 'Image:<id>' format, where <id> is an
id from an Imgur.com image.'''
if poi['id'] == 'Sign':
if poi['Text1'].startswith('Image:'):
poi['icon'] = "painting_icon.png"
image_html = "<style>.infoWindow img[src='{icon}'] {{display: none}}</style><a href='http://imgur.com/{id}'><img src='http://imgur.com/{id}s.jpg' /></a>".format(icon=poi['icon'], id=poi['Text1'][6:])
return "\n".join([image_html, poi['Text2'], poi['Text3'], poi['Text4']])
def playerFilter(poi):
@aperson
aperson / gaming_stats.py
Created April 12, 2012 00:50
Does simple comparison of who moderates what other gaming subreddits.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import urllib.request
import time
import re
import sys
class Grabber:
@aperson
aperson / dictionary_search.py
Created April 17, 2012 21:07
Ways to pull out a value from a dict case insensitively
def ids (t, d):
for i in d.keys():
if re.match(r'^{}$'.format(t), i, re.I):
return d[i]
@aperson
aperson / ban_all.py
Created October 8, 2012 20:28
Quick script to ban a user from every subreddit you moderate (use wisely!)
#!/usr/bin/env python3
import json
import urllib.request
import time
import re
import signal
import sys
from urllib.parse import urlencode
import http.cookiejar
@aperson
aperson / change_subreddit_mode.py
Created September 20, 2013 19:05
This script will change the mode of a subreddit. First you either need to make a file named 'credentials' that is in the same directory as the script that has your login info and subreddit or you can just replace the info in the script directly. Just invoke the script with the subreddit mode as an argument (eg: `python3 change_subreddit_mode.py …
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import praw
try:
from credentials import * #NOQA
except:
USERNAME = 'username'
@aperson
aperson / mass_ban.py
Created May 27, 2013 03:42
Quick script to ban a user from every public subreddit you moderate
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import praw
import requests
import sys
try:
from credentials import * # NOQA
except ImportError:
#!/usr/bin/env python3
from urllib.request import urlopen
import xml.etree.ElementTree as etree
import re
import json
def get_snapshot():
NS = '{http://s3.amazonaws.com/doc/2006-03-01/}'
@aperson
aperson / twitch.py
Created April 8, 2014 19:01
Script to stream to twitch.tv. I got this from @brownan, but I can't find it anywhere at the moment online
#!/usr/bin/env python3
# Adapted from http://www.creativetux.com/2012/11/streaming-to-twitchtv-with-linux.html
#
# Make sure to put your twitch.tv key in a file called "key" in the current directory.
#
# Before running, make sure PulseAudio is set up with the correct loopback modules
# and a null sink named "mix". You can use something ilke the following commands:
#
# pactl load-module module-null-sink sink_name=mix
@aperson
aperson / remove-ham.py
Created September 24, 2012 01:47
Quick script to remove ham from the modqueue en-mass
#/usr/bin/env python3
import json
import urllib.request
import time
import re
import signal
import sys
from urllib.parse import urlencode
import http.cookiejar