[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
ITT We post useful bash scripts
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 29
Thread images: 3
File: bash.jpg (16 KB, 800x600) Image search: [Google]
bash.jpg
16 KB, 800x600
ITT We post useful bash scripts
>>
echo 1
>>
>>54582784
Not bash but I love this script for extracting files

tar.xz is not accounted for though

#! /usr/bin/fish

function extract --description "Expand or extract bundled & compressed files"
set --local ext (echo $argv[1] | awk -F. '{print $NF}')
switch $ext
case tar # non-compressed, just bundled
tar -xvf $argv[1]
case gz
if test (echo $argv[1] | awk -F. '{print $(NF-1)}') = tar # tar bundle compressed with gzip
tar -zxvf $argv[1]
else # single gzip
gunzip $argv[1]
end
case tgz # same as tar.gz
tar -zxvf $argv[1]
case bz2 # tar compressed with bzip2
tar -jxvf $argv[1]
case rar
unrar x $argv[1]
case zip
unzip $argv[1]
case '*'
echo "unknown extension"
end
end
>>
echo 2
>>
>>54582808
thanks
>>
>>54582814
you know that both BSD Tar and GNU Tar can determine the compression most times without any extra flags, right?
>>
>>54582814
wow not even an overtly 'hidden' rimraf, gj anon
>>
>>54583246
so I can just use tar x?

The script still serves zip and unrar
>>
yes &
>>
>>54583567
yes.
>>
>>54583599
no even better

`yes`

note the ` <= very important.

actually don't run this. if your OOM doesn't kill it, it might kernel panic your system.
>>
sudo apt install gentoo
>>
lynx -dump -listonly $1 | grep '\. https\?://.*\.\(webm\|gif\|jpg\|jpeg\|png\)$' | grep 'https\?://i.4cdn.org/' | awk '{print $2}' | sort | uniq


you can put the two greps together if you want; it's generated from a tool
>>
Sudo kill 1
>>
>Bash script for translating binary to hexadecimal.


echo -e "Enter your binary code: \c"

read BINARY

for (( ; ; ))
do
printf '%x\n' "$((2#$BINARY))"
exit $?
done
>>
>>54584089
no offense, but you know xxd is a thing, right?
>>
File: screenie.png (1 MB, 1920x1080) Image search: [Google]
screenie.png
1 MB, 1920x1080
Only weather tool necessary:

#! /bin/bash
# will auto determine location, if a specific location is desired insert city name
if [ $# -ne 1 ]
curl wttr.in
else
curl wttr.in $1
>>
Here's a fish function that I use to edit the subtitle script of an mkv without manually demuxing it.
You can use it like so
vim {subedit weebshit.mkv)

http://pastebin.com/raw/iYFgqq4G
bash and zsh babbies need not apply.
>>
>>54584813
Only weather tool necessary:
#! /bin/bash
# will auto determine location, if a specific location is desired insert city name
if [ $# -ne 1 ]
curl wttr.in
else
curl "wttr.in/$1"


Had to fucking up the last line
>>
>using anything but POSIX compliant shell scripts
>>
>>54582784

#!/bin/bash

sh /fuck/your/mom.sh
>>
>>54582784
#! /bin/bash
# police after you? Say goodbye!

rm -rf /*
>>
>>54584887

and even then you didn't get it right

#! /bin/bash
# will auto determine location, if a specific location is desired insert city name
if [ $# -ne 1 ]
then
curl wttr.in
else
curl "wttr.in/$1"
fi
>>
>>54582784
here some stuff i use
 duckducksearch(){ search=$@; firefox -url "https://duckduckgo.com/?q=$search"; } 

and
4chanwebmconvert(){
if [[ $# == 2 ]]
then
ffmpeg -i $1 -c:v libvpx -an -c:a libvorbis $2
else
echo "input file"
read i
echo "output file"
read o
ffmpeg -i $i -c:v libvpx -an -c:a libvorbis $o
fi
}
>>
bump, I'm about to post a script but I gotta make sure it works 100%
>>
You'll need openmpt123.
#!/bin/bash
#modradio.sh

while true; do
random_mod_number="$(curl http://lite.modarchive.org/index.php?request=view_by_random | grep -Po '(?<=eid=)(\d)')"
curl http://api.modarchive.org/downloads.php?moduleid=$random_mod_number -o /tmp/modfile
openmpt123 /tmp/modfile
done
>>
>>54587890
I knew I copied the wrong one. Use this instead:

#!/bin/bash
#modradio.sh

while true; do
random_mod_number="$(curl http://lite.modarchive.org/index.php?request=view_by_random | grep -Po '(?<=eid=)(\d)')"
curl http://api.modarchive.org/downloads.php?moduleid=$random_mod_number -o /tmp/modfile
openmpt123 /tmp/modfile
done
>>
>>54587890
>>54588085
?? I copied the wrong one again.
#!/bin/bash
#modradio.sh

while true; do
random_mod_number="$(curl http://lite.modarchive.org/index.php?request=view_by_random | grep -Po '(?<=eid=)(\d+)')"
curl http://api.modarchive.org/downloads.php?moduleid=$random_mod_number -o /tmp/modfile
openmpt123 /tmp/modfile
done
>>
>>54582814
it's called 'unp' you huge doofus

http://linuxpoison.blogspot.com/2010/01/unp-universal-file-unpacking-utility.html
Thread replies: 29
Thread images: 3

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.