Skip to content

Instantly share code, notes, and snippets.

@toonetown
toonetown / karabiner-elements-remote-desktop.json
Last active March 14, 2024 16:42
Karabiner Elements JSON configuration for Microsoft Remote Desktop
{
"title": "Microsoft Remote Desktop",
"rules": [
{
"description": "Windows Mappings",
"manipulators": [
{
"type": "basic",
"from": { "key_code": "x", "modifiers": { "mandatory": [ "command" ] } },
"to": [ { "key_code": "x", "modifiers": [ "left_control" ] } ],
@toonetown
toonetown / swup
Last active January 1, 2024 16:21
A script which updates brews, cast, software updates, etc
#!/bin/bash
# Script that will update all kinds of stuff (brews, casks, software updates, app store apps, etc)
set -o pipefail
# You can set any of these variables to "no" in your environment if you want to skip that particular portion
: ${SWUP_OS:="yes"}
: ${SWUP_BREW:="yes"}
: ${SWUP_MAS:="yes"}
: ${SWUP_BUNDLE:="yes"}
: ${SWUP_REMOVE_QUARANTINE:="yes"}
@toonetown
toonetown / base64
Last active November 7, 2023 17:25
Adds an option to encode/decode url-safe base64
###
# Shell script which adds the ability to encode/decode web-safe URLs in base64. Do this by specifying
#
#!/bin/bash
ARGS=()
BAD_CHARS="+/="
SAFE_CHARS="-_ "
URL="n"; CONVERT="n"; DECODE="n"; IN="-"; OUT="-"; HELP="n"
while (($#)); do
case "${1}" in
@toonetown
toonetown / shimo-pulse-vpn
Last active February 14, 2023 14:20
Leverages ssh and openconnect to connect Shimo to PulseSecure hosts
#!/bin/bash
: ${NUM_FAILURES_ALLOWED:=10}
: ${SLEEP_PING_TIME:=10}
if [ "${1}" == "-c" -a -n "${2}" ]; then SHIMO_SCRIPT_CFG="${2}"; shift 2; fi
if [ -n "${SHIMO_SCRIPT_CFG}" ]; then
: ${SHIMO_HOME:="${HOME}/Library/Application Support/Shimo"}
: ${SHIMO_SCRIPT_HOME:="${SHIMO_HOME}/Scripts"}
: ${SHIMO_CONFIG_DIR:="${SHIMO_SCRIPT_HOME}/${SHIMO_SCRIPT_CFG}"}
# 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 / webserver
Last active September 7, 2022 21:11
A quick-and-dirty python web server
#!/usr/bin/python3
import http.server, ssl, argparse, re
from tempfile import mkdtemp
from shutil import rmtree
from contextlib import contextmanager
from os.path import exists, join, abspath
@contextmanager
def TemporaryDirectory():
name = mkdtemp()
@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}" "$@"
@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 / homebrew-bootstrap.sh
Last active August 26, 2021 16:58
Bootstraps a Homebrew development environment, with optional packages (taps, brews, casks, and services)
###########
# Installs and/or updates homebrew and various components
#
#!/bin/bash
: ${HOMEBREW_INST_URL:="https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh"}
: ${HB_BOOTSTRAP_GIST_URL:="https://gist.githubusercontent.com/toonetown/48101686e509fda81335/raw"}
if [ $# -eq 0 ]; then
echo "Usage: ${0} [--fetch-only] <PACKAGES...>"
echo ""
@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}" "$@"