Skip to content

Instantly share code, notes, and snippets.

View JamesTheAwesomeDude's full-sized avatar

James E. A. JamesTheAwesomeDude

View GitHub Profile
@JamesTheAwesomeDude
JamesTheAwesomeDude / ncACMEutil.sh
Last active May 6, 2020 18:45
Namecheap cron script to "automatically" renew Let's Encrypt / ACME-compatible certs
#!/bin/sh
# cd ~/ssl;ln -vs csrs/*.csr www.csr
#cron: 0 0 1 * * "${HOME}/ssl/ncACMEutil.sh" renew www.csr
#CONFIG
cpanellogin=1234567#get this from the "Products" page
cd "${HOME}/ssl"
account_key="lec.key"
account_contact="mailto:webmaster@example.org"
webroot="${HOME}/public_html"#TODO: support different webroots per-domain
@JamesTheAwesomeDude
JamesTheAwesomeDude / python3
Created July 20, 2020 05:06
RHSCL python3 integration
#!/bin/sh
# ~/.local/bin/python3
exec scl enable rh-python36 -- python3 "$@"
@JamesTheAwesomeDude
JamesTheAwesomeDude / restorecon-xtables-lock.service
Last active June 26, 2022 01:43
Fix for RHEL Bugs #1436904 #1376343
# /etc/systemd/system/restorecon-xtables-lock.service
# Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1436904#c3
# Author: James Edington <james.edington@uah.edu>
# HOWEVER, IF YOU ARE READING THIS, you probably need to be
# configuring the McAfee Firewall *instead of* interacting with iptables yourself:
# https://docs.mcafee.com/bundle/endpoint-security-10.6.6-firewall-product-guide-linux/page/GUID-481C8EE3-A371-4D86-8BF4-BB5C18B8C7F9.html
# Example:
# /opt/McAfee/ens/fw/bin/mfefwcli --fw-rule-add --name ALLOW_OUTBOUND --action allow --direction out --notes "Allow all outbound connections from ${HOSTNAME-scanner} per requirements for IDS functionality"
<html>
<head>
<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="http://www.ishygddt.xyz/~james/openlocationcode.min.js"></script>
<script src="http://www.ishygddt.xyz/~james/distVincenty.js"></script>
<script>
const softwareVersionString="My Apologies 20200805 - https://www.github.com/JamesTheAwesomeDude"
@JamesTheAwesomeDude
JamesTheAwesomeDude / 6653.py
Last active November 4, 2020 16:05
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.py < 6653.json
#or
# curl https://www.predictit.org/api/marketdata/markets/6653 | python3 6653.py
data = json.load(sys.stdin)
@JamesTheAwesomeDude
JamesTheAwesomeDude / zendd.py
Last active June 4, 2021 19:05
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
else:
from shlex import quote as shquote
from functools import reduce, wraps
from itertools import repeat, starmap
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
JamesTheAwesomeDude / ishygddt.css
Last active January 6, 2021 00:46
Some sanity in WordPress styles
a {
/* bruh why does Suki nerf this" */
text-decoration: underline;
}
.entry-content p>code[class^='language-'], p>code[class*=' language-'] {
/* https://wordpress.stackexchange.com/q/380863/52811" */
white-space: nowrap;
}
@JamesTheAwesomeDude
JamesTheAwesomeDude / gamertag_to_xuid.sh
Last active March 21, 2024 20:14
Mostly self-contained bash+curl+sed+nc script to convert Xbox Live Gamertags into XUIDs (includes pseudo-UUID support for Floodgate-enabled Minecraft servers)
#!/bin/bash
set -e
set -o pipefail
# USAGE:
# bash gamertag_to_xuid.sh GAMERTAG [...] > out.csv
# DEPENDENCIES:
# - GNU Bash version 4 or newer (or any shell supporting pipefail, heredocs, read, readarray, and POSIX printf)
# - GNU sed version ?? or newer (or any sed implementation supporting, -n, -e, the "p" flag to "s", and capturing-group references in substitution)
@JamesTheAwesomeDude
JamesTheAwesomeDude / gtk-recordMyDesktop.spec
Last active February 5, 2021 00:27
recordMyDesktop RPM packaging
Name: gtk-recordmydesktop
Version: 0.3.8
Release: 1%{?dist}
Summary: GTK frontend for recordMyDesktop
License: GPLv2+
URL: http://recordmydesktop.sourceforge.net/
Source0: https://downloads.sourceforge.net/recordmydesktop/%{name}-%{version}.tar.gz
Patch0: gtk-recordmydesktop-shebang.patch