Skip to content

Instantly share code, notes, and snippets.

@toonetown
toonetown / wordle-solver
Last active February 15, 2022 15:04
Helps solve wordle puzzles
#!/bin/bash
set -o pipefail
WORDS=$(cat << EOF
aback
abase
abate
abbey
abbot
abhor
@toonetown
toonetown / symbolicate
Last active August 8, 2022 22:02
A script which will help decode macOS dumps, logs, and panics
#!/bin/bash
###########
# A script which will help to decode crashes, spindumps, and samples
###########
# Helper functions
function do_jq {
_J="$(which jq 2>/dev/null)" || {
echo "You must install jq (brew install jq) to use the script" >&2; return 1;
}; "${_J}" "$@"
# Copyright (C) 2015 Facebook, Inc
# Maintained by Ryan McElroy <rm@fb.com>
#
# Inspiration and derivation from git-completion.bash by Shawn O. Pearce.
#
# Distributed under the GNU General Public License, version 2.0.
#
# ========================================================================
#
# Quickly determines the and emits some useful information about the state
@toonetown
toonetown / tot
Last active February 29, 2020 18:17 — forked from zrzka/!IMPORTANT.md
A shell script for Tot
#!/usr/bin/env bash
# Fork of gruber's tot.sh https://gist.github.com/gruber/b18d8b53385fa612713754799ed4d0a2
# which is a fork of chockenberry's tot.sh https://gist.github.com/chockenberry/d33ef5b6e6da4a3e4aa9b07b093d3c23
# Exit immediately if a pipeline returns a non-zero status.
set -e
# If set, the return value of a pipeline is the value of the last (rightmost) command
# to exit with a non-zero status, or zero if all commands in the pipeline exit successfully.
set -o pipefail
@toonetown
toonetown / nuke-gsw
Last active April 16, 2020 16:27
Nukes the Google Software Update so that you can just use homebrew instead
#!/bin/bash
defaults write com.google.Keystone.Agent checkInterval 0
mkdir -p ~/Library/Google
rm -rf ~/Library/Google/GoogleSoftwareUpdate
sudo touch ~/Library/Google/GoogleSoftwareUpdate
sudo chown root:wheel ~/Library/Google/GoogleSoftwareUpdate
sudo chmod go-w ~/Library/Google/GoogleSoftwareUpdate
@toonetown
toonetown / print-cpp-tokens
Created February 21, 2020 18:07
Prints out all the c++ tokens (keying off ::) in a file
#!/bin/bash
[ -f "${1}" ] || { echo "Usage: ${0} <file>" >&2; return 1; }
cat "${1}" \
| sed -e 's|//.*$||g' \
| sed -e 's/::/xxDOUBLExCOLONxx/g' \
| perl -ne '{ print join("\n",split(/[[:^word:]]+/)),"\n"; }' \
| sed -e 's/xxDOUBLExCOLONxx/::/g' \
| grep '::' \
| grep -v '^::' \
| sort -u
@toonetown
toonetown / auto-exclude.sh
Created February 20, 2020 19:41
A script which automatically will exclude build directories from time machine
#!/bin/bash
: ${BASEDIR="${HOME}/Documents/Programming"}
: ${MAXDEPTH=6}
find "${BASEDIR}" -maxdepth ${MAXDEPTH} -type f \( -name pom.xml -o -name build\.sh \) -print0 \
| while read -d $'\0' _f; do
find "$(dirname "${_f}")" -maxdepth 1 -type d \( -name target -o -name build \) -exec tmutil addexclusion {} \;
done
@toonetown
toonetown / ksymbolicate
Last active August 16, 2021 20:24
A script which will help decode macOS kernel panics
#!/bin/bash
###########
# A script which will help to decode macOS kernel panics
###########
# Helper functions
function do_jq {
_J="$(which jq 2>/dev/null)" || {
echo "You must install jq (brew install jq) to use the script" >&2; return 1;
}; "${_J}" "$@"
@toonetown
toonetown / oc
Last active January 21, 2020 16:58
Openconnect helper script
#!/bin/bash
[ -f "${OC_CONFIG:="${HOME}/.oc-config"}" ] || { echo "Not configured - set up ${OC_CONFIG}" >&2; exit 1; }
if [ "$(id -u)" != "0" ]; then OC_CONFIG="${OC_CONFIG}" sudo "${0}" "$@"; exit $?; fi
OC_PID="/var/run/openconnect.pid"
OC_LOG="/var/log/openconnect.log"
case "${1}" in
connect)
@toonetown
toonetown / QuickSetup.sh
Last active January 17, 2020 02:46
A list of steps to perform to quickly set up a machine like I like it.
# Default Settings (run from recovery partition before user creation)
cd "/Volumes/Macintosh HD"
curl -sSL -o data https://gist.githubusercontent.com/toonetown/c5664875177e8253a99814c6184db41b/raw
chroot .
/bin/bash data
exit
rm data
# First-run setup, create user, set auto-login, download folder options, Parallels Tools (if on VM)