diff options
| author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-02-14 02:23:53 +0100 | 
|---|---|---|
| committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-02-14 02:23:53 +0100 | 
| commit | f5526c4cfbe0803212050dc53a487e5c3b38bd4b (patch) | |
| tree | 2ba0b97fbd1a6ac4f3ae4b529da0d21570a3f4b8 /bin/extra | |
| parent | 991fc41022fbdf7da399eb8ea53b3c67d0239d47 (diff) | |
Update scripts
Diffstat (limited to 'bin/extra')
| -rw-r--r-- | bin/extra/keyboards.txt | 2 | ||||
| -rwxr-xr-x | bin/extra/magnet2torrent | 27 | ||||
| -rwxr-xr-x | bin/extra/p.sh | 27 | ||||
| -rwxr-xr-x | bin/extra/snpdf | 2 | ||||
| -rwxr-xr-x | bin/extra/ssimg | 4 | ||||
| -rwxr-xr-x | bin/extra/steamidtoname | 8 | ||||
| -rwxr-xr-x | bin/extra/swapclip | 8 | ||||
| -rwxr-xr-x | bin/extra/timezone | 3 | ||||
| -rwxr-xr-x | bin/extra/transfer.sh | 24 | 
9 files changed, 104 insertions, 1 deletions
diff --git a/bin/extra/keyboards.txt b/bin/extra/keyboards.txt index 03ec74b..62e77de 100644 --- a/bin/extra/keyboards.txt +++ b/bin/extra/keyboards.txt @@ -1,2 +1,2 @@ -be  us +us -option ctrl:swapcaps -variant colemak diff --git a/bin/extra/magnet2torrent b/bin/extra/magnet2torrent new file mode 100755 index 0000000..0a1f83e --- /dev/null +++ b/bin/extra/magnet2torrent @@ -0,0 +1,27 @@ +#!/bin/sh + +################################# +#                               # +# Bash script to convert a      # +# magnet link to a torrent file # +#                               # +#  StrickStuff.com              # +#                               # +################################# + + +# Check that the user entered a valid magnet link +if [ "$#" -ne 1 ] || [ "${1##*magnet*}" ] +then +    echo "Usage: $0 " +    exit 1 +fi + +# Extract the info hash from the magnet link +hash="${1##*btih:}" +hash="${hash%%&*}" + +# Download the torrent file from a torrent website +torrent_file="${hash}.torrent" +wget "https://itorrents.org/torrent/${hash}.torrent" -O "$torrent_file" +echo "Torrent file written to ${torrent_file}" diff --git a/bin/extra/p.sh b/bin/extra/p.sh new file mode 100755 index 0000000..010ae0c --- /dev/null +++ b/bin/extra/p.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +ask_pokemon() { commander -xc < ./pokemon_bw.txt; } + +html="/tmp/pk_tmp.html" +[ "$pokemon" ] || pokemon="$(ask_pokemon)" +[ "$pokemon" ] || exit 1 + +case "$1" in +    # evolution +    e*) +        url="https://pokemondb.net/pokedex/$pokemon" +        curl -Ls "$url" > "$html" +        level1="$(pup -p 'span.infocard:nth-child(2) > small:nth-child(2) text{}' < "$html")" +        level2="$(pup -p 'span.infocard:nth-child(4) > small:nth-child(2) text{}' < "$html")" +        notify-send "p.sh" "$level1\n$level2" +    ;; + +    # moves +    m*) $BROWSER "https://bulbapedia.bulbagarden.net/wiki/${pokemon}_(Pok%C3%A9mon)/Generation_V_learnset" ;; + +    # stats +    s*) $BROWSER "https://www.smogon.com/dex/bw/pokemon/$pokemon/" ;; +    *)   +        choice="$(printf 'evolution\nmoves\nstats\n' | commander -c -w 3)" +        [ "$choice" ] && pokemon="$pokemon" $0 "$choice" ;; +esac diff --git a/bin/extra/snpdf b/bin/extra/snpdf new file mode 100755 index 0000000..56d9e21 --- /dev/null +++ b/bin/extra/snpdf @@ -0,0 +1,2 @@ +#!/bin/sh +zathura "$(clipo | sed 's@^file://@@;s/\.pdf.*/.pdf/;s/%20/ /g')" diff --git a/bin/extra/ssimg b/bin/extra/ssimg new file mode 100755 index 0000000..d69db42 --- /dev/null +++ b/bin/extra/ssimg @@ -0,0 +1,4 @@ +#!/bin/sh +out="/tmp/ssimg.png" +clipo > "$out" || exit 1 +printf "file://clip" | ydotool type -d 40 -f - diff --git a/bin/extra/steamidtoname b/bin/extra/steamidtoname new file mode 100755 index 0000000..f1cee31 --- /dev/null +++ b/bin/extra/steamidtoname @@ -0,0 +1,8 @@ +#!/bin/sh + +[ "$#" -eq 0 ] && >&2 printf "usage: steamidtoname <id>" &&  exit 1 +name="$(curl -s https://store.steampowered.com/app/"$1"/ | +	pup -p 'title text{}' | +	sed 's/on Steam$//')" + +printf '%s\n' "$name" diff --git a/bin/extra/swapclip b/bin/extra/swapclip new file mode 100755 index 0000000..25b9857 --- /dev/null +++ b/bin/extra/swapclip @@ -0,0 +1,8 @@ +#!/bin/sh + +if [ "$WAYLAND_DISPLAY" ] +then +	paste="$(wl-paste)" +	wl-paste -p | wl-copy -n +	printf "%s" "$paste" | wl-copy -p -n +fi diff --git a/bin/extra/timezone b/bin/extra/timezone new file mode 100755 index 0000000..6f93aad --- /dev/null +++ b/bin/extra/timezone @@ -0,0 +1,3 @@ +#!/bin/sh +curl -s "https://www.timeanddate.com/time/zone/$1" | +	pup -p '.tb-tz > tbody:nth-child(2) > tr:nth-child(1) > th:nth-child(1) text{}' diff --git a/bin/extra/transfer.sh b/bin/extra/transfer.sh new file mode 100755 index 0000000..e8c9480 --- /dev/null +++ b/bin/extra/transfer.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +die () { >&2 printf '%s\n' "$@"; exit 1; } + +[ $# -eq 0 ] && +    die 'No arguments specified.\nUsage:\n  transfer <file|directory>\n  ... | transfer <file_name>' + +if [ -t 0 ] +then  +    file="$1" +    file_name="$(basename "$file")" +    [ -e "$file" ] || +        die "$file: No such file or directory\n" +    if [ -d "$file" ] +    then  +        file_name="$file_name".zip +        (cd "$file" && zip -r -q - .) | curl --upload-file - "https://transfer.sh/$file_name" +    else +        curl --upload-file "$file" "https://transfer.sh/$file_name" +    fi +else  +    file_name="$1" +    curl --upload-file - "https://transfer.sh/$file_name" +fi  | 
