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) |
1
score
|
Have script run itself in a virtual terminal$ tty >/dev/null || { urxvt -e /bin/sh -c "tty >/tmp/proc$$; while test x; do sleep 1; done" & while test ! -f /tmp/proc$$; do sleep .1; done; FN=$(cat /tmp/proc$$); rm /tmp/proc$$; exec >$FN 2>$FN <$FN; } |
2
score
|
Big CSV > batches > JSON array > CURL POST data with sleep$ cat post-list.csv | split -l 30 - --filter='jq -R . | jq --slurp -c .' | xargs -d "\n" -I % sh -c 'curl -H "Content-Type: application/json" -X POST -d '"'"'{"type":1,"entries":%}'"'"' http://127.0.0.1:8080/purge-something && sleep 30' |
2
score
|
List all packages with at least a class defined in a JAR file$ jar tf "$1" | grep '/.*\.class$' | xargs dirname | sort -u | tr / . |
2
score
|
Output an arbitrary number of open TCP or UDP ports in an arbitrary range$ comm -23 <(seq "$FROM" "$TO") <(ss -tan | awk '{print $4}' | cut -d':' -f2 | grep "[0-9]\{1,5\}" | sort | uniq) | shuf | head -n "$HOWMANY" |
0
score
|
Source without circular reference$ [ ! "${LIB}" ] && ( readonly LIB; . "${ $( cd $( dirname $0 ) && pwd ) }/<path_to>/LIB.sh" ) |
4
score
|
Ternary conditional clause$ [ test_statement ] && ( then_statement ) || ( else_statement ); |
3
score
|
Get executed script's current working directory$ CWD=$(cd "$(dirname "$0")" && pwd) |
3
score
|
Random Git Commit$ git commit -m "$(w3m whatthecommit.com | head -n 1)" |
1
score
|
Blackhole ru zone$ echo "address=/ru/0.0.0.0" | sudo tee /etc/NetworkManager/dnsmasq.d/dnsmasq-ru-blackhole.conf && sudo systemctl restart network-manager |
0
score
|
Remove new lines from files and folders$ rename 's/[\r\n]//g' * |
2
score
|
Retrieve dropped connections from firewalld journaling$ sudo journalctl -b | grep -o "PROTO=.*" | sed -r 's/(PROTO|SPT|DPT|LEN)=//g' | awk '{print $1, $3}' | sort | uniq -c |
1
score
|
Kill a process running on port 8080$ lsof -i :8080 | awk 'NR > 1 {print $2}' | xargs --no-run-if-empty kill |
1
score
|
Kill a process running on port 8080$ lsof -i :8080 | awk '{print $2}' | tail -n 1 | xargs kill |
1
score
|
Get the latest Arch Linux news$ w3m https://www.archlinux.org/ | sed -n "/Latest News/,/Older News/p" | head -n -1 |
2
score
|
Make a new folder and cd into it.$ mkcd(){ NAME=$1; mkdir -p "$NAME"; cd "$NAME"; } |
1
score
|
Listen to the radio (radio2 in example)$ mpv http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/sbr_med/llnw/bbc_radio_two.m3u8 |
1
score
|
Go up to a particular folder$ alias ph='cd ${PWD%/public_html*}/public_html' |
3
score
|
Open another terminal at current location$ $TERMINAL & disown |
1
score
|
Preserve your fingers from cd ..; cd ..; cd..; cd..;$ up(){ DEEP=$1; for i in $(seq 1 ${DEEP:-"1"}); do cd ../; done; } |
0
score
|
Get the HTTP status code of a URL$ curl -Lw '%{http_code}' -s -o /dev/null -I SOME_URL |
0
score
|
Corporate random bullshit generator (cbsg)$ curl -s http://cbsg.sourceforge.net/cgi-bin/live | grep -Eo '^<li>.*</li>' | sed s,\</\\?li\>,,g | shuf -n 1 | cowsay |
0
score
|
Generate a sequence of numbers$ perl -e 'print "$_\n" for (1..10);' |
1
score
|
List the content of a GitHub repository without cloning it$ svn ls https://github.com/user/repo/trunk/some/path |