1
score
|
Clear the Exim Queue (remove all messages)$ exim -bp | exiqgrep -i | xargs exim -Mrm |
0
score
|
Check if a text snippet is valid C code$ gcc -fsyntax-only -xc - <<< "text snippet" |
1
score
|
Inspect the HTTP headers of a website$ curl -I amazon.com |
1
score
|
Search man pages and present a PDF$ man -k . | awk '{ print $1 " " $2 }' | dmenu -i -p man | awk '{ print $2 " " $1 }' | tr -d '()' | xargs man -t | ps2pdf - - | zathura - |
3
score
|
Find all log files modified 24 hours ago, and zip them$ find . -type f -mtime +1 -name "*.log" -exec zip -m {}.zip {} \; >/dev/null |
4
score
|
List IP addresses connected to your server on port 80$ netstat -tn 2>/dev/null | grep :80 | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr | head |
1
score
|
Random 6-digit number$ python -c 'import random; print(random.randint(0,1000000-1))' |
1
score
|
Very fast history search with Ripgrep$ rh() { rg "$1" ~/.bash_history } |
0
score
|
While loop to pretty print system load (1, 5 & 15 minutes)$ while :; do date; awk '{printf "1 minute load: %.2f\n", $1; printf "5 minute load: %.2f\n", $2; printf "15 minute load: %.2f\n", $3}' /proc/loadavg; sleep 3; done |
1
score
|
Scan entire Git repo for dangerous Amazon Web Service IDs$ git grep -Ew '[A-Z0-9]{20}' |
0
score
|
Scan entire Git repos for dangerous Amazon Web Service IDs$ git ls-tree --full-tree -r --name-only HEAD | xargs egrep -w '[A-Z0-9]{20}' |
0
score
|
While loop to pretty print system load (1, 5 & 15 minutes)$ while [ 1 == 1 ]; do cat /proc/loadavg | awk '{printf "1 minute load: %.2f\n", $(NF-5)}' && cat /proc/loadavg |awk '{printf "5 minute load: %.2f\n", $(NF-3)}' && cat /proc/loadavg |awk '{printf "15 minute load: %.2f\n", $(NF-2)}'; sleep 3; date; done |
0
score
|
Dump all AWS IAM users/roles to a Terraform file for editing / reusing in another environment$ echo iamg iamgm iamgp iamip iamp iampa iamr iamrp iamu iamup | AWS_PROFILE=myprofile xargs -n1 terraforming |
0
score
|
Organise image by portrait and landscape$ mkdir "portraits"; mkdir "landscapes"; for f in ./*.jpg; do WIDTH=$(identify -format "%w" "$f")> /dev/null; HEIGHT=$(identify -format "%h" "$f")> /dev/null; if [[ "$HEIGHT" > "$WIDTH" ]]; then mv "$f" portraits/ ; else mv "$f" landscapes/ ; fi; done |
0
score
|
Create a txt files with 10000 rows$ for FILE in *.full ; do split -l 100000 $FILE; mv -f xaa `echo "$FILE" | cut -d'.' -f1`.txt; rm -f x*; done |
1
score
|
List open processes ordered by it's number of open files$ ps -ef |awk '{ print $2 }' \ |tail -n +2 \ |while read pid; do echo "$pid $(lsof -p $pid |wc -l)"; done \ |sort -r -n -k 2 \ |while read pid count; do echo "$pid $count $(ps -o command= -p $pid)"; done |
0
score
|
Remove all container from an specific network (docker)$ docker ps -a -f network=$NETWORK --format='{{.ID}}' | xargs docker rm -f |
0
score
|
Up all docker services as detached mode over all immediate subdirectories$ for dir in $(ls -d */); do eval $(cd $PWD/$dir && docker-compose up -d && cd ..); done; |
0
score
|
Find and replace string inside specific files$ grep -ril '$SEARCH_PATTERN' src | sed -i 's/$FIND_PATTERN/$REPLACE_PATTERN/g' |
0
score
|
Puppet/Bash: test compare json objects.$ unless => "client_remote=\"$(curl localhost:9200/_cluster/settings | python -c \"import json,sys;obj=json.load(sys.stdin);print(obj['persistent']['search']['remote'])\")\"; new_remote=\"$( echo $persistent_json | python -c \"import json,sys;obj=json.load(sys.stdin);print(obj['persistent']['search']['remote'])\")\"; [ \"$client_remote\" = \"$new_remote\" ]", |
0
score
|
Print wifi access points sorted by signal$ iw dev IFACE scan | egrep "SSID|signal" | awk -F ":" '{print $2}' | sed 'N;s/\n/:/' | sort |
2
score
|
Kill a process running on port 8080$ lsof -i :8080 | awk '{l=$2} END {print l}' | xargs kill |
0
score
|
Delete all untagged Docker images$ docker images -q -f dangling=true | xargs --no-run-if-empty --delim='\n' docker rmi |
1
score
|
Take values from a list (file) and search them on another file$ for ITEM in `cat values_to_search.txt`; do (egrep $ITEM full_values_list.txt && echo $ITEM found) | grep "found" >> exit_FOUND.txt; done |
-1
score
|
Delete all untagged Docker images$ docker rmi $(docker images -f "dangling=true" -q) |