Skip to content

Instantly share code, notes, and snippets.

@toonetown
toonetown / defaultSettings.sh
Last active April 3, 2020 21:19
Adds some default settings to the User Template directory
###########
# Sets up default settings for all users in the User Template directory
#
#!/bin/bash
# Change to our home preference directory, unless we are running as root
if [ "$(id -u)" != "0" ]; then
cd "${HOME}/Library/Preferences" || exit $?
else
# Set our root bash shell (don't care about results)
@toonetown
toonetown / disableAnimations.sh
Created July 11, 2016 22:52
Disables animations (helpful for accessing machines over a network)
###########
# Stops animations for the current user (or all new users if run as root). Note, if you want to use this in
# conjunction with the defaultSettings.sh gist, run that one first.
#
#!/bin/bash
# Change to our home preference directory, unless we are running as root
if [ "$(id -u)" != "0" ]; then
cd "${HOME}/Library/Preferences" || exit $?
else
@toonetown
toonetown / alias-local
Last active August 29, 2017 14:04
Aliases localhost to an address
#!/bin/bash
if [ "$(id -u)" != "0" ]; then sudo "${0}" "$@"; exit $?; fi
if [ "${1}" == "-d" ]; then
[ -n "${2}" ] || { echo "Usage $0 [-d] <addr> [iface]"; exit 1; }
ifconfig ${3:-lo0} -alias ${2}
else
[ -n "${1}" ] || { echo "Usage $0 [-d] <addr> [iface]"; exit 1; }
ifconfig ${2:-lo0} alias ${1} 255.255.255.255
@toonetown
toonetown / shimo-auto-alias
Last active August 29, 2017 14:03
Leverages alias-local to automatically add/remove SSH hosts.
#!/bin/bash
source /etc/profile
# The location of the ssh config file and alias-local
: ${SSHCONF:="/var/run/Shimo/configs/${CS_UNIQUE_IDENTIFIER}.sshconf"}
: ${ALIAS_IFACE:="lo0"}
: ${ALIAS_LOCAL:="$(which alias-local 2>/dev/null)"}
# Read the mappings in the config file - only if we have an alias-local command installed in our path
[ -f "${SSHCONF}" -a -x "${ALIAS_LOCAL}" ] && {
@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}"}
@toonetown
toonetown / keychain-stoken
Last active January 20, 2017 22:21
Helper script for managing stoken with macOS keychain storage
#!/bin/bash
case "${1}" in
add)
set -e
shift; SERVICE="${1}"
[ -n "${SERVICE}" ] || { echo "Usage $0 add <service>" >&2; exit 1; }
echo "Adding keychain stoken service '${SERVICE}' token password data"
/usr/bin/security add-generic-password -s "${SERVICE}" -a "${SERVICE}.token" -w || exit $?
echo "Adding keychain stoken service ${SERVICE} token PIN data..."

Keybase proof

I hereby claim:

  • I am toonetown on github.
  • I am toonetown (https://keybase.io/toonetown) on keybase.
  • I have a public key ASCl7NIsx3WSlx1TVGSXxwSzS8_xBkoqbHtlay-DSlEhRQo

To claim this, I am signing this object:

@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" ] } ],
###########
# Adds "upgrade" to `brew cask`. Accepts "--greedy" as an option. Just delegates to "reinstall"
#
#!/bin/bash
set -o pipefail
source /etc/profile
GREEDY=""
if [ "${1}" == "--greedy" ]; then GREEDY="${1}"; shift; fi
###########
# Checks if the given cask needs to be upgraded.
#
#!/bin/bash
set -o pipefail
source /etc/profile
if [ $# -eq 0 ]; then
ARGS=($(brew cask list))
else