Skip to content

Instantly share code, notes, and snippets.


James JamesTheAwesomeDude

View GitHub Profile
JamesTheAwesomeDude /
Last active Aug 2, 2021
Advance Wars By Web QoL fixes

This is a collection of small quality-of-life tweaks to improve the Advance Wars By Web experience. You can use just one, or all of them; it's up to personal preference.:

  • [Pixel Art]
    Changes the sprites to be crisp instead of blurry (only works on 2.0x and 3.0x Zoom)
  • [Page Title]
    Updates the page title so your browser history isn't a mess, and so you can tell the tabs apart
  • [Game Saver]
    Automatically stores copies of all played games so you never lose them
  • [Cap-Limit Info]
    Show property percentages when creating a match with a cap-limit. Also shows "relative share" values when creating ≥3-player matches with cap limits.
from PIL import Image
import cairosvg.surface
from io import BytesIO
def svg2ico(*args, resolutions={128, 96, 64, 48, 32, 16}, write_to=None, **kwargs):
t = cairosvg.surface.Tree(*args, **kwargs)
ims = []
maxres = max(resolutions) if (None not in resolutions) else None
for res in resolutions:
JamesTheAwesomeDude /
Last active May 20, 2021
Free OID Generator
#!/usr/bin/env python3
# DEC Sixbit binary-packed hierarchicial mapping
# of the DNS namespace onto child node dns-root(0)
# of IANA's unused OID node
# {iso(1) identified-organization(3) iana(90)}
# (enhanced edition)
import codecs
JamesTheAwesomeDude / async-cookbook.js
Created Mar 2, 2021
Trivial JS Asyncification functions
View async-cookbook.js
asleep = (delay => new Promise(resolve => setTimeout(resolve, delay)));
aalert = ((message) => new Promise((resolve) => resolve(alert(message))));
aconfirm = ((message) => new Promise((resolve) => resolve(confirm(message))));
aprompt = ((message, deflt) => new Promise((resolve) => resolve(prompt(message, deflt))));
View geohash.html
<meta charset="UTF-8">
<!-- <script src="" integrity="sha256-8tgc1DyxWwU+qElo1Jwd9aTZiU8H+y3QKZttyeCoIlg=" crossorigin="anonymous"/> -->
<script src="md5.js" integrity="sha256-8tgc1DyxWwU+qElo1Jwd9aTZiU8H+y3QKZttyeCoIlg="></script>
// aXMLHttpRequest: an asynchronous XHR function
function aXMLHttpRequest(method, location, responseType="", body=undefined) {
// somewhat basic; improvements welcome
return new Promise( (resolve, reject) => {
const xhr = new XMLHttpRequest();
JamesTheAwesomeDude / gtk-recordMyDesktop.spec
Last active Feb 5, 2021
recordMyDesktop RPM packaging
View gtk-recordMyDesktop.spec
Name: gtk-recordmydesktop
Version: 0.3.8
Release: 1%{?dist}
Summary: GTK frontend for recordMyDesktop
License: GPLv2+
Patch0: gtk-recordmydesktop-shebang.patch
JamesTheAwesomeDude /
Last active Apr 17, 2021
Completely self-contained bash+curl+sed+nc script to convert Xbox Live Gamertags into Minecraft pseudo-UUIDs for use with Floodgate-enabled servers
set -e
set -o pipefail
nonce=$(head -c 18 /dev/urandom | base64 | sed -e 's.+.-.g;s./._.g')
printf 'Click this:\n\t%s\n' "${client_id=388ea51c-0b25-4029-aae2-17df49d23905}&approval_prompt=auto&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fauth%2Fcallback&scope=Xboxlive.signin+Xboxlive.offline_access&state=${nonce}" > /dev/stderr
code=$(printf '%s\n' "HTTP/1.1 200 OK" "Content-Type: text/html" "" "<script>document.write(new URLSearchParams('code'));</script>"\
| nc -l 8080 | sed -n -e "/${nonce}/p" | sed -n -e '1 s/^GET .\+[?&]\?code=\([^& ]*\).*$/\1/p')
JamesTheAwesomeDude / ishygddt.css
Last active Jan 6, 2021
Some sanity in WordPress styles
View ishygddt.css
a {
/* bruh why does Suki nerf this" */
text-decoration: underline;
.entry-content p>code[class^='language-'], p>code[class*=' language-'] {
/*" */
white-space: nowrap;
import fcntl
def modfl(fd, flags):
'''Adds all given positive flags to, and removes all given negative flags from, the given file descriptor'''
# e.g.: modfl(f, (+os.O_SYNC, -os.O_NONBLOCK))
# would make f synchronous and blocking
#OR-in positive flags; NAND-out negative ones
ins = lambda fl, x: (fl | x) if x >= 0 else (fl &~ -x)
# 1. Get the current flag field
JamesTheAwesomeDude /
Last active Jun 4, 2021
Zenity-based GNU dd GUI (Py2&Py3 wrapper)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division
import sys, os, stat, fcntl, subprocess, select, re
if sys.version_info < (3,):
from pipes import quote as shquote
from shlex import quote as shquote
from functools import reduce, wraps
from itertools import repeat, starmap