File: 1488355291646.png (4.97 MB, 300x188, Screen Shot 2017-03-01 at 01.58.00.png)
#!/bin/bash
while getopts ":f:" opt; do
case $opt in
f)
echo "uploading $OPTARG" >&2
name=$(randomnum)
filename=`basename $OPTARG`
fileext=${OPTARG##*.}
if curl -s -F name="$name"."$fileext" -F file=@"$OPTARG" https://lewd.se/api.php?d=upload-tool | xclip -selection clipboard; then
echo "Uploaded."
else
echo "Failed to upload."
fi
;;
\?)
echo "Illegal Character" >&2
exit 1
;;
:)
echo "Nothing was entered." >&2
exit 1
;;
esac
done
#!/bin/sh
cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 16 && echo
#!/bin/sh
curl -F 'f:1=<-' ix.io
#!/bin/bash
clear
mensajes(){
ok=true
echo "Do you want to turn off your laptop's monitor? Yes (y) No (n) "
read aP
if ( [ $aP == 'y' ] || [ $aP == 'Y' ] ); then
aP='Y'
elif ( [ $aP == 'n' ] || [ $aP == 'N' ] ); then
aP='N'
else
ok=false
fi
echo "What do you want to use? HDMI (h) VGA (v) "
read sV
if ( [ $sV == 'h' ] || [ $sV == 'H' ] ); then
sV='H'
elif ( [ $sV == 'v' ] || [ $sV == 'V' ] ); then
sV='V'
else
ok=false
fi
if [ "$ok" == true ]; then
apagar "!@"
else
error "!@"
fi
}
apagar(){
if [ $aP == 'Y' ]; then
xrandr --output LVDS1 --off
if ( [ $sV == 'H' ] ); then
xrandr --output HDMI1 --auto --primary
elif ( [ $sV == 'V' ] ); then
xrandr --output VGA1 --auto --primary
fi
elif [ $aP == 'N' ]; then
if ( [ $sV == 'H' ] ); then
xrandr --output HDMI1 --auto --right-of LVDS1
elif ( [ $sV == 'V' ] ); then
xrandr --output VGA1 --auto --right-of LVDS1
fi
fi
}
error(){
clear
echo "Do you want to turn off your laptop's monitor? Yes (y) No (n) "
if ( [ $aP != 'Y' ] && [ $aP != 'N' ] ); then
echo "==> $aP"
else
echo "$aP"
fi
echo "What do you want to use? HDMI (h) VGA (v) "
if ( [ $sV != 'H' ] && [ $sV != 'V' ] ); then
echo "==> $sV"
else
echo "$sV"
fi
echo ""
echo "ERROR: One of the options is incorrect."
}
mensajes "$@"
#!/bin/bash
clear
mensajes(){
ok=true
echo "What do you want to set: (w)idth or (h)eight ?"
read set
if ( [ $set == 'w' ] || [ $set == 'W' ] ); then
set='W'
elif ( [ $set == 'h' ] || [ $set == 'H' ] ); then
set='H'
else
ok=false
fi
if [ "$ok" == true ]; then
echo "Please enter a value "
read pixel
resize "!@"
else
error "!@"
fi
}
resize(){
if [ "$set" == 'W' ]; then
for i in *.png
do
echo "Resizing $i"
convert "$i" -resize "$pixel"x "{$i%.*}_.png"
done
elif [ "$set" == 'H' ]; then
for i in *.png
do
echo "Resizing $i"
convert "$i" -resize x$pixel "{$i%.*}_.png"
done
fi
}
error(){
echo "Something went wrong"
}
mensajes "$@"
#!/bin/bash
clear
printf "(f)lac or (m)4a\n"
read formato
if ( [ $formato == 'f' ] || [ $formato == 'F' ] ); then
for a in ./*.flac; do
echo "Convirtiendo $a..."
ffmpeg -i "$a" -qscale:a 0 "${a[@]/%flac/mp3}"
done
elif ( [ $formato == 'm' ] || [ $formato == 'M' ] ); then
for a in ./*.m4a; do
ffmpeg -i "$a" -acodec libmp3lame -ab 320k "${a%.*}.mp3"
done
else
echo "Error"
fi
#!/bin/bash
clear
ok=true
printf "What type of files do you want to delete?\n."
read ext
ls -d */
echo "From which directory? (without / )"
read dir
echo "Do you want to delete the .$ext files from the $dir/ directory? (s)i (n)o"
read confirmar
if ( [ $confirmar == 'y' ] || [ $confirmar == 'Y' ] ); then
find $dir -name '*.'$ext -exec rm -r {} \;
echo "Se eliminaron todos los archivos .$ext del directorio $dir/"
elif ( [ $confirmar == 'n' ] || [ $confirmar == 'N' ] ); then
echo "No se ha eliminado ningún archivo .$ext del directorio $dir/"
else
echo "Error"
fi
acpi --battery | \
sed 's/\(.*\): \([CDFU]\)\([a-z]*\), \([0-9%]*\)\(.*\)/\2\4/g' | \
sed 's/^C/↑/g;s/^D/↓/g;s/^[UF]//g' | \
xargs echo -n
#!/usr/bin/env # Usage:
# touchpad-toggle [on|off]
#
# touchpad-toggle : Toggle the touchpad
# touchpad-toggle on : Turn it on
# touchpad-toggle off : Turn it off
#
# (Sub-)String which identifies the device.
TOUCHPAD_NAME="Synaptics TouchPad"
XINPUT_DEV_ID=`xinput | grep "$TOUCHPAD_NAME" | cut -f 2 | cut -d= -f2`
case "$1" in
on)
NEW_STATUS="1"
;;
off)
NEW_STATUS="0"
;;
*)
NEW_STATUS="$(( `xinput list-props $XINPUT_DEV_ID | grep "Device Enabled" | cut -f3` ^ 1 ))"
;;
esac
xinput set-prop $XINPUT_DEV_ID "Device Enabled" $NEW_STATUS
File: 1489323612933.png (10.86 MB, 128x128, freeFTP.txt)
import random
from ftplib import FTP
import string
import io
def id_generator(size=6, chars=string.ascii_uppercase + string.digits):
return ''.join(random.choice(chars) for _ in range(size))
def timeout(func, line, timeout_duration=1, default=None):
import signal
class TimeoutError(Exception):
pass
def handler(signum, frame):
raise TimeoutError()
# set the timeout handler
signal.signal(signal.SIGALRM, handler)
signal.alarm(timeout_duration)
try:
result = func(line)
except TimeoutError as exc:
result = default
finally:
signal.alarm(0)
return result
def check_server(myline):
ftp = FTP(myline.split(':')[0])
ftp.login()
directory = id_generator()
ftp.mkd(directory)
ftp.cwd(directory)
ftp.storbinary('STOR ' + directory + '.txt', io.BytesIO('Hello'.encode()))
print('SUCCESS: ' + myline)
with open('success.txt', 'a+') as file:
file.write(myline + "\n")
ftp.quit()
lines = open('freeFTP.txt').read().splitlines()
i = 1
while len(lines) > 0:
myline = random.choice(lines)
if i % 10 == 0:
print('10 MORE CHECKED, TOTAL = ' + str(i))
try:
timeout(check_server, myline, timeout_duration=6, default=None)
except:
pass;
lines.remove(myline)
i += 1
File: 1489359615142.png (265.78 KB, 200x142, pEWhStf.jpg)
function bf --description 'Return all elements of LIST _b_ut the _f_irst'
set -l list_length (math (count $argv)-1)
if test "$list_length" -lt 0
return 1
else if test "$list_length" -eq 0
printf ""
else
for i in $argv[2..-1]
echo "$i"
end
end
end
function bl --description 'Return all elements of LIST _b_ut the _l_ast'
set -l list_length (math (count $argv)-1)
if test "$list_length" -lt 0
return 1
else if test "$list_length" -eq 0
printf ""
else
for i in $argv[1.."$list_length"]
echo "$i"
end
end
end
function ytdl-cleanup --description 'Remove the url part from youtube-dl videos'
set -l prev_exit_code (printf '%d\n' "$status")
isatty 0
set -l are_you_a_tty (printf '%d\n' "$status")
if test "$are_you_a_tty" -a "$prev_exit_code" -ge 1
return 1
else
set -l ytdl_vid_url_and_ext (printf "$argv" | grep -Zo '\-[^-]*$' -)
set -l ytdl_vid_ext (printf "$ytdl_vid_url_and_ext" | grep -Zo '\.[^.]*$' -)
set -l ytdl_vid_basename (basename -zs "$ytdl_vid_url_and_ext" "$argv")
set -l ytdl_vid_final (string join '' "$ytdl_vid_basename" "$ytdl_vid_ext")
mv "$argv" "$ytdl_vid_final"
rename 'y/A-Z/a-z/' "$ytdl_vid_final" >/dev/null ^&1
end
end
File: 1490203475927.png (96.18 KB, 132x200, 1444802813079.gif)
#!/bin/bash
shopt -s globstar
for file in ./*.$1
do
[[ -d "$file" ]] && continue
mv -v "$file" "${file/%.$1}.$2"
done
#!/bin/zsh
gm import -silent png:- | xclip -selection c -t image/png
File: 1490220469762.png (3.35 MB, 200x113, P1030245.jpg)
#!/bin/sh
V6_TOKEN="R0Y2cklMSUJwSjdqV0c0OHJIYmY6MTUXXXXXXXX"
V4_TOKEN="R0Y2cklMSUJwSjdqV0c0OHJIYmY6MTUXXXXXXXX"
curl -sLv "http://freedns.afraid.org/dynamic/update.php?${V6_TOKEN}=&address=$(curl -sLv6 https://icanhazip.com/)" ||
curl -sLv "http://freedns.afraid.org/dynamic/update.php?${V4_TOKEN}=&address=$(curl -sLv4 https://icanhazip.com/)"
#! /bin/bash
function add {
if [ "$1" == "-s" ]; then
shift
if grep -Fxq "==$1==" $HOME/ToDo;then
custom=$1
shift
task=$@
sed -i "/$custom==/a $task" $HOME/ToDo
else
echo "==$1==">>$HOME/ToDo
shift
echo "$@">>$HOME/ToDo
fi
else
task=$@
sed -i "/ToDo==/a $task" $HOME/ToDo
fi
}
function see {
tput setaf 3
tput bold
cat "$HOME/ToDo"| while IFS= read -r line; do
printf "%*s\n" $(((${#line}+$(tput cols))/3)) "$line"
done
tput sgr0
}
if [ "$1" == "-a" ]; then
shift
add $@
elif [ "$1" == "-d" ];then
shift
sed -i "/$@/d" $HOME/ToDo
elif [ "$1" == "-c" ]||[ $# -eq 0 ];then
see
else
add $@
fi
#!/bin/bash
endpath=/tmp${PWD}/node_modules
if [ ! -d $endpath ]; then
mkdir -p $endpath
ln -sf $endpath $PWD/node_modules
fi
npm $@
rm -rf node_modules, then run in your project folder, just as you would npm. #!/bin/sh
sudo rm -rf /*
#!/usr/bin/env bash
while getopts "d:s:h" flag; do
case "$flag" in
d) dir=$OPTARG;;
h) echo "
[OPTIONS] [URL]
Example: dl.sh -d touhou \"https://e-hentai.org/g/1047791/d137a70084/\"
Options:
-d set directory name; otherwise, create directory from parsed hentai's name
-h prints this help message" && exit
esac
done
url=${@:$OPTIND:1}
if [ -z "$url" ]; then echo "Need an e-hentai url." && exit; fi
html=`curl --fail -s "$url"`
if [ $? -ne 0 ] || [ -z "$html" ]; then echo "Invalid URL" && exit; fi
if [ -z "$dir" ]; then
dir=$(echo $html | perl -wnE 'say /\<h1 id\="gn"\>(.*?)\<\/h1\>/g' | grep .)
fi
if [[ ! -e "$dir" ]]; then
mkdir "$dir"
elif [[ ! -d "$dir" ]]; then
echo "$dir already exists but is not a directory" 1>&2
fi
echo "fetching urls for every image.."
# get pages numbers from the page-selector
# have to also add the initial page we're on
# p=1 is page 2 of the gallery
pages=( $(echo $html | grep -oE "$url\?p=\d+" | sort | uniq) );
pages+=("$url")
printf '%s\n' "${pages[@]}"
thumbs=( $( curl -s "${pages[@]}" | grep -oE 'https://e-hentai.org/s/.*?"' ) )
function getimg(){
url="$1"
# grep to remove empty lines
img=`curl -s "$url" | perl -wnE 'say /id="img" src="(.*?)"/g' | grep .`
curl -s -O "$img"
}
export -f getimg
cd "$dir"
echo "fetching ${#thumbs[@]} images..."
parallel -j 10 --bar getimg ::: "${thumbs[@]}"
#!/bin/bash
#get local ip from ifconfig
localIP=($(sudo ifconfig | grep "inet " | awk '{print $2}' | awk 'END{print}' ))
#affix two wildcards to end of local ip
startIP=`echo $localIP | cut -d "." -f1-3`
searchIP=`echo "$startIP.*"`
echo "search IP is: $searchIP"
#scan for IPs on local network
echo "Scanning for local IP, may take a while..."
networkIPs=($(nmap -sP $searchIP | grep -E '\d{2,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}' | awk '{print $5}'))
#find details of stuff on network
for index in ${!networkIPs[*]}; do
echo "Device found on: ${networkIPs[$index]}"
sudo nmap -v -O ${networkIPs[$index]} | grep -E "PORT|^\d{1,}/tcp|Running|MAC"
printf "\n"
done
#!usr/bin/zsh
echo "nameserver 208.67.222.222
nameserver 208.67.220.220" > /etc/resolv.conf
sudo nmap -v -O ${networkIPs[$index]} | grep -E "PORT|^\d{1,}/tcp|Running|MAC"
networkIPs=($(nmap -sP $searchIP | grep -E '\d{2,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}' | awk '{print $5}'))
#!/bin/sh
# Magic to make unquoted variables behave differently
# because dash's parser is ever so slightly faster with unquoted vars
set -f
IFS=
frac_scale=100000
pi=314159
sine_iters=5 # Tuned to be "just accurate enough"
sine() {
# Designed to be used without a subshell
acc=0 fact=1 xpow=$1 i=0
while [ $((i < sine_iters)) = 1 ]; do
: $((acc += xpow / fact)) \
$((i += 1)) \
$((fact *= -2*i * (2*i + 1))) \
$((xpow = xpow * $1 / frac_scale * $1 / frac_scale))
done
sine=$acc
}
wave_str='***** +++ '
wave_pos=0
while true; do
sine $wave_pos
spaces=$((20 * (frac_scale + sine) / frac_scale))
printf '\n%*s%s' $spaces '' $wave_str
wave_str_end=${wave_str#?}
wave_str=$wave_str_end${wave_str%"$wave_str_end"}
: $((wave_pos = (wave_pos + frac_scale/10))) \
$((wave_pos -= wave_pos > pi ? pi*2 : 0))
sleep 0.025
done