Skip to content

Instantly share code, notes, and snippets.

View mkrakauer-rio's full-sized avatar

Mai Krakauer mkrakauer-rio

View GitHub Profile
@mkrakauer-rio
mkrakauer-rio / .bash_profile
Created April 17, 2018 20:50
Mac SSH Autocomplete
_complete_ssh_hosts() {
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
comp_ssh_hosts=`cat ~/.ssh/config | \
grep "^Host " | \
awk '{print $2}'
`
COMPREPLY=( $(compgen -W "${comp_ssh_hosts}" -- $cur))
return 0
}
@mkrakauer-rio
mkrakauer-rio / disable-full-sync-on-flush.sh
Last active June 12, 2022 14:52
Docker for Mac - Disable full disk sync on flush
cd ~/Library/Containers/com.docker.docker/Data/database/
git reset --hard
cat com.docker.driver.amd64-linux/disk/full-sync-on-flush
# if you see true, continue
echo false > com.docker.driver.amd64-linux/disk/full-sync-on-flush
cat com.docker.driver.amd64-linux/disk/full-sync-on-flush
# you should now see false
git add com.docker.driver.amd64-linux/disk/full-sync-on-flush
git commit -s -m "Disable flushing"
# wait for docker to restart
@mkrakauer-rio
mkrakauer-rio / post-merge
Created March 13, 2016 22:14
git hook to run a command after `git pull` if a specified file was changed. Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#!/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep -E --quiet "$1" && eval "$2"
}
# `npm install` and `npm prune` if the `package.json` file gets changed
@mkrakauer-rio
mkrakauer-rio / table_size.sql
Created December 4, 2015 01:20
Calculate MySQL Table sizes
SELECT table_schema as `Database`, table_name AS `Table`,
round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
FROM information_schema.TABLES
ORDER BY (data_length + index_length) DESC;
@mkrakauer-rio
mkrakauer-rio / checkcron.sh
Created October 12, 2015 22:06
Check crontab for all users. Must be run as root
for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l; done