description
[[snippets]]
description = "Openssl client connect"
command = "echo | openssl s_client -connect <domain>:443"
tag = ["openssl"]
output = ""
[[snippets]]
description = "Openssl quick benchmark for new and tls reuse handshakes"
command = "openssl s_time -connect <domain>:443 -time 1"
tag = ["openssl"]
output = ""
[[snippets]]
description = "Github update executable flag for already commited file."
command = "git update-index --chmod=+x <filename>"
tag = ["git"]
output = ""
[[snippets]]
description = "Grep IP addresses"
command = "grep -o '[0-9]\\{1,3\\}\\.[0-9]\\{1,3\\}\\.[0-9]\\{1,3\\}\\.[0-9]\\{1,3\\}' <filename>"
tag = ["grep", "regex"]
output = ""
[[snippets]]
description = "Install docker on linux"
command = "curl -fsSL get.docker.com | sh -x"
tag = ["docker", "install"]
output = ""
[[snippets]]
description = "rvm install"
command = "gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB && \\curl -sSL https://get.rvm.io | bash -s stable"
tag = ["ruby", "install"]
output = ""
[[snippets]]
description = "Date formatting in shell"
command = "DATE=`date '+%Y-%m-%d %H:%M:%S'`"
tag = ["date"]
output = ""
[[snippets]]
description = "Time formatting with Ruby"
command = "ruby -e 'puts Time.now.strftime(\"%Y%M%d%H%M%S\")'"
tag = ["date", "ruby"]
output = ""
[[snippets]]
description = "Average with awk"
command = "seq 5 | awk '{ sum+=$1} END { printf \"%0.3f\\n\",sum/$NF }'"
tag = ["awk", "shell", "average"]
output = ""
[[snippets]]
description = "Run command 5 times"
command = "seq 5 | xargs -I@ -n1 echo \"-- @ --\""
tag = ["shell"]
output = ""
[[snippets]]
description = "Extract RPM"
command = "rpm2cpio <rpm_file> | cpio -idmv"
tag = ["rpm"]
output = ""
[[snippets]]
description = "Check keepalive for site"
command = "curl -Iv <site> 2>&1 | grep -i 'connection #0'"
tag = ["curl", "shell", "keepalive"]
output = ""
[[snippets]]
description = "cat filename with hidden characters"
command = "cat -vet <filename>"
tag = ["cat", "shell"]
output = ""
[[snippets]]
description = "Docker steal container clean up"
command = "docker ps -a | awk '{print $1}' | grep -v CON | xargs -I@ docker rm @ && docker images | grep none | awk '{print $3}' | xargs -I@ docker rmi @"
tag = ["docker", "shell"]
output = ""
[[snippets]]
description = "sar ethernet interface traffic"
command = "sar -n DEV"
tag = ["sar", "network"]
output = ""
[[snippets]]
description = "strace to provide system call stats"
command = "sudo strace -T -c -f -p <pid>"
tag = ["strace", "shell", "systemcall"]
output = ""
[[snippets]]
description = "date epoc back and forth conversion"
command = "date '+%s' && date -d @<epoc>"
tag = ["date", "shell"]
output = ""
[[snippets]]
description = "always stumble with these cops urls"
command = "https://<cops_service>.stg.vidops.internal.justin.tv/health"
tag = ["cops"]
output = ""
[[snippets]]
description = "docker build no chache"
command = "docker build --no-cache -t <name> ."
output = ""
[[snippets]]
description = "aws cloudwatch log fetch"
command = "aws logs get-log-events --log-group-name <group_name> --log-stream-name <stream_name>"
output = ""
[[snippets]]
description = "aws cloudwatch get log streams and other information"
command = "aws logs describe-log-streams --log-group-name <group_name>"
output = ""
[[snippets]]
description = "aws cloudwatch delete logs"
command = "aws logs delete-log-stream --log-group-name <group_name> --log-stream-name <stream_name>"
output = ""
[[snippets]]
description = "Find out file belongs to which debian package"
command = "dpkg -S <filename>"
tag = ["dpkg"]
output = ""
[[snippets]]
description = "find out column number for further awk parsing"
command = "head -1 <file> | tr \" \" \"\\n\" | nl"
tag = ["awk", "bash", "nl"]
output = ""
[[snippets]]
description = "Provides socke opt flags"
command = "sudo ss -l -p --extended --memory --info"
tag = ["ss", "network"]
output = ""
[[snippets]]
description = "git rebase interactive to rewrite history"
command = "git rebase -i HEAD~<commit_number>"
tag = ["git"]
output = ""
[[snippets]]
description = "git checkout and track remote branch locall"
command = "git checkout --track origin/<name_of_remote_branch>"
tag = ["git"]
output = ""
[[snippets]]
description = "swap entrypoint"
command = "docker run -t -i --entrypoint \"bash\" <container_image>"
tag = ["docker"]
output = ""
[[snippets]]
description = "setup process in real time prioiry"
command = "sudo chrt -r -p <prio_range_1_to_99> <PID>"
tag = ["chrt", "scheduling"]
output = ""
[[snippets]]
description = "sed inline replacement"
command = "sed -i '' 's/<str>/<replace_str>/g' <filename>"
tag = ["sed", "shell"]
output = ""
[[snippets]]
description = "capture TLS handshake packets only"
command = "tcpdump -ni eth0 \"tcp port 443 and (tcp[((tcp[12] & 0xf0) >> 2)] = 0x16)\""
tag = ["tcpdump"]
output = ""
[[snippets]]
description = "setup all CPU cores in performance mode"
command = "echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor"
tag = ["shell", "performance"]
output = ""
[[snippets]]
description = "get power draw for server"
command = "sudo ipmi-dcmi --get-system-power-statistics"
tag = ["ipmi"]
output = ""
[[snippets]]
description = "varnish param modification during runtime"
command = "sudo varnishadm -n /dev/shm/varnish/ param.set timeout_idle 60"
tag = ["varnish"]
output = ""
[[snippets]]
description = "setup golang env"
command = "export GOROOT=<go_path> && mkdir $HOME/goworkspace && export GOPATH=$HOME/goworkspace && export PATH=$PATH:$GOROOT/bin:$GOPATH/bin"
tag = ["golang"]
output = ""
[[snippets]]
description = "pass command line options for script which piped to bash shell"
command = "script.sh | sudo bash -s -- --cmd_option for_script.sh"
tag = ["bash", "shell"]
output = ""
[[snippets]]
description = "Install gem from private repo"
command = "gem install <GEM> --no-rdoc --no-ri --source https://gem.internal.justin.tv/"
tag = ["gem", "ruby"]
output = ""
[[snippets]]
description = "no wrap of text"
command = "less -S"
tag = ["less", "shell"]
output = ""
[[snippets]]
description = "ruby named capture , m[:area] # => \"555\""
command = "m = \"555-333-7777\".match(/(?<area>\\d{3})-(?<city>\\d{3})-(?<number>\\d{4})/)"
tag = ["ruby"]
output = ""
[[snippets]]
description = "watch pkt flow on interface"
command = "watch -n 1 -d \"ethtool -S <iface> | egrep rx.*pack\""
tag = ["ethtool"]
output = ""