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
func SomeFunction(list *[]string) { | |
defer TimeTrack(time.Now()) | |
// Do whatever you want. | |
} | |
func TimeTrack(start time.Time) { | |
elapsed := time.Since(start) | |
// Skip this function, and fetch the PC and file for its parent. | |
pc, _, _, _ := runtime.Caller(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
dscacheutil -flushcache |
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
# syntax | |
docker rmi $(docker images -a | rg <pattern> | awk '{print $3}' | |
# example | |
docker rmi $(docker images -a | rg supabase | awk '{print $3}' |
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
# grab list of image ids | |
docker images -a | tail -n+2 | awk '{print $3}' | |
# Explanation | |
# | |
# -n+2 removes the table header from the output | |
# awk '{print $3}' grabs the image column values | |
# Output |
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
# syntax | |
curl -s https://api.github.com/repos/<org>/<repo> | jq .created_at | |
# example | |
curl -s https://api.github.com/repos/PRQL/prql | jq .created_at |
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
# get list all domains support by `defaults` and present as a list | |
defaults domains | sed 's/, /\n/g' |
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
# may or may not work | |
dig -4 TXT +short o-o.myaddr.l.google.com @ns1.google.com | |
curl icanhazip.com | |
curl ifconfig.me |
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
# syntax to read | |
# defaults read <bundle-identifier> ApplePressAndHoldEnabled | |
# syntax to write | |
# defaults write <bundle-identifier> ApplePressAndHoldEnabled -bool false | |
# example command | |
defaults write com.electron.replit ApplePressAndHoldEnabled -bool false |
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
# find the bundle identifier of Numbers app | |
codesign -dv /Applications/Numbers.app/ | |
# explanation of the flags used | |
# | |
# -d, --display Display information about the code at the path(s) given. | |
# -v, --verify Requests verification of code signatures | |
# one line to directly extract the bundle identifier using [rg](https://github.com/BurntSushi/ripgrep) | |
codesign -dv /Applications/Numbers.app/ 2>&1 | rg '^Identifier=' --replace "" |