This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# https://stackoverflow.com/questions/2740806/python-sqlite-database-is-locked | |
function sqlite3() { | |
executable="$(which sqlite3)" || exit | |
out="$("$executable" "$@" 2>&1)" && echo "$out" && return || { | |
[[ "$out" == *"locked"* ]] && exit; echo "$out" 1>&2 && exit 1 | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -- "word1 word2 word3" | |
printf "/%s" $(perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "$1") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# pip install gist-delete gist-description gist-exec gist-generator gist-id gists-id | |
# export GITHUB_TOKEN=<GITHUB_TOKEN> | |
# cd ~/git/gists | |
# gist-exec https://gist.github.com/looking-for-a-job/c9d7fb87ec5ebfa0740b2e2dbe4d25bb | |
# create | |
gist-exec https://gist.github.com/looking-for-a-job/25cd417fdde68a84eb0a7efa716f6415 | |
# delete orphaned |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
{ set +x; } 2>/dev/null | |
ip="$(curl -s ipecho.net/plain)" || exit | |
tmp="$(mktemp)" || exit | |
curl -fs https://freegeoip.app/xml/$ip > "$tmp" | |
cat "$tmp" | |
grep "CountryCode" "$tmp" | sed -n 's:.*<CountryCode>\(.*\)</CountryCode>.*:\1:p' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
{ set +x; } 2>/dev/null | |
ipconfig getifaddr en1 | |
curl -s ipecho.net/plain; echo # public ip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defaults write .GlobalPreferences com.apple.sound.beep.sound /System/Library/Sounds/Basso.aiff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
top -l 1 -n 5 | awk '!$0{i++;next;}i==1' | |
# top -l 1 -n 5 | awk '/^PID/{if (p) next; p=1} p && NF>30 {printf("%-8s %-12s %-6s %-6s\n", $1, $2, $3, $8)}' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
sudo fs_usage -f filesys | grep -v grep #| grep desktop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
ssh -T git@github.com | |
ssh -T git@gist.github.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
img=~/img.png | |
xattr -d com.apple.FinderInfo "$img" # remove the custom icon | |
! [ -e "$img" ] && echo "$img NOT EXISTS" 2> /dev/null && exit 1 | |
icns=~/icns.icns | |
DeRez -only icns "$img" > $icns | |
du -k "$icns" |