Skip to content

Instantly share code, notes, and snippets.

View Summertime's full-sized avatar
😳
programming

Andrew C. H. McMillan Summertime

😳
programming
View GitHub Profile
@Summertime
Summertime / EXAPUNKS.txt
Last active November 19, 2023 05:52
Cheatsheets
EXAPUNKS
Notation
R Register
N Number
L Label
O Operand
Registers
X General
{
"policies": {
"CaptivePortal": false,
"DNSOverHTTPS": {
"Enabled": false,
"Locked": true
},
"DisableFeedbackCommands": true,
"DisableFirefoxAccounts": true,
"DisableFirefoxStudies": true,
@Summertime
Summertime / README.md
Last active March 19, 2023 11:22
Bash Book

Bash Book

@Summertime
Summertime / processing.bash
Last active November 23, 2022 11:57
Bunch of functions to make things easier
#!/usr/bin/env bash
p () {
declare USAGE="${FUNCNAME[0]} [-h] [-0] [--] [ARGS ...]"
declare NL='\n'
declare -i OPTIND=1
while getopts h0 OPT; do
case "$OPT" in
'h')printf 'Usage: %s\n' "$USAGE";return;;
'?')printf 'Usage: %s\n' "$USAGE">&2;return 1;;
APPNAME=exchange.sh
p () { printf '%s\n' "$@";}
: "${XDG_CACHE_HOME:=$HOME/.cache}"
cachedget () {
URL=$1
CACHEDIR="$XDG_CACHE_HOME/$APPNAME/curl/GET-$(base64 -w0 <<< "$URL")"
mkdir --parents "$CACHEDIR"
curl -sS \
const filters = [
/^Running script with [0-9]+ thread\(s\), pid [0-9]+ and args/,
]
function findProp(propName) {
// stolen from talamond
for (let div of eval("document").querySelectorAll("div")) {
let propKey = Object.keys(div)[1];
if (!propKey)
continue;
@Summertime
Summertime / growloop.js
Last active December 31, 2021 16:26
bitburner scripts
function shuffleArray(array) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
return array
}
/** @param {NS} ns **/
export async function main(ns) {
let args = ns.flags([
@Summertime
Summertime / bmark.sh
Last active November 22, 2021 17:31
benchmarking HTML vs JSON
#!/usr/bin/env bash
DATADIR=$(pwd)
TEMPDIR=
trap 'cd ~;rm -fr -- "$TEMPDIR"' EXIT
TEMPDIR=$(mktemp -d)
cd -- "$TEMPDIR"
mkdir {html,json}{-compressed,-dictionary,}
#!/usr/bin/env bash
shopt -s extglob
: ${WEBHOOK:?Requires envvar WEBHOOK}
for C in jq curl; do
if command -v "$C" > /dev/null; then
echo "Requires $C to be installed"
exit 1
fi
done
@Summertime
Summertime / color.sh
Created October 8, 2019 01:21
Detect color resolution of the terminal
#!/bin/sh
detect_color_resolution() {
# 24bit
if [ "$COLORTERM" = "truecolor" ]
then
printf '%s\n' 24
return
elif [ "$COLORTERM" = "24bit" ]
then