ab
Send 10,000 requests, using 10 sockets at a time: ab -n 10000 -c 10 https://10.10.10.10/ Send requests with a BIG-IP persistence cookie: ab -n 10000 -C BIGipServerMyPool=1677787402.36895.0000 http://10.10.10.10/
Send 10,000 requests, using 10 sockets at a time: ab -n 10000 -c 10 https://10.10.10.10/ Send requests with a BIG-IP persistence cookie: ab -n 10000 -C BIGipServerMyPool=1677787402.36895.0000 http://10.10.10.10/
Specify vault file password file via env var: export ANSIBLE_VAULT_PASSWORD_FILE=/path/to/file
Miscellaneous: Run script with verbose output: bash -v Check for syntax errors: bash -n Show xtrace info: bash -x Lines which start with + are executed in the shell Lines which start with ++ are executed in a sub-shell Loop over alphabet with upper and lower case: for l in {{A..Z},{a..z}}; do echo $l ; done Print text in beautiful columns by piping to: column -t Echo a string to stderr: >&2 echo Hello, world. Keyboard shortcuts: ...
Display response code and total time: curl -s -w "%{http_code} - %{time_total}\n" -o /dev/null www.jamessimas.com curl multiple IPs with one command: curl 10.20.20.8[0-9]:80/ Overriding DNS: curl --resolve "www.jamessimas.com:80/10.11.12.13" www.jamessimas.com
Delimited: The delimiter in the below examples is :. Show field 1: cut -f 1 -d : /etc/password Show field 2 and sort results numerically: cut -f 2 -d : /etc/password | sort -n Show all fields after field 1: cut -d: -f 2: Show fields 1 through 2: cut -d : -f1-2 Miscellaneous: Cut 10 from start of line: cut -c -10
Display short response: dig +short www.google.com Display only answer section: dig +noall +answer www.google.com Specify source address for query: dig -b <source address[:#port]> Specify DNS server to query: dig @DNS_SERVER www.google.com Use ends0: dig @DNS_SERVER +subnet=10.11.12.13 1.1.1.1
Various customizations I prefer. about:config What it is Config name Value Scroll distance toolkit.scrollbox.verticalScrollDistance 7 Print using system dialog print.prefer_system_dialog false Prevent fullscreen exit with ESC browser.fullscreen.exit_on_escape false Show “https://” URL prefix browser.urlbar.trimURLs false about:keyboard New Private Window -> CMD+SHIFT+N
Branching and Checkout: Clean up local banches: git remote prune --dry-run origin git remote prune origin Update local branch without it being checked out: git fetch origin src_branch:local_branch Show which remote branch local branches are tracking: git branch -vv Display branches by last commit date: git for-each-ref --sort=-committerdate refs/heads/ Copy files/directories from another branch to current branch: git checkout source_branch -- path/to/dir/ path/to/file.txt Reset to a particular commit without losing changes: Reset to one commit past most recent: git reset HEAD^ Reset to particular commit: git reset COMMIT_ID Diffing branches: ...
go doc Run web server: godoc -http=localhost:8888 -index -links View web server: http://localhost:8888 Tip: Add ?m=all to URL to show unexported types, funcs, etc. go test Run all tests: Run all tests: go test ./... Run all tests in package: go test modulename/pkg/packagename/ Run all tests in file: go test path/to/file_test.go Run subset of tests: Run function tests: go test path/to/file_test.go -run FUNCTION_TEST_NAME Run a single test in function tests: go test path/to/file_test.go -run FUNCTION_TEST_NAME/test_name_here Tips: ...
Allow an app to run sudo xattr -rd com.apple.quarantine /path/to/the.app Disable emoji predictions in macOS Sonoma and higher sudo defaults write /Library/Preferences/FeatureFlags/Domain/UIKit.plist emoji_enhancements -dict-add Enabled -bool NO Source: https://www.reddit.com/r/MacOS/comments/16wzdk9/is_there_a_way_to_turn_off_the_new_emoji/ Dock Configure auto-hide delay: # set to 200ms (default) defaults write com.apple.dock "autohide-delay" -float "0.2" && killall Dock # set to 30ms defaults write com.apple.dock "autohide-delay" -float "0.03" && killall Dock # set to immediate defaults write com.apple.dock "autohide-delay" -float "0" && killall Dock Finding what processes are using a TCP port sudo lsof -nP -iTCP -sTCP:LISTEN Time Machine Configure backup speed: ...
Print cert in pem format: openssl x509 -in FILE Print cert in text format: openssl x509 -text -in FILE
Copy directory recursively with status bars: rsync -avh --progress -e ssh /source/dir/ user@remotehost:/dest/dir/
Numericaly sort file. Fields are separated by :. Use key in position 2: sort -n -k2 -t : /etc/password Sort by size of directories/files: du -h | sort -n
Add identities: Default: ssh-add Specific: ssh-add path/to/identity With 1h lifetime: ssh-add -l 3600 path/to/identity List identities: ssh-add -l Locking: Lock w/ password: ssh-add -x Unlock: ssh-add -X Delete identity: ssh-add -d path/to/identity Delete all identities: ssh-add -D
Keys Action Super + Enter Open terminal Super + H/J/K/L Change window focus Super + Shift + H/J/K/L Move window DIRECTION Super + Shift + Q Close window Super + Shift + E Exit Sway Super + Sift + C Reload config Super + 1–9 Switch workspace Super + SHIFT+ 1–9 Move window to workspace Super + - Toggle floating window Super + E Style: split Super + W Style: stacking
List archives: tarsnap --list-archives | sort List size of all archives: tarsnap --print-stats Create archive: tarsnap -v -c -f ARCHIVE_NAME /path/to/file /path/to/dir Restore archive: tarsnap -v -x -f ARCHIVE_NAME Delete archive: tarsnap -d -f ARCHIVE_NAME Useful doc: https://www.tarsnap.com/simple-usage.html
Favorite commands Create session: tmux new [-s <session name>] Detach session: Ctrl + b, d Attach session: tmux a -t <session name> Rename session (while in it): Ctrl + b, $ List sessions: tmux ls OR Ctrl + b, s Kill session: tmux kill-session -t <session name> Go to previous session: Ctrl + b, ( Go to next session: Ctrl + b, ) Scrolling Scroll session: Ctrl + B + [ Page Up | Page Down ] Enable scroll mode: Ctrl + b, [ Exit scroll mode: q Panes Move pane left/right: Ctrl + B + [ { | } ] Toggle between pane layouts: Ctrl + b + spacebar Split window into panes vertically: Ctrl + b + " Split window into panes horizontally: Ctrl + b + % Kill pane: Ctrl + b + x Switch to pane to the direction: Ctrl + b + <arrow key> Helpful websites https://danielmiessler.com/study/tmux/ https://tmuxcheatsheet.com/ Sharing a TMUX session across user accounts Create new session: tmux -S /tmp/shareds new -s shared Have them connect: sudo tmux -S /tmp/shareds attach -t shared Source: https://www.howtoforge.com/sharing-terminal-sessions-with-tmux-and-screen ...