multi-line support for clipboard macro. (lol didn't even commit after making it work properly)
This commit is contained in:
32
.bashrc
32
.bashrc
@@ -54,23 +54,7 @@ function catbox
|
||||
echo ""
|
||||
}
|
||||
alias shitpost="~/tinker/tinyscripts/shitpost.sh"
|
||||
function cheat { curl "cheat.sh/$*"; }
|
||||
function unroll { magick $1 -layers CompareAny blah.png; }
|
||||
function ga
|
||||
{
|
||||
PROG=sxiv
|
||||
TARGET=~/Games/img.silvie.org/docs/cdn/deck-builder/
|
||||
BLOB=$TARGET/search.json
|
||||
if [ $1 == -r ]; then PROG=ristretto; shift; fi
|
||||
if [ $1 == -i ]; then PROG=; shift; fi
|
||||
if grep -Eq '[0-9a-zA-Z]{10}' <<< "$1"; then id=$1 # This format is fucking shit, just randomly capital letters on one in 50 cards.
|
||||
else name="$*"; fi
|
||||
|
||||
if [ $id -a $PROG ]; then $PROG $TARGET$id.jpg; return; fi # Can skip the search.json lookup (not really necessary)
|
||||
if [ -z $id ]; then data=`jq '.[]|select(.n=="'"$name"'")' < $BLOB`; fi
|
||||
if [ -z $PROG ]; then jq <<< "$data"; return; fi
|
||||
$PROG $TARGET`jq -r .u <<< "$data"`.jpg
|
||||
}
|
||||
|
||||
#fun
|
||||
function space { python -c "print(\" \".join(\"$*\"))"; }
|
||||
@@ -90,6 +74,7 @@ function mxc { [ -z $INSTANCE ] && creds matrix harpy; echo "https://$INSTANCE/_
|
||||
eval "$(thefuck --alias)"
|
||||
alias dedupe='python ~/deduper.py'
|
||||
alias tra="traceroute -6"
|
||||
function cheat { curl "cheat.sh/$*"; }
|
||||
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'; }
|
||||
@@ -97,6 +82,21 @@ function waypon { sudo rc-service waycontainer start; WAYLAND_DISPLAY=wayland-1
|
||||
function video_extract { ffmpeg -ss $1 -to $2 -i $3 $4; }
|
||||
function reread_rss { sqlite3 ~/.local/share/liferea/liferea.db 'select items.title,parent_node_id,node.title from items join node on parent_node_id=node.node_id where date > '`date +%s`"-${1:-86400} and parent_node_id<>'bfqeltc' order by date desc;"; }
|
||||
function cover_fix { if [ -z "`ls cover_large* 2>/dev/null`" ]; then rename cover cover_large *; fi; magick cover_large* -resize $1x$1 cover.png; }
|
||||
function ga
|
||||
{
|
||||
PROG=sxiv
|
||||
TARGET=~/Games/img.silvie.org/docs/cdn/deck-builder/
|
||||
BLOB=$TARGET/search.json
|
||||
if [ $1 == -r ]; then PROG=ristretto; shift; fi
|
||||
if [ $1 == -i ]; then PROG=; shift; fi
|
||||
if grep -Eq '[0-9a-zA-Z]{10}' <<< "$1"; then id=$1 # This format is fucking shit, just randomly capital letters on one in 50 cards.
|
||||
else name="$*"; fi
|
||||
|
||||
if [ $id -a $PROG ]; then $PROG $TARGET$id.jpg; return; fi # Can skip the search.json lookup (not really necessary)
|
||||
if [ -z $id ]; then data=`jq '.[]|select(.n=="'"$name"'")' < $BLOB`; fi
|
||||
if [ -z $PROG ]; then jq <<< "$data"; return; fi
|
||||
$PROG $TARGET`jq -r .u <<< "$data"`.jpg
|
||||
}
|
||||
|
||||
#deprecated
|
||||
#function nhen { echo https://nhentai.net/g/$1; }
|
||||
|
||||
@@ -1,6 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
declare -A cartography # Feels weird using a joke I got from pedos.
|
||||
cartography[package]="https://michael.orlitzky.com/articles/motherfuckers_need_package_management.xhtml"
|
||||
config="/home/wisknort/.config/clip_macros"
|
||||
|
||||
wl-copy <<< "${cartography[`tr ' ' '\n' <<< "${!cartography[@]}" | zenity --list --column=nigger --hide-header`]}"
|
||||
declare -A cartography # Feels weird using a joke I got from pedos.
|
||||
source "$config/list"
|
||||
|
||||
if [ "$1" == fetch ]; then
|
||||
name="`tr ' ' '\n' <<< "${!cartography[@]}" | zenity --list --column=nigger --hide-header`"
|
||||
val="${cartography[$name]}"
|
||||
[ -z "$val" ] && val="`cat $config/$name`"
|
||||
wl-copy -n <<< "$val"
|
||||
elif [ "$1" == add ]; then
|
||||
IFS=: read name val <<< "`zenity --entry`"
|
||||
[ -z "$name" ] && exit # Don't enter blanks
|
||||
[ -z "$val" ] && zenity --entry > "$config/$name" # Allows multi-line input.
|
||||
echo cartography[$name]=\"$val\" >> "$config/list"
|
||||
fi
|
||||
|
||||
@@ -9,6 +9,11 @@ seed=round(ra.random()*(2**20)-2**19)*3000
|
||||
root='/home/wisknort/Music/'
|
||||
snipper=len(root)
|
||||
|
||||
actions={}
|
||||
def add_action(funky):
|
||||
actions[funky.__name__]=funky
|
||||
return funky
|
||||
|
||||
def _connect():
|
||||
s=sock(family=socket.AF_UNIX)
|
||||
s.connect('/tmp/musicbot')
|
||||
@@ -33,6 +38,7 @@ def get_req(command,conn=None):
|
||||
if 'request_id' not in attempt or attempt['request_id']!=idd: attempt='' # Wrong result, try again. It must be after we sent the command. But how far...
|
||||
return attempt
|
||||
|
||||
@add_action
|
||||
def pick(name=''):
|
||||
s=_connect()
|
||||
tracks=get_req(['get_property','playlist'],s)['data']
|
||||
@@ -61,10 +67,12 @@ def pick(name=''):
|
||||
except ValueError: p=False
|
||||
s.send(j.dumps({"command":["playlist-play-index",tracks[position+sel]['id']]}).encode('utf-8')+b'\n')
|
||||
|
||||
@add_action
|
||||
def repeat(*args):
|
||||
s=_connect()
|
||||
s.send(b'{"command":["cycle-values","loop","inf","no"]}\n')
|
||||
|
||||
@add_action
|
||||
def seq(*args):
|
||||
s=_connect()
|
||||
peth='/home/wisknort/.config/mpv/scripts-storage/shfc'
|
||||
@@ -79,5 +87,5 @@ def seq(*args):
|
||||
if __name__=='__main__':
|
||||
import sys
|
||||
action=sys.argv[1]
|
||||
print('executing',action)
|
||||
{'pick':pick,'rep':repeat,'seq':seq}[action](' '.join(sys.argv[2:]))
|
||||
if action not in actions: print('executing pick'); pick(' '.join(sys.argv[1:]))
|
||||
else: print('executing',action); actions[action](' '.join(sys.argv[2:]))
|
||||
|
||||
13
wpfx.sh
13
wpfx.sh
@@ -5,11 +5,14 @@ wine=wine
|
||||
wpfx=wpfx
|
||||
envar=WINEPREFIX
|
||||
echo init
|
||||
while getopts "123456789gp" target; do
|
||||
echo "$target, $OPTARG, $OPTIND"
|
||||
if [ $target = g ]; then wine=/opt/wine-ge-custom/bin/wine
|
||||
elif [ $target = p ]; then wine=proton-ge; wpfx=pfx; envar=STEAM_COMPAT_DATA_PATH
|
||||
else num=$target; fi
|
||||
while getopts "123456789gpw" target; do
|
||||
echo "$target, $OPTARG, $OPTIND"
|
||||
case $target in
|
||||
g) wine=/opt/wine-ge-custom/bin/wine;;
|
||||
p) wine=proton-ge; wpfx=pfx; envar=STEAM_COMPAT_DATA_PATH;;
|
||||
w) export DISPLAY=;;
|
||||
*) num=$target;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
echo "$wpfx, $num, $wine, $@"
|
||||
|
||||
Reference in New Issue
Block a user