tinyscripts/.bashrc

69 lines
4.2 KiB
Bash

#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
# alias ls='ls --color=auto'
# PS1='[\u@\h \W]\$ '
#jewtube-related
function yts { yt-dlp --get-title --get-duration --get-id ytsearch10:"'$*'"; }
function ytl { echo https://inv.riverside.rocks/watch?v=$1; }
function ytv { echo https://inv.riverside.rocks/watch?v=$(yt-dlp --get-id ytsearch:"'$*'"); }
function ytl2 { echo https://youtube.com/watch?v=$1; }
function vid { mpv "https://inv.riverside.rocks/latest_version?id=$1&itag=22&local=true"; }
#honorary jewtube
function nts { yt-dlp --get-title --get-duration --get-id nicosearch10:"$*"; }
#manga
function md { echo https://mangadex.org/title/$1; }
function mds { curl -s "https://api.mangadex.org/manga?contentRating[]=safe&contentRating[]=suggestive&contentRating[]=erotica&contentRating[]=pornographic&title=$(sed s/\ /+/g <<< $*)" | jq ".data | .[] | .id,.attributes.title.en?,.attributes.description.en?,\"\""; }
function mdi { curl -s "https://api.mangadex.org/manga/$1" | jq ".data | .id,.attributes.title.en?,.attributes.description.en?,\"\""; }
alias mdesu='/home/wisknort/tinker/md/mdesu/mdesu'
alias mdl="~/tinker/md/dler.py"
function mdu { curl -si https://mangadex.org/title/$1 | grep -i location; }
#strong utils
source ~/tinker/tinyscripts/creds_getter.sh
function lyrics { python ~/tinker/lyrics-fetcher/getlyrics.py $@; }
function pulsemagix { ~/pulsemagix.sh $*; }
alias search=~/tinker/tinyscripts/search.sh
alias gitmk="git push -o repo.private=false -u master master"
alias wpfx="WINEPREFIX='$(pwd)/wpfx' wine"
function update { scp -r * root@jasmine:"$(cat .update)"; }
function makepkgi { a="$(pwd)"; mkdir -p "/tmp/negros/src/$(basename "$a")"; cp PKGBUILD /tmp/negros/; cp -r * "/tmp/negros/src/$(basename "$a")/"; cd /tmp/negros/; rm "src/$(basename "$a")/PKGBUILD"; makepkg -${1:-R}; cp *.tar.zst "$a"; cd "$a"; rm -r /tmp/negros/; }
#image shitposting
function catbox { curl -F fileToUpload="@$*" -F reqtype=fileupload https://catbox.moe/user/api.php; echo ""; }
alias shitpost="~/tinker/tinyscripts/shitpost.sh"
#fun
function space { python -c "print(\" \".join(\"$*\"))"; }
function cap { python -c "a=\"$*\"; print(\"\".join([a[i].lower() if i%2 else a[i].upper() for i in range(len(a))]))"; }
function vandalise { rev <<< $*; }
function xyzzy { echo "Nothing happens."; }
alias pentest="curl -H 'user-agent:rakkatakkamuthafakka'"
#fedi
alias fedifind="python ~/tinker/fedi/fedi_finder.py -c ~/tinker/fedi/misc/userids"
function fedidl { a=$(curl -sLH "Accept:application/activity+json" $1 | jq -r '.attachment[] | .url'); if [ "$2" = "-p" ]; then echo $a; else wget $a; fi; }
alias att="~/tinker/fedi/get_attachments.sh"
function fedii { curl -sLH "Accept:application/activity+json" $1 | jq; }
function mxc { [ -z $INSTANCE ] && creds matrix harpy; echo "https://$INSTANCE/_matrix/media/v3/download/$*"; }
#low-frequency
eval "$(thefuck --alias)"
alias dedupe='python ~/deduper.py'
alias tra="traceroute -6"
function tapas { wget $(curl $1 | grep -oE data-src=\".+\" | grep -oE h.+g); }
function mnotif { [ -z $1 ] && jq -r 'keys | .[]' < ~/tinker/matrix/matrix.conf; [ -z $1 ] || curl https://$(jq -r ".$1.instance" < ~/tinker/matrix/matrix.conf)/_matrix/client/r0/notifications -H "Authorization:Bearer $(jq -r ".$1.access_token" < ~/tinker/matrix/matrix.conf)" | jq '.notifications | .[] | (.room_id+", "+(.ts | tostring)+", "+.event.sender+": "+.event.content.body),""'; }
function tlcard { a="$*"; read oid lang <<< "$(curl -s "https://api.scryfall.com/cards/named?fuzzy=${a/ /+}" | jq -r '.oracle_id+" "+(["en","ja"]-[.lang])[0]')"; curl -s "https://api.scryfall.com/cards/search?order=released&q=oracleid:$oid+lang:$lang&unique=prints" | jq -r '.data[0] | .printed_name // .name, .printed_type_line // .type_line, .printed_text // .oracle_text'; }
#deprecated
#function nhen { echo https://nhentai.net/g/$1; }
#alias genyprox="mitmproxy --mode socks5 --listen-port 8050"
#alias genyprox2="mitmproxy --mode socks5 --listen-port 8051"
#alias ztr="sudo rc-service zerotier-one restart"
#function zino { curl -iX PUT 'http://conduit.rakka.tk/_matrix/client/r0/rooms/!bXiARHQYqPBOdJRzTd:matrix.org/send/m.room.message/'$1 -H "Authorization:Bearer $TOKE" --json "{\"msgtype\":\"m.text\",\"body\":\"$(cat)\"}" && echo ''; }