Skip to content

Instantly share code, notes, and snippets.

# Spotlight indexing sometimes runs away with CPU. Processes are md*, e.g. mdworker, mds_stores
# turn off indexing
sudo mdutil -a -i off
# and back on
sudo mdutil -a -i on
@jdfitzgerald
jdfitzgerald / fix broken mission control.sh
Last active February 15, 2018 10:24
Fix broken mission control stuff (3 finger swipe, expose) in MacOS
killall Dock
@jdfitzgerald
jdfitzgerald / Fix macos screen flashing instead of beeps.sh
Created March 15, 2017 12:14
Fix macos screen flashing instead of beeps
sudo killall coreaudiod
% is the current file relative to cwd
%:p is the full path of said file
%:h is the directory relative to cwd
%:p:h is the full path of the directory
$ foo=1:2:3:4:5
$ echo ${foo##*:}
5
@jdfitzgerald
jdfitzgerald / vi edit mode in readline stuff.sh
Last active May 18, 2016 10:16
Enable vi editing in commands that use readline for interactive stuff
# ~/.inputrc
set editing-mode vi
/*
Grab a list of 10 random males from bamboohr (for random stuff from the random committee)
To use go here: https://websummit.bamboohr.co.uk/employees/directory.php
Then run the script below in the console, modifying the filter and the for loop to control
the initial selection and the total number
*/
// shuffle yoinked from stack overflow
function shuffle(array) {
var currentIndex = array.length, temporaryValue, randomIndex ;
@jdfitzgerald
jdfitzgerald / bash random number.sh
Last active May 18, 2016 10:16
Pick a random number
# pick a random number between 0-127
# NB not cryptographically sound
$ echo $(( $RANDOM % 128 ))
#relies on AWS CLI & jq for JSON processing
for name in `aws iam list-users | jq -r .Users[].UserName`; do aws iam list-access-keys --user-name $name | jq ' .AccessKeyMetadata[] | .UserName + " " + .AccessKeyId'; done;
# send two test emails to jd@cilabs.com
for i in {1..2}; do echo $i | mail -s "ping $i" jd@cilabs.com; done