Skip to content

Instantly share code, notes, and snippets.

@pkutzner
pkutzner / keybase.md
Created August 26, 2015 22:03
keybase proof

Keybase proof

I hereby claim:

  • I am pkutzner on github.
  • I am pkutzner (https://keybase.io/pkutzner) on keybase.
  • I have a public key whose fingerprint is C365 D10E BEEF 62F2 FC00 18BE A121 14C8 A44C A805

To claim this, I am signing this object:

@pkutzner
pkutzner / multicloudsync.plist
Created August 26, 2015 22:23
Sync to multiple clouds
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple/DTD PLIST 1.0/EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>mulitcloudsync</string>
<key>ProgramArguments</key>
<array>
<string>/opt/local/bin/rsync</string>
<string>-aq</string>
@pkutzner
pkutzner / com.user.clearsafari.plist
Created February 13, 2014 19:15
LaunchAgent to run privacy.sh when Safari quits.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple/DTD PLIST 1.0/EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.user.clearsafari</string>
<key>ProgramArguments</key>
<array>
<string>/bin/bash</string>
<string>/Users/USER/scripts/privacy.sh</string>
@pkutzner
pkutzner / local.cleardir.plist
Last active August 29, 2015 13:56
LaunchAgent that runs periodically to clean out files from specified directory that are older than 7 days. Replace PATH_TO_CLEAR with the directory you want files deleted from. Change LOG_PATH and ERROR_LOG_PATH to appropriate files for logging. Remove if undesired.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple/DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>local.cleardir</string>
<key>RunAtLoad</key>
<true/>
<key>EnableGlobbing</key>
<true/>
@pkutzner
pkutzner / com.index.no_index.plist
Created February 13, 2014 21:17
Disable indexing of ALL attached external drives. Replace PATH_TO_NOINDEX_SCRIPT with its name's-sake in the .plist file.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple/DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.index.no_index</string>
<key>Disabled</key>
<false/>
<key>Program</key>
<string>PATH_TO_NOINDEX_SCRIPT</string>
d-i partman/early_command string \
DISKA=$(list-devices disk | head -n1); \
DISKB=$(list-devices disk | tail -n2 | head -n1); \
if [ "$DISKA" = "$DISKB" ]; then \
debconf-set partman-auto/disk string "$DISKA"; \
debconf-set partman-auto-raid/recipe string "1 2 0 ext2 /boot ${DISKA}1 . 1 2 0 lvm - ${DISKA}5 ."; \
debconf-set grub-installer/bootdev string "$DISKA"; \
else
debconf-set partman-auto/disk string "$DISKA $DISKB"; \
debconf-set partman-auto-raid/recipe string "1 2 0 ext2 /boot ${DISKA}1#${DISKB}1 . 1 2 0 lvm - ${DISKA}5#${DISKB}5 ."; \
@pkutzner
pkutzner / gist:dcf1f76ec806203e9caa
Created August 15, 2014 16:41
Poor man's tree for *nix systems that don't have tree.
find . -print | sed -e 's;[^/]*/;|____;g;s;____|;|;g'
usbterm() {
if [[ $# -eq 0 ]]; then
echo "Usage: $0 [baud rate]"
return 1
fi
# [ -e /dev/tty.usbserial ] && screen /dev/tty.usbserial $1
if [ ! -e /dev/tty.usbserial ]; then
echo "USB -> Serial adapter not connected! Exiting..."
return 1
else
function getpassword() {
local charcount=0
local password=''
local CHAR=''
local PROMPT=''
stty -echo
while IFS= read -p "$PROMPT" -r -s -n 1 CHAR
do
# Enter - accept password
if [[ $CHAR == $'\0' ]]; then
@pkutzner
pkutzner / gen_pkp_csrs.sh
Last active December 11, 2015 23:53
Script to generate 2 CSR/Key pairs (and pins) for use with HPKP. Asks for pertinent information interactively.
#!/bin/bash -
#===============================================================================
#
# FILE: gen_pkp_csrs.sh
#
# USAGE: ./gen_pkp_csrs.sh
#
# DESCRIPTION: Generates SSL CSR/Key pairs.
# This script generates both the primary CSR/Key pair for a given
# URL and SAN(s) (if specified), as well as a backup pair for use