Skip to content

Instantly share code, notes, and snippets.


James JamesTheAwesomeDude

View GitHub Profile
JamesTheAwesomeDude /
Last active Jan 13, 2021
Completely self-contained bash+curl+sed script to convert Xbox Live Gamertags into Minecraft pseudo-UUIDs for use with Floodgate-enabled servers
set -e
set -o pipefail
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" > /dev/stderr
code=$(printf '%s\n' "HTTP/1.1 200 OK" "Content-Type: text/html" "" "<script>window.close();</script>" | nc -l 8080 | 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 Jan 3, 2021
Zenity-based GNU dd GUI (Py2&Py3 wrapper)
#!/usr/bin/env python
from __future__ import division
import sys, os, stat, fcntl, subprocess, select, re
from functools import reduce
#TODO: rewrite this whole program as a sub-512-byte Perl script
def main(args=sys.argv[1:]):
dcmd = ['dd'] + args + ['status=progress']
JamesTheAwesomeDude /
Last active Nov 4, 2020
Histogram: 2020 Electoral College victory-margin odds
#!/usr/bin/env python3
import json,re,math,sys
import statistics
import matplotlib.pyplot as plt
# python3 < 6653.json
# curl | python3
data = json.load(sys.stdin)
View location.html
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>GPS Trace 0.3</title>
<script src=""></script>
<script src=""></script>
const softwareVersionString="My Apologies 20200805 -"
JamesTheAwesomeDude / restorecon-xtables-lock.service
Last active Jul 31, 2020
Fix for RHEL Bugs #1436904 #1376343
View restorecon-xtables-lock.service
# /etc/systemd/system/restorecon-xtables-lock.service
# Fixes
# HOWEVER, IF YOU ARE READING THIS, you probably need to be
# configuring the McAfee Firewall *instead of* interacting with iptables yourself:
# Example:
# /opt/McAfee/ens/fw/bin/mfefwcli --fw-rule-add --name ALLOW_OUTBOUND --action allow --direction out --notes "unblock everything lolol"
JamesTheAwesomeDude / python3
Created Jul 20, 2020
RHSCL python3 integration
View python3
# ~/.local/bin/python3
exec scl enable rh-python36 -- python3 "$@"
JamesTheAwesomeDude /
Last active May 6, 2020
Namecheap cron script to "automatically" renew Let's Encrypt / ACME-compatible certs
# cd ~/ssl;ln -vs csrs/*.csr www.csr
#cron: 0 0 1 * * "${HOME}/ssl/" renew www.csr
cpanellogin=1234567#get this from the "Products" page
cd "${HOME}/ssl"
webroot="${HOME}/public_html"#TODO: support different webroots per-domain
JamesTheAwesomeDude / minecraft@.service
Last active Jan 8, 2021
systemd user-unit file for Minecraft server
View minecraft@.service
# ~/.config/systemd/user/minecraft@.service
# loginctl enable-linger "${USER}"
# systemctl --user daemon-reload
# systemctl --user enable minecraft@-srv-minecraft-survival.service
# ln -svf ../jars/paper-1.16.1_101.jar /srv/minecraft/survival/server.jar
# systemctl --user start minecraft@-srv-minecraft-survival.service
Description=Minecraft Server (%I)