diff options
| author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-02-15 16:31:56 +0100 | 
|---|---|---|
| committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-02-15 16:47:43 +0100 | 
| commit | 3b2a78935fd6550521f719a10e5b0fceb1ddb350 (patch) | |
| tree | 7c50801d6bb5b7abba3df6352ed43df454a4dbcb /bin | |
Not really but, First commit!
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/common/ask | 28 | ||||
| -rwxr-xr-x | bin/common/autofetch | 13 | ||||
| -rwxr-xr-x | bin/common/fzfdir | 2 | ||||
| -rwxr-xr-x | bin/common/fzfdirfile | 2 | ||||
| -rwxr-xr-x | bin/common/fzffile | 2 | ||||
| -rwxr-xr-x | bin/common/gign | 2 | ||||
| -rwxr-xr-x | bin/common/hextorgb | 7 | ||||
| -rwxr-xr-x | bin/common/wt | 10 | ||||
| -rwxr-xr-x | bin/dmscripts/dmapimg | 6 | ||||
| -rwxr-xr-x | bin/dmscripts/dmclip | 83 | ||||
| -rwxr-xr-x | bin/dmscripts/dmdsktp | 12 | ||||
| -rwxr-xr-x | bin/dmscripts/dmemoji | 1423 | ||||
| -rwxr-xr-x | bin/dmscripts/dmfm | 17 | ||||
| -rwxr-xr-x | bin/dmscripts/dmhelp | 26 | ||||
| -rwxr-xr-x | bin/dmscripts/dminw | 4 | ||||
| -rwxr-xr-x | bin/dmscripts/dmlang | 7 | ||||
| -rwxr-xr-x | bin/dmscripts/dmpass | 11 | ||||
| -rwxr-xr-x | bin/dmscripts/dmpassgen | 20 | ||||
| -rwxr-xr-x | bin/dmscripts/dmpdf | 21 | ||||
| -rwxr-xr-x | bin/dmscripts/dmpower | 3 | ||||
| -rwxr-xr-x | bin/dmscripts/dmpsbm | 2 | ||||
| -rwxr-xr-x | bin/dmscripts/dmpsclip | 3 | ||||
| -rwxr-xr-x | bin/dmscripts/dmvid | 17 | ||||
| -rwxr-xr-x | bin/dmscripts/dmyt-not | 6 | ||||
| -rwxr-xr-x | bin/extra/arr_hjkl | 17 | ||||
| -rwxr-xr-x | bin/extra/cht.sh | 796 | ||||
| -rwxr-xr-x | bin/extra/colorscript | 40 | ||||
| -rwxr-xr-x | bin/extra/cycleKB | 11 | ||||
| -rwxr-xr-x | bin/extra/ehbtodl | 9 | ||||
| -rw-r--r-- | bin/extra/keyboards.txt | 2 | ||||
| -rwxr-xr-x | bin/extra/vimastp | 12 | 
31 files changed, 2614 insertions, 0 deletions
diff --git a/bin/common/ask b/bin/common/ask new file mode 100755 index 0000000..85b5f9e --- /dev/null +++ b/bin/common/ask @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# Depends on passmenu +if [ -z "$1" ] +then +    echo -n ">" +    read prompt +else +    prompt="$@" +fi + +API_KEY="$(pass tokens/openai-api)" + +data=$(echo \ +'{ +  "prompt": "'"$prompt"'", +  "model": "text-davinci-003", +  "max_tokens": 1024, +  "temperature": 0 +}') + +output=$(curl -s -X POST \ +	-H 'Content-Type: application/json' \ +    -H "Authorization: Bearer $API_KEY" \ +	-d "$data" \ +	https://api.openai.com/v1/completions \ +	| jq -r '.choices[0].text') + +echo "${output:1}" diff --git a/bin/common/autofetch b/bin/common/autofetch new file mode 100755 index 0000000..3dcdc15 --- /dev/null +++ b/bin/common/autofetch @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +GREEN='\033[0;32m' +NC='\033[0m' +# Fetches for git repos, meant to run at startup +for directory in "." "installdrier" ".config" ".password-store" +do +    if cd ~/$directory +    then +        echo -ne "Fetching in ${GREEN}'~/${directory}'${NC}" +        git fetch origin || exit 1 +        echo ", done." +    fi +done diff --git a/bin/common/fzfdir b/bin/common/fzfdir new file mode 100755 index 0000000..6ae8f6a --- /dev/null +++ b/bin/common/fzfdir @@ -0,0 +1,2 @@ +#!/usr/bin/env sh +find "${1:-$HOME}" -type \d 2> /dev/null | fzf diff --git a/bin/common/fzfdirfile b/bin/common/fzfdirfile new file mode 100755 index 0000000..df0e51a --- /dev/null +++ b/bin/common/fzfdirfile @@ -0,0 +1,2 @@ +#!/usr/bin/env sh +dirname "$(find "${1:-$HOME}" -type f 2> /dev/null | fzf)" diff --git a/bin/common/fzffile b/bin/common/fzffile new file mode 100755 index 0000000..03e39be --- /dev/null +++ b/bin/common/fzffile @@ -0,0 +1,2 @@ +#!/usr/bin/env sh +find "${1:-$HOME}" -type f 2> /dev/null | fzf diff --git a/bin/common/gign b/bin/common/gign new file mode 100755 index 0000000..e3ba12a --- /dev/null +++ b/bin/common/gign @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +git status --porcelain=v1 | grep "^??" | cut -d' ' -f2- | sed -r 's/^["](.*)["]$/\1/' >> .gitignore diff --git a/bin/common/hextorgb b/bin/common/hextorgb new file mode 100755 index 0000000..b268db5 --- /dev/null +++ b/bin/common/hextorgb @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +cat /dev/stdin \ +    | tr -d '#' | tr '[:lower:]' '[:upper:]' \ +	| sed -r 's/([0-9A-F]{2})/\1\n/g ; i ibase=16' \ +	| bc \ +	| tr '\n' ',' \ +	| sed 's/.$// ; s/.*/rgb(&)/' diff --git a/bin/common/wt b/bin/common/wt new file mode 100755 index 0000000..81081c8 --- /dev/null +++ b/bin/common/wt @@ -0,0 +1,10 @@ +#!/bin/bash + +echo "$@" > /tmp/truewhile.tmp +while true +do +  bash /tmp/truewhile.tmp +  sleep 1 +  clear +done +rm /tmp/truewhile.tmp diff --git a/bin/dmscripts/dmapimg b/bin/dmscripts/dmapimg new file mode 100755 index 0000000..25c414b --- /dev/null +++ b/bin/dmscripts/dmapimg @@ -0,0 +1,6 @@ +#!/bin/bash +appimage="$(\ +  find ~/.local/share/appimages -type f -printf "%f\n" \ +  | sed 's/\.[Aa]pp[Ii]mage$//g' \ +  | dmenu -x -l 10 -g 1 -p "AppImage:")" +setsid ~/AppImages/"${appimage:-NOSEL}"* diff --git a/bin/dmscripts/dmclip b/bin/dmscripts/dmclip new file mode 100755 index 0000000..5282b35 --- /dev/null +++ b/bin/dmscripts/dmclip @@ -0,0 +1,83 @@ +#!/usr/bin/env bash +NotImage () { +    echo -n "" | dmenu -p "NOT AN IMAGE" +    exit +} + +# Display clipboard max length + +selection="$(echo -e "primary\nclipboard\nswap" | dmenu -l 1 -g 3 -p "selection:")" +if [[ "${selection}" == "swap" ]] +then +    clipboard="$(xclip -o)" +    xclip -o | xclip -sel c +    echo -n "${clipboard}" | xclip -sel c +    exit +elif [[ "${selection}" == "" ]] +then +    exit 1 +fi +if "${selection}" == "primary" ]] +then +    selection2="clipboard" +else +    selection2="primary" +fi + + +clipboard="$(xclip -out -sel "${selection}" -r)" + +DICL_LEN=48 +if [[ "$(xclip -sel ${selection} -o | head -n1 | cut -c 2-4)" == "PNG" ]] +then +   disp_clip="IMAGE" +else +    disp_clip="$(echo -n "${clipboard}" | tr -d '\n' | cut -c -"${DICL_LEN}")" +fi + +menu_option="$(\ +    echo -e "save\nload\nimage\nreplace" \ +    | dmenu -l 1 -g 4 -p "'${disp_clip}'" \ +)" +[[ "${menu_option}" ]] || exit + +case "${menu_option}" in + +    replace) +        replace_text="$(echo -n "" | dmenu -l 0 -p "replace:")" +        [[ "${replace_text}" ]] || exit +        replace_by_text="$(echo -n "" | dmenu -l 0 -p "by:")" +        [[ "${replace_by_text}" ]] || exit  +        echo "${clipboard}" \ +            | sed "s/${replace_text}/${replace_by_text}/g" \ +            | xclip -r -sel "${selection}" +        ;; + +    save) +        echo "${clipboard}" >> /tmp/tmpclip.txt +        ;; +    load) +        choice="$(\ +            sort /tmp/tmpclip.txt \ +            | uniq \ +            | dmenu -g 1 -l 5 || exit \ +        )" +        echo -n "${choice}" | xclip -sel "${selection}" +        ;; + +    image) +        # Menu +        # 1: line from paragraph +        # 2: param  +        #  +        file_name="tmp_xclip" +        xclip -o -sel c > "/tmp/${file_name}.png" +        file "/tmp/${file_name}.png" \ +            | cut -d ':' -f 2 \ +            | grep "image" || NotImage +        # sed so that dmenu doesn't skip if one line +        tesseract "/tmp/${file_name}.png" stdout > "/tmp/${file_name}" +        sed "1i\ " "/tmp/${file_name}" | dmenu -l 10 -g 1 -p "PREVIEW:" -l 20 || exit +        xclip -sel "${selection}" -in "/tmp/${file_name}" +        ;; +esac diff --git a/bin/dmscripts/dmdsktp b/bin/dmscripts/dmdsktp new file mode 100755 index 0000000..2e0ef24 --- /dev/null +++ b/bin/dmscripts/dmdsktp @@ -0,0 +1,12 @@ +#!/bin/bash +# Searches through .desktop files and prompt to launch them via dmenu +gtk-launch \ +  "$(\ +  find ~/.local/share/applications \ +    -maxdepth 1 \ +    -type f \ +    -not -iname "wine-extension*" -a -iname "*.desktop" \ +    -printf "%f\n" \ +    | cut -d. -f1 \ +    | dmenu -i -p "app:" -g 1 \ +  )" diff --git a/bin/dmscripts/dmemoji b/bin/dmscripts/dmemoji new file mode 100755 index 0000000..6211463 --- /dev/null +++ b/bin/dmscripts/dmemoji @@ -0,0 +1,1423 @@ +#!/bin/bash +# This files comes from: +# https://github.com/porras/dmenu-emoji +# +# If this file includes emojis below "__DATA__" it is generated. +# This file was generated: 2022-04-21 12:38:03+00:00 + +set -e + +case "$1" in +  "list") +    data=$(sed '0,/^__DATA__$/d' "$0") +    echo "$data" +    ;; +  "copy") +    input=$(tee) +    if [ ! -z "$input" ]; then +      emoji=${input: -1} +      echo -n "$emoji" | xclip -selection c +      dunstify "dmemoji" "$emoji copied!" +    fi +    ;; +  "") +    bash $0 list | dmenu -p 'Emoji: ' | bash $0 copy +    ;; +esac + +exit + +__DATA__ +grinning face ๐ +grinning face with big eyes ๐ +grinning face with smiling eyes ๐ +beaming face with smiling eyes ๐ +grinning squinting face ๐ +grinning face with sweat ๐
 +rolling on the floor laughing ๐คฃ +face with tears of joy ๐ +slightly smiling face ๐ +upside-down face ๐ +melting face ๐ซ  +winking face ๐ +smiling face with smiling eyes ๐ +smiling face with halo ๐ +smiling face with hearts ๐ฅฐ +smiling face with heart-eyes ๐ +star-struck ๐คฉ +face blowing a kiss ๐ +kissing face ๐ +smiling face โบ +kissing face with closed eyes ๐ +kissing face with smiling eyes ๐ +smiling face with tear ๐ฅฒ +face savoring food ๐ +face with tongue ๐ +winking face with tongue ๐ +zany face ๐คช +squinting face with tongue ๐ +money-mouth face ๐ค +smiling face with open hands ๐ค +face with hand over mouth ๐คญ +face with open eyes and hand over mouth ๐ซข +face with peeking eye ๐ซฃ +shushing face ๐คซ +thinking face ๐ค +saluting face ๐ซก +zipper-mouth face ๐ค +face with raised eyebrow ๐คจ +neutral face ๐ +expressionless face ๐ +face without mouth ๐ถ +dotted line face ๐ซฅ +smirking face ๐ +unamused face ๐ +face with rolling eyes ๐ +grimacing face ๐ฌ +lying face ๐คฅ +relieved face ๐ +pensive face ๐ +sleepy face ๐ช +drooling face ๐คค +sleeping face ๐ด +face with medical mask ๐ท +face with thermometer ๐ค +face with head-bandage ๐ค +nauseated face ๐คข +face vomiting ๐คฎ +sneezing face ๐คง +hot face ๐ฅต +cold face ๐ฅถ +woozy face ๐ฅด +face with crossed-out eyes ๐ต +exploding head ๐คฏ +cowboy hat face ๐ค  +partying face ๐ฅณ +disguised face ๐ฅธ +smiling face with sunglasses ๐ +nerd face ๐ค +face with monocle ๐ง +confused face ๐ +face with diagonal mouth ๐ซค +worried face ๐ +slightly frowning face ๐ +frowning face โน +face with open mouth ๐ฎ +hushed face ๐ฏ +astonished face ๐ฒ +flushed face ๐ณ +pleading face ๐ฅบ +face holding back tears ๐ฅน +frowning face with open mouth ๐ฆ +anguished face ๐ง +fearful face ๐จ +anxious face with sweat ๐ฐ +sad but relieved face ๐ฅ +crying face ๐ข +loudly crying face ๐ญ +face screaming in fear ๐ฑ +confounded face ๐ +persevering face ๐ฃ +disappointed face ๐ +downcast face with sweat ๐ +weary face ๐ฉ +tired face ๐ซ +yawning face ๐ฅฑ +face with steam from nose ๐ค +pouting face ๐ก +angry face ๐  +face with symbols on mouth ๐คฌ +smiling face with horns ๐ +angry face with horns ๐ฟ +skull ๐ +skull and crossbones โ  +pile of poo ๐ฉ +clown face ๐คก +ogre ๐น +goblin ๐บ +ghost ๐ป +alien ๐ฝ +alien monster ๐พ +robot ๐ค +grinning cat ๐บ +grinning cat with smiling eyes ๐ธ +cat with tears of joy ๐น +smiling cat with heart-eyes ๐ป +cat with wry smile ๐ผ +kissing cat ๐ฝ +weary cat ๐ +crying cat ๐ฟ +pouting cat ๐พ +see-no-evil monkey ๐ +hear-no-evil monkey ๐ +speak-no-evil monkey ๐ +kiss mark ๐ +love letter ๐ +heart with arrow ๐ +heart with ribbon ๐ +sparkling heart ๐ +growing heart ๐ +beating heart ๐ +revolving hearts ๐ +two hearts ๐ +heart decoration ๐ +heart exclamation โฃ +broken heart ๐ +red heart โค +orange heart ๐งก +yellow heart ๐ +green heart ๐ +blue heart ๐ +purple heart ๐ +brown heart ๐ค +black heart ๐ค +white heart ๐ค +hundred points ๐ฏ +anger symbol ๐ข +collision ๐ฅ +dizzy ๐ซ +sweat droplets ๐ฆ +dashing away ๐จ +hole ๐ณ +bomb ๐ฃ +speech balloon ๐ฌ +left speech bubble ๐จ +right anger bubble ๐ฏ +thought balloon ๐ญ +zzz ๐ค +waving hand ๐ +raised back of hand ๐ค +hand with fingers splayed ๐ +raised hand โ +vulcan salute ๐ +rightwards hand ๐ซฑ +leftwards hand ๐ซฒ +palm down hand ๐ซณ +palm up hand ๐ซด +OK hand ๐ +pinched fingers ๐ค +pinching hand ๐ค +victory hand โ +crossed fingers ๐ค +hand with index finger and thumb crossed ๐ซฐ +love-you gesture ๐ค +sign of the horns ๐ค +call me hand ๐ค +backhand index pointing left ๐ +backhand index pointing right ๐ +backhand index pointing up ๐ +middle finger ๐ +backhand index pointing down ๐ +index pointing up โ +index pointing at the viewer ๐ซต +thumbs up ๐ +thumbs down ๐ +raised fist โ +oncoming fist ๐ +left-facing fist ๐ค +right-facing fist ๐ค +clapping hands ๐ +raising hands ๐ +heart hands ๐ซถ +open hands ๐ +palms up together ๐คฒ +handshake ๐ค +folded hands ๐ +writing hand โ +nail polish ๐
 +selfie ๐คณ +flexed biceps ๐ช +mechanical arm ๐ฆพ +mechanical leg ๐ฆฟ +leg ๐ฆต +foot ๐ฆถ +ear ๐ +ear with hearing aid ๐ฆป +nose ๐ +brain ๐ง  +anatomical heart ๐ซ +lungs ๐ซ +tooth ๐ฆท +bone ๐ฆด +eyes ๐ +eye ๐ +tongue ๐
 +mouth ๐ +biting lip ๐ซฆ +baby ๐ถ +child ๐ง +boy ๐ฆ +girl ๐ง +person ๐ง +person: blond hair ๐ฑ +man ๐จ +person: beard ๐ง +woman ๐ฉ +older person ๐ง +old man ๐ด +old woman ๐ต +person frowning ๐ +person pouting ๐ +person gesturing NO ๐
 +deaf person ๐ง +person bowing ๐ +person facepalming ๐คฆ +person shrugging ๐คท +police officer ๐ฎ +detective ๐ต +guard ๐ +ninja ๐ฅท +construction worker ๐ท +person with crown ๐ซ
 +prince ๐คด +princess ๐ธ +person wearing turban ๐ณ +person with skullcap ๐ฒ +woman with headscarf ๐ง +person in tuxedo ๐คต +person with veil ๐ฐ +pregnant woman ๐คฐ +pregnant man ๐ซ +pregnant person ๐ซ +breast-feeding ๐คฑ +baby angel ๐ผ +Santa Claus ๐
 +Mrs. Claus ๐คถ +superhero ๐ฆธ +supervillain ๐ฆน +mage ๐ง +fairy ๐ง +vampire ๐ง +merperson ๐ง +elf ๐ง +genie ๐ง +zombie ๐ง +troll ๐ง +person getting massage ๐ +person getting haircut ๐ +person walking ๐ถ +person standing ๐ง +person kneeling ๐ง +person running ๐ +woman dancing ๐ +man dancing ๐บ +person in suit levitating ๐ด +people with bunny ears ๐ฏ +person in steamy room ๐ง +person climbing ๐ง +person fencing ๐คบ +horse racing ๐ +skier โท +snowboarder ๐ +person golfing ๐ +person surfing ๐ +person rowing boat ๐ฃ +person swimming ๐ +person bouncing ball โน +person lifting weights ๐ +person biking ๐ด +person mountain biking ๐ต +person cartwheeling ๐คธ +people wrestling ๐คผ +person playing water polo ๐คฝ +person playing handball ๐คพ +person juggling ๐คน +person in lotus position ๐ง +person taking bath ๐ +person in bed ๐ +women holding hands ๐ญ +woman and man holding hands ๐ซ +men holding hands ๐ฌ +kiss ๐ +couple with heart ๐ +family ๐ช +speaking head ๐ฃ +bust in silhouette ๐ค +busts in silhouette ๐ฅ +people hugging ๐ซ +footprints ๐ฃ +red hair ๐ฆฐ +curly hair ๐ฆฑ +white hair ๐ฆณ +bald ๐ฆฒ +monkey face ๐ต +monkey ๐ +gorilla ๐ฆ +orangutan ๐ฆง +dog face ๐ถ +dog ๐ +guide dog ๐ฆฎ +poodle ๐ฉ +wolf ๐บ +fox ๐ฆ +raccoon ๐ฆ +cat face ๐ฑ +cat ๐ +lion ๐ฆ +tiger face ๐ฏ +tiger ๐
 +leopard ๐ +horse face ๐ด +horse ๐ +unicorn ๐ฆ +zebra ๐ฆ +deer ๐ฆ +bison ๐ฆฌ +cow face ๐ฎ +ox ๐ +water buffalo ๐ +cow ๐ +pig face ๐ท +pig ๐ +boar ๐ +pig nose ๐ฝ +ram ๐ +ewe ๐ +goat ๐ +camel ๐ช +two-hump camel ๐ซ +llama ๐ฆ +giraffe ๐ฆ +elephant ๐ +mammoth ๐ฆฃ +rhinoceros ๐ฆ +hippopotamus ๐ฆ +mouse face ๐ญ +mouse ๐ +rat ๐ +hamster ๐น +rabbit face ๐ฐ +rabbit ๐ +chipmunk ๐ฟ +beaver ๐ฆซ +hedgehog ๐ฆ +bat ๐ฆ +bear ๐ป +koala ๐จ +panda ๐ผ +sloth ๐ฆฅ +otter ๐ฆฆ +skunk ๐ฆจ +kangaroo ๐ฆ +badger ๐ฆก +paw prints ๐พ +turkey ๐ฆ +chicken ๐ +rooster ๐ +hatching chick ๐ฃ +baby chick ๐ค +front-facing baby chick ๐ฅ +bird ๐ฆ +penguin ๐ง +dove ๐ +eagle ๐ฆ
 +duck ๐ฆ +swan ๐ฆข +owl ๐ฆ +dodo ๐ฆค +feather ๐ชถ +flamingo ๐ฆฉ +peacock ๐ฆ +parrot ๐ฆ +frog ๐ธ +crocodile ๐ +turtle ๐ข +lizard ๐ฆ +snake ๐ +dragon face ๐ฒ +dragon ๐ +sauropod ๐ฆ +T-Rex ๐ฆ +spouting whale ๐ณ +whale ๐ +dolphin ๐ฌ +seal ๐ฆญ +fish ๐ +tropical fish ๐  +blowfish ๐ก +shark ๐ฆ +octopus ๐ +spiral shell ๐ +coral ๐ชธ +snail ๐ +butterfly ๐ฆ +bug ๐ +ant ๐ +honeybee ๐ +beetle ๐ชฒ +lady beetle ๐ +cricket ๐ฆ +cockroach ๐ชณ +spider ๐ท +spider web ๐ธ +scorpion ๐ฆ +mosquito ๐ฆ +fly ๐ชฐ +worm ๐ชฑ +microbe ๐ฆ  +bouquet ๐ +cherry blossom ๐ธ +white flower ๐ฎ +lotus ๐ชท +rosette ๐ต +rose ๐น +wilted flower ๐ฅ +hibiscus ๐บ +sunflower ๐ป +blossom ๐ผ +tulip ๐ท +seedling ๐ฑ +potted plant ๐ชด +evergreen tree ๐ฒ +deciduous tree ๐ณ +palm tree ๐ด +cactus ๐ต +sheaf of rice ๐พ +herb ๐ฟ +shamrock โ +four leaf clover ๐ +maple leaf ๐ +fallen leaf ๐ +leaf fluttering in wind ๐ +empty nest ๐ชน +nest with eggs ๐ชบ +grapes ๐ +melon ๐ +watermelon ๐ +tangerine ๐ +lemon ๐ +banana ๐ +pineapple ๐ +mango ๐ฅญ +red apple ๐ +green apple ๐ +pear ๐ +peach ๐ +cherries ๐ +strawberry ๐ +blueberries ๐ซ +kiwi fruit ๐ฅ +tomato ๐
 +olive ๐ซ +coconut ๐ฅฅ +avocado ๐ฅ +eggplant ๐ +potato ๐ฅ +carrot ๐ฅ +ear of corn ๐ฝ +hot pepper ๐ถ +bell pepper ๐ซ +cucumber ๐ฅ +leafy green ๐ฅฌ +broccoli ๐ฅฆ +garlic ๐ง +onion ๐ง
 +mushroom ๐ +peanuts ๐ฅ +beans ๐ซ +chestnut ๐ฐ +bread ๐ +croissant ๐ฅ +baguette bread ๐ฅ +flatbread ๐ซ +pretzel ๐ฅจ +bagel ๐ฅฏ +pancakes ๐ฅ +waffle ๐ง +cheese wedge ๐ง +meat on bone ๐ +poultry leg ๐ +cut of meat ๐ฅฉ +bacon ๐ฅ +hamburger ๐ +french fries ๐ +pizza ๐ +hot dog ๐ญ +sandwich ๐ฅช +taco ๐ฎ +burrito ๐ฏ +tamale ๐ซ +stuffed flatbread ๐ฅ +falafel ๐ง +egg ๐ฅ +cooking ๐ณ +shallow pan of food ๐ฅ +pot of food ๐ฒ +fondue ๐ซ +bowl with spoon ๐ฅฃ +green salad ๐ฅ +popcorn ๐ฟ +butter ๐ง +salt ๐ง +canned food ๐ฅซ +bento box ๐ฑ +rice cracker ๐ +rice ball ๐ +cooked rice ๐ +curry rice ๐ +steaming bowl ๐ +spaghetti ๐ +roasted sweet potato ๐  +oden ๐ข +sushi ๐ฃ +fried shrimp ๐ค +fish cake with swirl ๐ฅ +moon cake ๐ฅฎ +dango ๐ก +dumpling ๐ฅ +fortune cookie ๐ฅ  +takeout box ๐ฅก +crab ๐ฆ +lobster ๐ฆ +shrimp ๐ฆ +squid ๐ฆ +oyster ๐ฆช +soft ice cream ๐ฆ +shaved ice ๐ง +ice cream ๐จ +doughnut ๐ฉ +cookie ๐ช +birthday cake ๐ +shortcake ๐ฐ +cupcake ๐ง +pie ๐ฅง +chocolate bar ๐ซ +candy ๐ฌ +lollipop ๐ญ +custard ๐ฎ +honey pot ๐ฏ +baby bottle ๐ผ +glass of milk ๐ฅ +hot beverage โ +teapot ๐ซ +teacup without handle ๐ต +sake ๐ถ +bottle with popping cork ๐พ +wine glass ๐ท +cocktail glass ๐ธ +tropical drink ๐น +beer mug ๐บ +clinking beer mugs ๐ป +clinking glasses ๐ฅ +tumbler glass ๐ฅ +pouring liquid ๐ซ +cup with straw ๐ฅค +bubble tea ๐ง +beverage box ๐ง +mate ๐ง +ice ๐ง +chopsticks ๐ฅข +fork and knife with plate ๐ฝ +fork and knife ๐ด +spoon ๐ฅ +kitchen knife ๐ช +jar ๐ซ +amphora ๐บ +globe showing Europe-Africa ๐ +globe showing Americas ๐ +globe showing Asia-Australia ๐ +globe with meridians ๐ +world map ๐บ +map of Japan ๐พ +compass ๐งญ +snow-capped mountain ๐ +mountain โฐ +volcano ๐ +mount fuji ๐ป +camping ๐ +beach with umbrella ๐ +desert ๐ +desert island ๐ +national park ๐ +stadium ๐ +classical building ๐ +building construction ๐ +brick ๐งฑ +rock ๐ชจ +wood ๐ชต +hut ๐ +houses ๐ +derelict house ๐ +house ๐  +house with garden ๐ก +office building ๐ข +Japanese post office ๐ฃ +post office ๐ค +hospital ๐ฅ +bank ๐ฆ +hotel ๐จ +love hotel ๐ฉ +convenience store ๐ช +school ๐ซ +department store ๐ฌ +factory ๐ญ +Japanese castle ๐ฏ +castle ๐ฐ +wedding ๐ +Tokyo tower ๐ผ +Statue of Liberty ๐ฝ +church โช +mosque ๐ +hindu temple ๐ +synagogue ๐ +shinto shrine โฉ +kaaba ๐ +fountain โฒ +tent โบ +foggy ๐ +night with stars ๐ +cityscape ๐ +sunrise over mountains ๐ +sunrise ๐
 +cityscape at dusk ๐ +sunset ๐ +bridge at night ๐ +hot springs โจ +carousel horse ๐  +playground slide ๐ +ferris wheel ๐ก +roller coaster ๐ข +barber pole ๐ +circus tent ๐ช +locomotive ๐ +railway car ๐ +high-speed train ๐ +bullet train ๐
 +train ๐ +metro ๐ +light rail ๐ +station ๐ +tram ๐ +monorail ๐ +mountain railway ๐ +tram car ๐ +bus ๐ +oncoming bus ๐ +trolleybus ๐ +minibus ๐ +ambulance ๐ +fire engine ๐ +police car ๐ +oncoming police car ๐ +taxi ๐ +oncoming taxi ๐ +automobile ๐ +oncoming automobile ๐ +sport utility vehicle ๐ +pickup truck ๐ป +delivery truck ๐ +articulated lorry ๐ +tractor ๐ +racing car ๐ +motorcycle ๐ +motor scooter ๐ต +manual wheelchair ๐ฆฝ +motorized wheelchair ๐ฆผ +auto rickshaw ๐บ +bicycle ๐ฒ +kick scooter ๐ด +skateboard ๐น +roller skate ๐ผ +bus stop ๐ +motorway ๐ฃ +railway track ๐ค +oil drum ๐ข +fuel pump โฝ +wheel ๐ +police car light ๐จ +horizontal traffic light ๐ฅ +vertical traffic light ๐ฆ +stop sign ๐ +construction ๐ง +anchor โ +ring buoy ๐ +sailboat โต +canoe ๐ถ +speedboat ๐ค +passenger ship ๐ณ +ferry โด +motor boat ๐ฅ +ship ๐ข +airplane โ +small airplane ๐ฉ +airplane departure ๐ซ +airplane arrival ๐ฌ +parachute ๐ช +seat ๐บ +helicopter ๐ +suspension railway ๐ +mountain cableway ๐  +aerial tramway ๐ก +satellite ๐ฐ +rocket ๐ +flying saucer ๐ธ +bellhop bell ๐ +luggage ๐งณ +hourglass done โ +hourglass not done โณ +watch โ +alarm clock โฐ +stopwatch โฑ +timer clock โฒ +mantelpiece clock ๐ฐ +twelve oโclock ๐ +twelve-thirty ๐ง +one oโclock ๐ +one-thirty ๐ +two oโclock ๐ +two-thirty ๐ +three oโclock ๐ +three-thirty ๐ +four oโclock ๐ +four-thirty ๐ +five oโclock ๐ +five-thirty ๐  +six oโclock ๐ +six-thirty ๐ก +seven oโclock ๐ +seven-thirty ๐ข +eight oโclock ๐ +eight-thirty ๐ฃ +nine oโclock ๐ +nine-thirty ๐ค +ten oโclock ๐ +ten-thirty ๐ฅ +eleven oโclock ๐ +eleven-thirty ๐ฆ +new moon ๐ +waxing crescent moon ๐ +first quarter moon ๐ +waxing gibbous moon ๐ +full moon ๐ +waning gibbous moon ๐ +last quarter moon ๐ +waning crescent moon ๐ +crescent moon ๐ +new moon face ๐ +first quarter moon face ๐ +last quarter moon face ๐ +thermometer ๐ก +sun โ +full moon face ๐ +sun with face ๐ +ringed planet ๐ช +star โญ +glowing star ๐ +shooting star ๐  +milky way ๐ +cloud โ +sun behind cloud โ
 +cloud with lightning and rain โ +sun behind small cloud ๐ค +sun behind large cloud ๐ฅ +sun behind rain cloud ๐ฆ +cloud with rain ๐ง +cloud with snow ๐จ +cloud with lightning ๐ฉ +tornado ๐ช +fog ๐ซ +wind face ๐ฌ +cyclone ๐ +rainbow ๐ +closed umbrella ๐ +umbrella โ +umbrella with rain drops โ +umbrella on ground โฑ +high voltage โก +snowflake โ +snowman โ +snowman without snow โ +comet โ +fire ๐ฅ +droplet ๐ง +water wave ๐ +jack-o-lantern ๐ +Christmas tree ๐ +fireworks ๐ +sparkler ๐ +firecracker ๐งจ +sparkles โจ +balloon ๐ +party popper ๐ +confetti ball ๐ +tanabata tree ๐ +pine decoration ๐ +Japanese dolls ๐ +carp streamer ๐ +wind chime ๐ +moon viewing ceremony ๐ +red envelope ๐งง +ribbon ๐ +wrapped gift ๐ +reminder ribbon ๐ +admission tickets ๐ +ticket ๐ซ +military medal ๐ +trophy ๐ +sports medal ๐
 +1st place medal ๐ฅ +2nd place medal ๐ฅ +3rd place medal ๐ฅ +soccer ball โฝ +baseball โพ +softball ๐ฅ +basketball ๐ +volleyball ๐ +american football ๐ +rugby football ๐ +tennis ๐พ +flying disc ๐ฅ +bowling ๐ณ +cricket game ๐ +field hockey ๐ +ice hockey ๐ +lacrosse ๐ฅ +ping pong ๐ +badminton ๐ธ +boxing glove ๐ฅ +martial arts uniform ๐ฅ +goal net ๐ฅ
 +flag in hole โณ +ice skate โธ +fishing pole ๐ฃ +diving mask ๐คฟ +running shirt ๐ฝ +skis ๐ฟ +sled ๐ท +curling stone ๐ฅ +bullseye ๐ฏ +yo-yo ๐ช +kite ๐ช +pool 8 ball ๐ฑ +crystal ball ๐ฎ +magic wand ๐ช +nazar amulet ๐งฟ +hamsa ๐ชฌ +video game ๐ฎ +joystick ๐น +slot machine ๐ฐ +game die ๐ฒ +puzzle piece ๐งฉ +teddy bear ๐งธ +piรฑata ๐ช
 +mirror ball ๐ชฉ +nesting dolls ๐ช +spade suit โ  +heart suit โฅ +diamond suit โฆ +club suit โฃ +chess pawn โ +joker ๐ +mahjong red dragon ๐ +flower playing cards ๐ด +performing arts ๐ญ +framed picture ๐ผ +artist palette ๐จ +thread ๐งต +sewing needle ๐ชก +yarn ๐งถ +knot ๐ชข +glasses ๐ +sunglasses ๐ถ +goggles ๐ฅฝ +lab coat ๐ฅผ +safety vest ๐ฆบ +necktie ๐ +t-shirt ๐ +jeans ๐ +scarf ๐งฃ +gloves ๐งค +coat ๐งฅ +socks ๐งฆ +dress ๐ +kimono ๐ +sari ๐ฅป +one-piece swimsuit ๐ฉฑ +briefs ๐ฉฒ +shorts ๐ฉณ +bikini ๐ +womanโs clothes ๐ +purse ๐ +handbag ๐ +clutch bag ๐ +shopping bags ๐ +backpack ๐ +thong sandal ๐ฉด +manโs shoe ๐ +running shoe ๐ +hiking boot ๐ฅพ +flat shoe ๐ฅฟ +high-heeled shoe ๐  +womanโs sandal ๐ก +ballet shoes ๐ฉฐ +womanโs boot ๐ข +crown ๐ +womanโs hat ๐ +top hat ๐ฉ +graduation cap ๐ +billed cap ๐งข +military helmet ๐ช +rescue workerโs helmet โ +prayer beads ๐ฟ +lipstick ๐ +ring ๐ +gem stone ๐ +muted speaker ๐ +speaker low volume ๐ +speaker medium volume ๐ +speaker high volume ๐ +loudspeaker ๐ข +megaphone ๐ฃ +postal horn ๐ฏ +bell ๐ +bell with slash ๐ +musical score ๐ผ +musical note ๐ต +musical notes ๐ถ +studio microphone ๐ +level slider ๐ +control knobs ๐ +microphone ๐ค +headphone ๐ง +radio ๐ป +saxophone ๐ท +accordion ๐ช +guitar ๐ธ +musical keyboard ๐น +trumpet ๐บ +violin ๐ป +banjo ๐ช +drum ๐ฅ +long drum ๐ช +mobile phone ๐ฑ +mobile phone with arrow ๐ฒ +telephone โ +telephone receiver ๐ +pager ๐ +fax machine ๐  +battery ๐ +low battery ๐ชซ +electric plug ๐ +laptop ๐ป +desktop computer ๐ฅ +printer ๐จ +keyboard โจ +computer mouse ๐ฑ +trackball ๐ฒ +computer disk ๐ฝ +floppy disk ๐พ +optical disk ๐ฟ +dvd ๐ +abacus ๐งฎ +movie camera ๐ฅ +film frames ๐ +film projector ๐ฝ +clapper board ๐ฌ +television ๐บ +camera ๐ท +camera with flash ๐ธ +video camera ๐น +videocassette ๐ผ +magnifying glass tilted left ๐ +magnifying glass tilted right ๐ +candle ๐ฏ +light bulb ๐ก +flashlight ๐ฆ +red paper lantern ๐ฎ +diya lamp ๐ช +notebook with decorative cover ๐ +closed book ๐ +open book ๐ +green book ๐ +blue book ๐ +orange book ๐ +books ๐ +notebook ๐ +ledger ๐ +page with curl ๐ +scroll ๐ +page facing up ๐ +newspaper ๐ฐ +rolled-up newspaper ๐ +bookmark tabs ๐ +bookmark ๐ +label ๐ท +money bag ๐ฐ +coin ๐ช +yen banknote ๐ด +dollar banknote ๐ต +euro banknote ๐ถ +pound banknote ๐ท +money with wings ๐ธ +credit card ๐ณ +receipt ๐งพ +chart increasing with yen ๐น +envelope โ +e-mail ๐ง +incoming envelope ๐จ +envelope with arrow ๐ฉ +outbox tray ๐ค +inbox tray ๐ฅ +package ๐ฆ +closed mailbox with raised flag ๐ซ +closed mailbox with lowered flag ๐ช +open mailbox with raised flag ๐ฌ +open mailbox with lowered flag ๐ญ +postbox ๐ฎ +ballot box with ballot ๐ณ +pencil โ +black nib โ +fountain pen ๐ +pen ๐ +paintbrush ๐ +crayon ๐ +memo ๐ +briefcase ๐ผ +file folder ๐ +open file folder ๐ +card index dividers ๐ +calendar ๐
 +tear-off calendar ๐ +spiral notepad ๐ +spiral calendar ๐ +card index ๐ +chart increasing ๐ +chart decreasing ๐ +bar chart ๐ +clipboard ๐ +pushpin ๐ +round pushpin ๐ +paperclip ๐ +linked paperclips ๐ +straight ruler ๐ +triangular ruler ๐ +scissors โ +card file box ๐ +file cabinet ๐ +wastebasket ๐ +locked ๐ +unlocked ๐ +locked with pen ๐ +locked with key ๐ +key ๐ +old key ๐ +hammer ๐จ +axe ๐ช +pick โ +hammer and pick โ +hammer and wrench ๐  +dagger ๐ก +crossed swords โ +water pistol ๐ซ +boomerang ๐ช +bow and arrow ๐น +shield ๐ก +carpentry saw ๐ช +wrench ๐ง +screwdriver ๐ช +nut and bolt ๐ฉ +gear โ +clamp ๐ +balance scale โ +white cane ๐ฆฏ +link ๐ +chains โ +hook ๐ช +toolbox ๐งฐ +magnet ๐งฒ +ladder ๐ช +alembic โ +test tube ๐งช +petri dish ๐งซ +dna ๐งฌ +microscope ๐ฌ +telescope ๐ญ +satellite antenna ๐ก +syringe ๐ +drop of blood ๐ฉธ +pill ๐ +adhesive bandage ๐ฉน +crutch ๐ฉผ +stethoscope ๐ฉบ +x-ray ๐ฉป +door ๐ช +elevator ๐ +mirror ๐ช +window ๐ช +bed ๐ +couch and lamp ๐ +chair ๐ช +toilet ๐ฝ +plunger ๐ช  +shower ๐ฟ +bathtub ๐ +mouse trap ๐ชค +razor ๐ช +lotion bottle ๐งด +safety pin ๐งท +broom ๐งน +basket ๐งบ +roll of paper ๐งป +bucket ๐ชฃ +soap ๐งผ +bubbles ๐ซง +toothbrush ๐ชฅ +sponge ๐งฝ +fire extinguisher ๐งฏ +shopping cart ๐ +cigarette ๐ฌ +coffin โฐ +headstone ๐ชฆ +funeral urn โฑ +moai ๐ฟ +placard ๐ชง +identification card ๐ชช +ATM sign ๐ง +litter in bin sign ๐ฎ +potable water ๐ฐ +wheelchair symbol โฟ +menโs room ๐น +womenโs room ๐บ +restroom ๐ป +baby symbol ๐ผ +water closet ๐พ +passport control ๐ +customs ๐ +baggage claim ๐ +left luggage ๐
 +warning โ  +children crossing ๐ธ +no entry โ +prohibited ๐ซ +no bicycles ๐ณ +no smoking ๐ญ +no littering ๐ฏ +non-potable water ๐ฑ +no pedestrians ๐ท +no mobile phones ๐ต +no one under eighteen ๐ +radioactive โข +biohazard โฃ +up arrow โฌ +up-right arrow โ +right arrow โก +down-right arrow โ +down arrow โฌ +down-left arrow โ +left arrow โฌ
 +up-left arrow โ +up-down arrow โ +left-right arrow โ +right arrow curving left โฉ +left arrow curving right โช +right arrow curving up โคด +right arrow curving down โคต +clockwise vertical arrows ๐ +counterclockwise arrows button ๐ +BACK arrow ๐ +END arrow ๐ +ON! arrow ๐ +SOON arrow ๐ +TOP arrow ๐ +place of worship ๐ +atom symbol โ +om ๐ +star of David โก +wheel of dharma โธ +yin yang โฏ +latin cross โ +orthodox cross โฆ +star and crescent โช +peace symbol โฎ +menorah ๐ +dotted six-pointed star ๐ฏ +Aries โ +Taurus โ +Gemini โ +Cancer โ +Leo โ +Virgo โ +Libra โ +Scorpio โ +Sagittarius โ +Capricorn โ +Aquarius โ +Pisces โ +Ophiuchus โ +shuffle tracks button ๐ +repeat button ๐ +repeat single button ๐ +play button โถ +fast-forward button โฉ +next track button โญ +play or pause button โฏ +reverse button โ +fast reverse button โช +last track button โฎ +upwards button ๐ผ +fast up button โซ +downwards button ๐ฝ +fast down button โฌ +pause button โธ +stop button โน +record button โบ +eject button โ +cinema ๐ฆ +dim button ๐
 +bright button ๐ +antenna bars ๐ถ +vibration mode ๐ณ +mobile phone off ๐ด +female sign โ +male sign โ +transgender symbol โง +multiply โ +plus โ +minus โ +divide โ +heavy equals sign ๐ฐ +infinity โพ +double exclamation mark โผ +exclamation question mark โ +red question mark โ +white question mark โ +white exclamation mark โ +red exclamation mark โ +wavy dash ใฐ +currency exchange ๐ฑ +heavy dollar sign ๐ฒ +medical symbol โ +recycling symbol โป +fleur-de-lis โ +trident emblem ๐ฑ +name badge ๐ +Japanese symbol for beginner ๐ฐ +hollow red circle โญ +check mark button โ
 +check box with check โ +check mark โ +cross mark โ +cross mark button โ +curly loop โฐ +double curly loop โฟ +part alternation mark ใฝ +eight-spoked asterisk โณ +eight-pointed star โด +sparkle โ +copyright ยฉ +registered ยฎ +trade mark โข +keycap: # #๏ธโฃ +keycap: * *๏ธโฃ +keycap: 0 0๏ธโฃ +keycap: 1 1๏ธโฃ +keycap: 2 2๏ธโฃ +keycap: 3 3๏ธโฃ +keycap: 4 4๏ธโฃ +keycap: 5 5๏ธโฃ +keycap: 6 6๏ธโฃ +keycap: 7 7๏ธโฃ +keycap: 8 8๏ธโฃ +keycap: 9 9๏ธโฃ +keycap: 10 ๐ +input latin uppercase ๐  +input latin lowercase ๐ก +input numbers ๐ข +input symbols ๐ฃ +input latin letters ๐ค +A button (blood type) ๐
ฐ +AB button (blood type) ๐ +B button (blood type) ๐
ฑ +CL button ๐ +COOL button ๐ +FREE button ๐ +information โน +ID button ๐ +circled M โ +NEW button ๐ +NG button ๐ +O button (blood type) ๐
พ +OK button ๐ +P button ๐
ฟ +SOS button ๐ +UP! button ๐ +VS button ๐ +Japanese โhereโ button ๐ +Japanese โservice chargeโ button ๐ +Japanese โmonthly amountโ button ๐ท +Japanese โnot free of chargeโ button ๐ถ +Japanese โreservedโ button ๐ฏ +Japanese โbargainโ button ๐ +Japanese โdiscountโ button ๐น +Japanese โfree of chargeโ button ๐ +Japanese โprohibitedโ button ๐ฒ +Japanese โacceptableโ button ๐ +Japanese โapplicationโ button ๐ธ +Japanese โpassing gradeโ button ๐ด +Japanese โvacancyโ button ๐ณ +Japanese โcongratulationsโ button ใ +Japanese โsecretโ button ใ +Japanese โopen for businessโ button ๐บ +Japanese โno vacancyโ button ๐ต +red circle ๐ด +orange circle ๐  +yellow circle ๐ก +green circle ๐ข +blue circle ๐ต +purple circle ๐ฃ +brown circle ๐ค +black circle โซ +white circle โช +red square ๐ฅ +orange square ๐ง +yellow square ๐จ +green square ๐ฉ +blue square ๐ฆ +purple square ๐ช +brown square ๐ซ +black large square โฌ +white large square โฌ +black medium square โผ +white medium square โป +black medium-small square โพ +white medium-small square โฝ +black small square โช +white small square โซ +large orange diamond ๐ถ +large blue diamond ๐ท +small orange diamond ๐ธ +small blue diamond ๐น +red triangle pointed up ๐บ +red triangle pointed down ๐ป +diamond with a dot ๐  +radio button ๐ +white square button ๐ณ +black square button ๐ฒ +chequered flag ๐ +triangular flag ๐ฉ +crossed flags ๐ +black flag ๐ด +white flag ๐ณ +letter a ๐ฆ +letter b ๐ง +letter c ๐จ +letter d ๐ฉ +letter e ๐ช +letter f ๐ซ +letter g ๐ฌ +letter h ๐ญ +letter i ๐ฎ +letter j ๐ฏ +letter k ๐ฐ +letter l ๐ฑ +letter m ๐ฒ +letter n ๐ณ +letter o ๐ด +letter p ๐ต +letter r ๐ท +letter s ๐ธ +letter t ๐น +letter u ๐บ +letter v ๐ป +letter y ๐พ +letter z ๐ฟ diff --git a/bin/dmscripts/dmfm b/bin/dmscripts/dmfm new file mode 100755 index 0000000..34a9e2c --- /dev/null +++ b/bin/dmscripts/dmfm @@ -0,0 +1,17 @@ +#!/bin/bash + +file=1 +while [ "$file" ]; do +	file=$(ls -1 --group-directories-first | dmenu -i -l 8 -g 1 -p "$(basename $(pwd)):") +	if [ -e "$file" ]; then +		owd=$(pwd) +		if [ -d "$file" ]; then +			cd "$file" +		else [ -f "$file" ] +			if which xdg-open &> /dev/null; then +				exec xdg-open "$owd/$file" & +				unset file +			fi +		fi +	fi +done diff --git a/bin/dmscripts/dmhelp b/bin/dmscripts/dmhelp new file mode 100755 index 0000000..653fa1f --- /dev/null +++ b/bin/dmscripts/dmhelp @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +program="${1:-$(dmenu_path | dmenu -l 4 -g 5)}" +opfil="/tmp/dmh_options.txt" +test -z "${program}" && exit 1 + +if ${program} --help > "${opfil}" +then +    option="$(\ +        grep -E "^ *-[-a-Z]* " "${opfil}" \ +            | tr -s ' ' \ +            | sort | uniq \ +            | column -l 2 -t \ +            | dmenu -x -l 20 -g 1 -p "${program}" \ +            | awk '{print $1}' \ +    )" +elif man $program > "${opfil}" +then +    echo lesgo +else +    echo "No options found for '${program}'" > /dev/stderr +    exit 1 +fi +test -z "${option}" && exit 1 + +rm -f "${opfil}" +${program} ${option} diff --git a/bin/dmscripts/dminw b/bin/dmscripts/dminw new file mode 100755 index 0000000..2ff32a1 --- /dev/null +++ b/bin/dmscripts/dminw @@ -0,0 +1,4 @@ +#!/bin/bash +WINDOWID=${1:-$(xdotool getwindowfocus)} +WIDTH=$(xdotool getwindowgeometry -s ${WINDOWID} | grep WIDTH | cut -d ' ' -f 2) +dmenu_run -w ${1:-$(xdotool getwindowfocus)} -z ${WIDTH} diff --git a/bin/dmscripts/dmlang b/bin/dmscripts/dmlang new file mode 100755 index 0000000..0009704 --- /dev/null +++ b/bin/dmscripts/dmlang @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +choice="$(\ +    echo -e "us\ngb\nbe" \ +        | dmenu \ +        -p "($(setxkbmap -query | awk 'NR==3 {print $2}'))" \ +)" +setxkbmap "${choice:-us}" diff --git a/bin/dmscripts/dmpass b/bin/dmscripts/dmpass new file mode 100755 index 0000000..2af798b --- /dev/null +++ b/bin/dmscripts/dmpass @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +store="$HOME/.password-store" +lscmd="ls --group-directories-first" +dmenucmd="dmenu -l 4 -g 2" +while [ -d "${store}/${file}" ] +do +	choice="$($lscmd "${store}/${file}" | awk -F'.gpg' '{print $1}' | $dmenucmd)" +	[ "$choice" ] || break +	file="${file}/${choice}" +done +pass show -c "${file}"  diff --git a/bin/dmscripts/dmpassgen b/bin/dmscripts/dmpassgen new file mode 100755 index 0000000..c627a1d --- /dev/null +++ b/bin/dmscripts/dmpassgen @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +choice="$(echo -ne "multiline\nsingle" | dmenu -l 1 -g 2)" +test -z "${choice}" && exit 1 + +password="$(echo -n "" | dmenu -p "name:")" +test -z "${password}" && exit 1 + +if [[ "${choice}" == "multiline" ]] +then +	logins="$(ls -1 ~/.password-store/e-mails | awk -F '.gpg' '{print $1}')" +    login="$(echo "$logins" | dmenu -g 1 -l 8 -p "login:")" +    test -z "${login}" && exit 1 +    url="$(echo -n "" | dmenu -p "url:")" +    test -z "${url}" && exit 1 +    echo -e "${password}\nlogin: ${login}\nurl: ${url}" | pass insert -mf "${password}" +    pass generate -ci "${password}" +else +    pass generate -cf "${password}" +fi + diff --git a/bin/dmscripts/dmpdf b/bin/dmscripts/dmpdf new file mode 100755 index 0000000..6137e1a --- /dev/null +++ b/bin/dmscripts/dmpdf @@ -0,0 +1,21 @@ +#!/bin/bash +directory="${1:-$PWD}" +choice="$(\ +    find "${directory}" \ +        -type f \ +        -iname "*.pdf" \ +        -printf "%p\n" \ +        | awk -F '/' '{print $(NF - 1) "/" $NF}' \ +    | sort \ +    | uniq \ +    | dmenu -i -x -p "pdf:" -l 10 -g 2 \ +    | awk -F '/' '{print $2}' \ +)" + +# find matching file +file="$(\ +  find "$directory" -name "*$choice*" \ +)" + +[[ -f "$file" ]] || exit 1 +evince "$file" & diff --git a/bin/dmscripts/dmpower b/bin/dmscripts/dmpower new file mode 100755 index 0000000..bd847d6 --- /dev/null +++ b/bin/dmscripts/dmpower @@ -0,0 +1,3 @@ +#!/bin/sh +choice="$(echo -e "poweroff\nreboot\nhibernate" | dmenu -l 1 -g 3)" +test -z "$choice" || systemctl "$choice" diff --git a/bin/dmscripts/dmpsbm b/bin/dmscripts/dmpsbm new file mode 100755 index 0000000..3b00b2c --- /dev/null +++ b/bin/dmscripts/dmpsbm @@ -0,0 +1,2 @@ +#!/bin/sh +grep -v '^#' ~/.local/share/bookmarks | dmenu -c -x -g 1 -l 10 | cut -f1 -d' ' | xclip -sel c && xdotool key Ctrl+Shift+v diff --git a/bin/dmscripts/dmpsclip b/bin/dmscripts/dmpsclip new file mode 100755 index 0000000..8577e91 --- /dev/null +++ b/bin/dmscripts/dmpsclip @@ -0,0 +1,3 @@ +#!/bin/sh +dmenu -l 10 -g 1 -c -x < /tmp/tmpclip.txt | xclip -sel c  +xdotool key Ctrl+Shift+v diff --git a/bin/dmscripts/dmvid b/bin/dmscripts/dmvid new file mode 100755 index 0000000..08dbb6b --- /dev/null +++ b/bin/dmscripts/dmvid @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +find ${1:-~/movies ~/Downloads} 2> /dev/null | grep -E ".+\.(webm|mp4|mpeg|mkv)$" | sort > /tmp/dmvids +choice="$(\ +        sed 's|^/home/aluc|\~| ; s|\([^/]\)[^/]*/|\1/|g' /tmp/dmvids \ +        | tr '\n' '\0' \ +        | xargs -0 -I {} echo "๏ฝ {}" \ +        | tr '\0' '\n' \ +		| awk '{printf "%-3s %s\n", NR ":", $0}' \ +        | dmenu -l 10 -g 1 -x -i \ +		| grep -zoE "^[0-9]+:" \ +)" +if [ -z "$choice" ]; then +	exit +fi +vid="$(sed -n "${choice::-1}p" /tmp/dmvids)" +mpv "$vid" diff --git a/bin/dmscripts/dmyt-not b/bin/dmscripts/dmyt-not new file mode 100755 index 0000000..4783a8d --- /dev/null +++ b/bin/dmscripts/dmyt-not @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +# Open a video from channels.yt-not by selecting the channel +channel="$(awk '{print $2}' ~/.local/share/yt-not/channels.yt-not | dmenu -l 2 -g 4)" +video_id="$(awk "/$channel/ {print \$3}" ~/.local/share/yt-not/channels.yt-not )" +video="https://youtube.com/watch?v=${video_id}" +mpv $video diff --git a/bin/extra/arr_hjkl b/bin/extra/arr_hjkl new file mode 100755 index 0000000..0ef542e --- /dev/null +++ b/bin/extra/arr_hjkl @@ -0,0 +1,17 @@ +#!/bin/bash + +if [ "$(xmodmap -pke | grep ' = h')" ] +then +  xmodmap -e 'keycode 43 = Left' +  xmodmap -e 'keycode 44 = Down Return' +  xmodmap -e 'keycode 45 = Up' +  xmodmap -e 'keycode 46 = Right' +  dunstify "arr hjkl" "arrows <b>on</b>" +else +  export ARRKEYMODE="hjkl" +  xmodmap -e 'keycode 43 = h' +  xmodmap -e 'keycode 44 = j' +  xmodmap -e 'keycode 45 = k' +  xmodmap -e 'keycode 46 = l' +  dunstify "arr hjkl" "arrows <b>off</b>" +fi diff --git a/bin/extra/cht.sh b/bin/extra/cht.sh new file mode 100755 index 0000000..7cd4892 --- /dev/null +++ b/bin/extra/cht.sh @@ -0,0 +1,796 @@ +#!/bin/bash +# shellcheck disable=SC1117,SC2001 +# +# [X] open section +# [X] one shot mode +# [X] usage info +# [X] dependencies check +# [X] help +# [X] yank/y/copy/c +# [X] Y/C +# [X] eof problem +# [X] more +# [X] stealth mode +# +# here are several examples for the stealth mode: +# +# zip lists +# list permutation +# random list element +# reverse a list +# read json from file +# append string to a file +# run process in background +# count words in text counter +# group elements list + +__CHTSH_VERSION=0.0.4 +__CHTSH_DATETIME="2021-04-25 12:30:30 +0200" + +# cht.sh configuration loading +# +# configuration is stored in ~/.cht.sh/ (can be overridden with CHTSH env var.) +# +CHTSH_HOME=${CHTSH:-"$HOME"/.cht.sh} +[ -z "$CHTSH_CONF" ] && CHTSH_CONF=$CHTSH_HOME/cht.sh.conf +# shellcheck disable=SC1090,SC2002 +[ -e "$CHTSH_CONF" ] && source "$CHTSH_CONF" +[ -z "$CHTSH_URL" ] && CHTSH_URL=https://cht.sh + +# currently we support only two modes: +# * lite = access the server using curl +# * auto = try standalone usage first +CHTSH_MODE="$(cat "$CHTSH_HOME"/mode 2> /dev/null)" +[ "$CHTSH_MODE" != lite ] && CHTSH_MODE=auto +CHEATSH_INSTALLATION="$(cat "$CHTSH_HOME/standalone" 2> /dev/null)" + + +export LESSSECURE=1 +STEALTH_MAX_SELECTION_LENGTH=5 + +case "$(uname -s)" in +  Darwin) is_macos=yes ;; +  *) is_macos=no ;; +esac + +# for KSH93 +# shellcheck disable=SC2034,SC2039,SC2168 +if echo "$KSH_VERSION" | grep -q ' 93' && ! local foo 2>/dev/null; then +  alias local=typeset +fi + +fatal() +{ +  echo "ERROR: $*" >&2 +  exit 1 +} + +_say_what_i_do() +{ +  [ -n "$LOG" ] && echo "$(date '+[%Y-%m-%d %H:%M%S]') $*" >> "$LOG" + +  local this_prompt="\033[0;1;4;32m>>\033[0m" +  printf "\n${this_prompt}%s\033[0m\n" " $* " +} + +cheatsh_standalone_install() +{ +  # the function installs cheat.sh with the upstream repositories +  # in the standalone mode +  local installdir; installdir="$1" +  local default_installdir="$HOME/.cheat.sh" + +  [ -z "$installdir" ] && installdir=${default_installdir} + +  if [ "$installdir" = help ]; then +    cat <<EOF +Install cheat.sh in the standalone mode. + +After the installation, cheat.sh can be used locally, without accessing +the public cheat.sh service, or it can be used in the server mode, +where the newly installed server could be accessed by external clients +in the same fashion as the public cheat.sh server. + +During the installation, cheat.sh code as well as the cheat.sh upstream +cheat sheets repositories will be fetched. + +It takes approximately 1G of the disk space. + +Default installation location:  ~/.cheat.sh/ +It can be overridden by a command line parameter to this script: + +    ${0##*/} --standalone-install DIR + +See cheat.sh/:standalone or https://github.com/chubin/cheat.sh/README.md +for more information: + +    cht.sh :standalone +    curl cheat.sh/:standalone + +After the installation is finished, the cht.sh shell client is switched +to the auto mode, where it uses the local cheat.sh installation if possible. +You can switch the mode with the --mode switch: + +    cht.sh --mode lite      # use https://cheat.sh/ only +    cht.sh --mode auto      # use local installation + +For intallation and standalone usage, you need \`git\`, \`python\`, +and \`virtualenv\` to be installed locally. +EOF +    return +  fi + +  local _exit_code=0 + +  local dependencies=(python git virtualenv) +  for dep in "${dependencies[@]}"; do +    command -v "$dep" >/dev/null || \ +    { echo "DEPENDENCY: \"$dep\" is needed to install cheat.sh in the standalone mode" >&2; _exit_code=1; } +  done +  [ "$_exit_code" -ne 0 ] && return "$_exit_code" + +  while true; do +    local _installdir +    echo -n "Where should cheat.sh be installed [$installdir]? "; read -r _installdir +    [ -n "$_installdir" ] && installdir=$_installdir + +    if [ "$installdir" = y ] \ +        || [ "$installdir" = Y ] \ +        || [ "$(echo "$installdir" | tr "[:upper:]" "[:lower:]")" = yes ] +    then +      echo Please enter the directory name +      echo If it was the directory name already, please prepend it with \"./\": "./$installdir" +    else +      break +    fi +  done + +  if [ -e "$installdir" ]; then +    echo "ERROR: Installation directory [$installdir] exists already" +    echo "Please remove it first before continuing" +    return 1 +  fi + +  if ! mkdir -p "$installdir"; then +    echo "ERROR: Could not create the installation directory \"$installdir\"" +    echo "ERROR: Please check the permissions and start the script again" +    return 1 +  fi + +  local space_needed=700 +  local space_available; space_available=$(($(df -k "$installdir" | awk '{print $4}' | tail -1)/1024)) + +  if [ "$space_available" -lt "$space_needed" ]; then +    echo "ERROR: Installation directory has no enough space (needed: ${space_needed}M, available: ${space_available}M" +    echo "ERROR: Please clean up and start the script again" +    rmdir "$installdir" +    return 1 +  fi + +  _say_what_i_do Cloning cheat.sh locally +  local url=https://github.com/chubin/cheat.sh +  rmdir "$installdir" +  git clone "$url" "$installdir" || fatal Could not clone "$url" with git into "$installdir" +  cd "$installdir" || fatal "Cannot cd into $installdir" + +  # after the repository cloned, we may have the log directory +  # and we can write our installation log into it +  mkdir -p "log/" +  LOG="$PWD/log/install.log" + +  # we use tee everywhere so we should set -o pipefail +  set -o pipefail + +  # currently the script uses python 2, +  # but cheat.sh supports python 3 too +  # if you want to switch it to python 3 +  # set PYTHON2 to NO: +  # PYTHON2=NO +  # +  PYTHON2=NO +  if [[ $PYTHON2 = YES ]]; then +    python="python2" +    pip="pip" +    virtualenv_python3_option=() +  else +    python="python3" +    pip="pip3" +    virtualenv_python3_option=(-p python3) +  fi + +  _say_what_i_do Creating virtual environment +  virtualenv "${virtualenv_python3_option[@]}" ve \ +      || fatal "Could not create virtual environment with 'virtualenv ve'" + +  export CHEATSH_PATH_WORKDIR=$PWD + +  # rapidfuzz does not support Python 2, +  # so if we are using Python 2, install fuzzywuzzy instead +  if [[ $PYTHON2 = YES ]]; then +    sed -i s/rapidfuzz/fuzzywuzzy/ requirements.txt +    echo "python-Levenshtein" >> requirements.txt +  fi + +  _say_what_i_do Installing python requirements into the virtual environment +  ve/bin/"$pip" install -r requirements.txt > "$LOG" \ +      || { + +    echo "ERROR:" +    echo "---" +    tail -n 10 "$LOG" +    echo "---" +    echo "See $LOG for more" +    fatal Could not install python dependencies into the virtual environment +  } +  echo "$(ve/bin/"$pip" freeze | wc -l) dependencies were successfully installed" + +  _say_what_i_do Fetching the upstream cheat sheets repositories +  ve/bin/python lib/fetch.py fetch-all | tee -a "$LOG" + +  _say_what_i_do Running self-tests +  ( +    cd tests || exit + +    if CHEATSH_TEST_STANDALONE=YES \ +       CHEATSH_TEST_SKIP_ONLINE=NO \ +       CHEATSH_TEST_SHOW_DETAILS=NO \ +       PYTHON=../ve/bin/python bash run-tests.sh | tee -a "$LOG" +    then +      printf "\033[0;32m%s\033[0m\n" "SUCCESS" +    else +      printf "\033[0;31m%s\033[0m\n" "FAILED" +      echo "Some tests were failed. Run the tests manually for further investigation:" +      echo "  cd $PWD; bash run-tests.sh)" +    fi +  ) + +  mkdir -p "$CHTSH_HOME" +  echo "$installdir" > "$CHTSH_HOME/standalone" +  echo auto > "$CHTSH_HOME/mode" + +  _say_what_i_do Done + +  local v1; v1=$(printf "\033[0;1;32m") +  local v2; v2=$(printf "\033[0m") + +  cat <<EOF | sed "s/{/$v1/; s/}/$v2/" + +{      _      } +{     \\ \\   }     The installation is successfully finished. +{      \\ \\  } +{      / /    }   Now you can use cheat.sh in the standalone mode, +{     /_/     }   or you can start your own cheat.sh server. + + +Now the cht.sh shell client is switched to the auto mode, where it uses +the local cheat.sh installation if possible. +You can switch the mode with the --mode switch: + +    cht.sh --mode lite      # use https://cheat.sh/ only +    cht.sh --mode auto      # use local installation + +You can add your own cheat sheets repository (config is in \`etc/config.yaml\`), +or create new cheat sheets adapters (in \`lib/adapters\`). + +To update local copies of cheat sheets repositores on a regular basis, +add the following line to your user crontab (crontab -e): + +    10 * * * * $installdir/ve/bin/python $installdir/lib/fetch.py update-all + +All cheat sheets will be automatically actualized each hour. + +If you are running a server reachable from the Internet, it can be instantly +notified via a HTTP request about any cheat sheets changes. For that, please +open an issue on the cheat.sh project repository [github.com/chubin/cheat.sh] +with the ENTRY-POINT from the URL https://ENTRY-POINT/:actualize specified +EOF +} + +chtsh_mode() +{ +  local mode="$1" + +  local text; text=$( +    echo "  auto    use the standalone installation first" +    echo "  lite    use the cheat sheets server directly" +  ) + +  if [ -z "$mode" ]; then +    echo "current mode: $CHTSH_MODE ($(printf "%s" "$text" | grep "$CHTSH_MODE" | sed "s/$CHTSH_MODE//; s/^ *//; s/ \+/ /"))" +    if [ -d "$CHEATSH_INSTALLATION" ]; then +      echo "cheat.sh standalone installation: $CHEATSH_INSTALLATION" +    else +      echo 'cheat.sh standalone installation not found; falling back to the "lite" mode' +    fi +  elif [ "$mode" = auto ] || [ "$mode" = lite ]; then +    if [ "$mode" = "$CHTSH_MODE" ]; then +      echo "The configured mode was \"$CHTSH_MODE\"; nothing changed" +    else +      mkdir -p "$CHTSH_HOME" +      echo "$mode" > "$CHTSH_HOME/mode" +      echo "Configured mode: $mode" +    fi +  else +    echo "Unknown mode: $mode" +    echo Supported modes: +    echo "  auto    use the standalone installation first" +    echo "  lite    use the cheat sheets server directly" +  fi +} + +get_query_options() +{ +  local query="$*" +  if [ -n "$CHTSH_QUERY_OPTIONS" ]; then +    case $query in +      *\?*)   query="$query&${CHTSH_QUERY_OPTIONS}";; +      *)      query="$query?${CHTSH_QUERY_OPTIONS}";; +    esac +  fi +  printf "%s" "$query" +} + +do_query() +{ +  local query="$*" +  local b_opts= +  local uri="${CHTSH_URL}/\"\$(get_query_options $query)\"" + +  if [ -e "$CHTSH_HOME/id" ]; then +    b_opts="-b \"\$CHTSH_HOME/id\"" +  fi + +  eval curl "$b_opts" -s "$uri" > "$TMP1" + +  if [ -z "$lines" ] || [ "$(wc -l "$TMP1" | awk '{print $1}')" -lt "$lines" ]; then +    cat "$TMP1" +  else +    ${PAGER:-$defpager} "$TMP1" +  fi +} + +prepare_query() +{ +  local section="$1"; shift +  local input="$1"; shift +  local arguments="$1" + +  local query +  if [ -z "$section" ] || [ x"${input}" != x"${input#/}" ]; then +    query=$(printf %s "$input" | sed 's@ @/@; s@ @+@g') +  else +    query=$(printf %s "$section/$input" | sed 's@ @+@g') +  fi + +  [ -n "$arguments" ] && arguments="?$arguments" +  printf %s "$query$arguments" +} + +get_list_of_sections() +{ +  curl -s "${CHTSH_URL}"/:list | grep -v '/.*/' | grep '/$' | xargs +} + +gen_random_str() +( +  len=$1 +  if command -v openssl >/dev/null; then +    openssl rand -base64 $((len*3/4)) | awk -v ORS='' // +  else +    rdev=/dev/urandom +    for d in /dev/{srandom,random,arandom}; do +      test -r "$d" && rdev=$d +    done +    if command -v hexdump >/dev/null; then +      hexdump -vn $((len/2)) -e '1/1 "%02X" 1 ""' "$rdev" +    elif command -v xxd >/dev/null; then +      xxd -l $((len/2)) -ps "$rdev" | awk -v ORS='' // +    else +      cd /tmp || { echo Cannot cd into /tmp >&2; exit 1; } +      s= +      # shellcheck disable=SC2000 +      while [ "$(echo "$s" | wc -c)" -lt "$len" ]; do +        s="$s$(mktemp -u XXXXXXXXXX)" +      done +      printf "%.${len}s" "$s" +    fi +  fi +) + +if [ "$CHTSH_MODE" = auto ] && [ -d "$CHEATSH_INSTALLATION" ]; then +  curl() { +    # ignoring all options +    # currently the standalone.py does not support them anyway +    local opt +    while getopts "b:s" opt; do +      : +    done +    shift $((OPTIND - 1)) + +    local url; url="$1"; shift +    PYTHONIOENCODING=UTF-8 "$CHEATSH_INSTALLATION/ve/bin/python" "$CHEATSH_INSTALLATION/lib/standalone.py" "${url#"$CHTSH_URL"}" "$@" +  } +elif [ "$(uname -s)" = OpenBSD ] && [ -x /usr/bin/ftp ]; then +  # any better test not involving either OS matching or actual query? +  curl() { +    local opt args="-o -" +    while getopts "b:s" opt; do +      case $opt in +        b) args="$args -c $OPTARG";; +        s) args="$args -M -V";; +        *) echo "internal error: unsupported cURL option '$opt'" >&2; exit 1;; +      esac +    done +    shift $((OPTIND - 1)) +    /usr/bin/ftp "$args" "$@" +  } +else +  command -v curl   >/dev/null || { echo 'DEPENDENCY: install "curl" to use cht.sh' >&2; exit 1; } +  _CURL=$(command -v curl) +  if [ x"$CHTSH_CURL_OPTIONS" != x ]; then +    curl() { +      $_CURL "${CHTSH_CURL_OPTIONS}" "$@" +    } +  fi +fi + +if [ "$1" = --read ]; then +  read -r a || a="exit" +  printf "%s\n" "$a" +  exit 0 +elif [ x"$1" = x--help ] || [ -z "$1" ]; then + +  n=${0##*/} +  s=$(echo "$n" | sed "s/./ /"g) + +  cat <<EOF +Usage: + +    $n [OPTIONS|QUERY] + +Options: + +    QUERY                   process QUERY and exit + +    --help                  show this help +    --shell [LANG]          shell mode (open LANG if specified) + +    --standalone-install [DIR|help] +                            install cheat.sh in the standalone mode +                            (by default, into ~/.cheat.sh/) + +    --mode [auto|lite]      set (or display) mode of operation +                            * auto - prefer the local installation +                            * lite - use the cheat sheet server + +EOF +  exit 0 +elif [ x"$1" = x--shell ]; then +  shell_mode=yes +  shift +elif [ x"$1" = x--standalone-install ]; then +  shift +  cheatsh_standalone_install "$@" +  exit "$?" +elif [ x"$1" = x--mode ]; then +  shift +  chtsh_mode "$@" +  exit "$?" +fi + +prompt="cht.sh" +opts="" +input="" +for o; do +  if [ x"$o" != x"${o#-}" ]; then +    opts="${opts}${o#-}" +  else +    input="$input $o" +  fi +done +query=$(echo "$input" | sed 's@ *$@@; s@^ *@@; s@ @/@; s@ @+@g') + +if [ "$shell_mode" != yes ]; then +  curl -s "${CHTSH_URL}"/"$(get_query_options "$query")" +  exit 0 +else +  new_section="$1" +  valid_sections=$(get_list_of_sections) +  valid=no; for q in $valid_sections; do [ "$q" = "$new_section/" ] && { valid=yes; break; }; done + +  if [ "$valid" = yes ]; then +    section="$new_section" +    # shellcheck disable=SC2001 +    this_query="$(echo "$input" | sed 's@ *[^ ]* *@@')" +    this_prompt="\033[0;32mcht.sh/$section>\033[0m " +  else +    this_query="$input" +    this_prompt="\033[0;32mcht.sh>\033[0m " +  fi +  if [ -n "$this_query" ] && [ -z "$CHEATSH_RESTART" ]; then +    printf "$this_prompt$this_query\n" +    curl -s "${CHTSH_URL}"/"$(get_query_options "$query")" +  fi +fi + +if [ "$is_macos" != yes ]; then +  if [ "$XDG_SESSION_TYPE" = wayland ]; then +    command -v wl-copy >/dev/null || echo 'DEPENDENCY: please install "wl-copy" for "copy"' >&2 +  else +    command -v xclip >/dev/null ||   echo 'DEPENDENCY: please install "xclip" for "copy"' >&2 +  fi +fi +command -v rlwrap >/dev/null || { echo 'DEPENDENCY: install "rlwrap" to use cht.sh in the shell mode' >&2; exit 1; } + +mkdir -p "$CHTSH_HOME/" +lines=$(tput lines) + +if command -v less >/dev/null; then +  defpager="less -R" +elif command -v more >/dev/null; then +  defpager="more" +else +  defpager="cat" +fi + +cmd_cd() { +  if [ $# -eq 0 ]; then +    section="" +  else +    new_section=$(echo "$input" | sed 's/cd  *//; s@/*$@@; s@^/*@@') +    if [ -z "$new_section" ] || [ ".." = "$new_section" ]; then +      section="" +    else +      valid_sections=$(get_list_of_sections) +      valid=no; for q in $valid_sections; do [ "$q" = "$new_section/" ] && { valid=yes; break; }; done +      if [ "$valid" = no ]; then +        echo "Invalid section: $new_section" +        echo "Valid sections:" +        echo "$valid_sections" \ +            | xargs printf "%-10s\n" \ +            | tr ' ' .  \ +            | xargs -n 10 \ +            | sed 's/\./ /g; s/^/  /' +      else +        section="$new_section" +      fi +    fi +  fi +} + +cmd_copy() { +  if [ -z "$DISPLAY" ]; then +    echo copy: supported only in the Desktop version +  elif [ -z "$input" ]; then +    echo copy: Make at least one query first. +  else +    curl -s "${CHTSH_URL}"/"$(get_query_options "$query"?T)" > "$TMP1" +    if [ "$is_macos" != yes ]; then +      if [ "$XDG_SESSION_TYPE" = wayland ]; then +        wl-copy < "$TMP1" +      else +        xclip -sel c -i < "$TMP1" +      fi +    else +      pbcopy < "$TMP1" +    fi +    echo "copy: $(wc -l "$TMP1" | awk '{print $1}') lines copied to the selection" +  fi +} + +cmd_ccopy() { +  if [ -z "$DISPLAY" ]; then +    echo copy: supported only in the Desktop version +  elif [ -z "$input" ]; then +    echo copy: Make at least one query first. +  else +    curl -s "${CHTSH_URL}"/"$(get_query_options "$query"?TQ)" > "$TMP1" +    if [ "$is_macos" != yes ]; then +      if [ "$XDG_SESSION_TYPE" = wayland ]; then +        wl-copy < "$TMP1" +      else +        xclip -sel c -i < "$TMP1" +      fi +    else +      pbcopy < "$TMP1" +    fi +    echo "copy: $(wc -l "$TMP1" | awk '{print $1}') lines copied to the selection" +  fi +} + +cmd_exit() { +  exit 0 +} + +cmd_help() { +  cat <<EOF +help    - show this help +hush    - do not show the 'help' string at start anymore +cd LANG - change the language context +copy    - copy the last answer in the clipboard (aliases: yank, y, c) +ccopy   - copy the last answer w/o comments (cut comments; aliases: cc, Y, C) +exit    - exit the cheat shell (aliases: quit, ^D) +id [ID] - set/show an unique session id ("reset" to reset, "remove" to remove) +stealth - stealth mode (automatic queries for selected text) +update  - self update (only if the scriptfile is writeable) +version - show current cht.sh version +/:help  - service help +QUERY   - space separated query staring (examples are below) +              cht.sh> python zip list +              cht.sh/python> zip list +              cht.sh/go> /python zip list +EOF +} + +cmd_hush() { +  mkdir -p "$CHTSH_HOME/" && touch "$CHTSH_HOME/.hushlogin" && echo "Initial 'use help' message was disabled" +} + +cmd_id() { +  id_file="$CHTSH_HOME/id" + +  if [ id = "$input" ]; then +    new_id="" +  else +    new_id=$(echo "$input" | sed 's/id  *//; s/ *$//; s/ /+/g') +  fi +  if [ "$new_id" = remove ]; then +    if [ -e "$id_file" ]; then +      rm -f -- "$id_file" && echo "id is removed" +    else +      echo "id was not set, so you can't remove it" +    fi +    return +  fi +  if [ -n "$new_id" ] && [ reset != "$new_id" ] && [ "$(/bin/echo -n "$new_id" | wc -c)" -lt 16 ]; then +    echo "ERROR: $new_id: Too short id. Minimal id length is 16. Use 'id reset' for a random id" +    return +  fi +  if [ -z "$new_id" ]; then +    # if new_id is not specified check if we have some id already +    # if yes, just show it +    # if not, generate a new id +    if [ -e "$id_file" ]; then +      awk '$6 == "id" {print $NF}' <"$id_file" | tail -n 1 +      return +    else +      new_id=reset +    fi +  fi +  if [ "$new_id" = reset ]; then +    new_id=$(gen_random_str 12) +  else +    echo WARNING: if someone gueses your id, he can read your cht.sh search history +  fi +  if [ -e "$id_file" ] && grep -q '\tid\t[^\t][^\t]*$' "$id_file" 2> /dev/null; then +    sed -i 's/\tid\t[^\t][^\t]*$/ id '"$new_id"'/' "$id_file" +  else +    if ! [ -e "$id_file" ]; then +      printf '#\n\n' > "$id_file" +    fi +    printf ".cht.sh\tTRUE\t/\tTRUE\t0\tid\t$new_id\n" >> "$id_file" +  fi +  echo "$new_id" +} + +cmd_query() { +  query=$(prepare_query "$section" "$input") +  do_query "$query" +} + +cmd_stealth() { +  if [ "$input" != stealth ]; then +    arguments=$(echo "$input" | sed 's/stealth //; s/ /\&/') +  fi +  trap break INT +  if [ "$is_macos" = yes ]; then +    past=$(pbpaste) +  else +    if [ "$XDG_SESSION_TYPE" = wayland ]; then +      past=$(wl-paste -p) +    else +      past=$(xclip -sel c -o) +    fi +  fi +  printf "\033[0;31mstealth:\033[0m you are in the stealth mode; select any text in any window for a query\n" +  printf "\033[0;31mstealth:\033[0m selections longer than $STEALTH_MAX_SELECTION_LENGTH words are ignored\n" +  if [ -n "$arguments" ]; then +    printf "\033[0;31mstealth:\033[0m query arguments: ?$arguments\n" +  fi +  printf "\033[0;31mstealth:\033[0m use ^C to leave this mode\n" +  while true; do +    if [ "$is_macos" = yes ]; then +      current=$(pbpaste) +    else +      if [ "$XDG_SESSION_TYPE" = wayland ]; then +        current=$(wl-paste -p) +      else +        current=$(xclip -sel c -o) +      fi +    fi +    if [ "$past" != "$current" ]; then +      past=$current +      current_text="$(echo $current | tr -c '[a-zA-Z0-9]' ' ')" +      if [ "$(echo "$current_text" | wc -w)" -gt "$STEALTH_MAX_SELECTION_LENGTH" ]; then +        printf "\033[0;31mstealth:\033[0m selection length is longer than $STEALTH_MAX_SELECTION_LENGTH words; ignoring\n" +        continue +      else +        printf "\n\033[0;31mstealth: \033[7m $current_text\033[0m\n" +        query=$(prepare_query "$section" "$current_text" "$arguments") +        do_query "$query" +      fi +    fi +    sleep 1; +  done +  trap - INT +} + +cmd_update() { +  [ -w "$0" ] || { echo "The script is readonly; please update manually: curl -s ${CHTSH_URL}/:cht.sh | sudo tee $0"; return; } +  TMP2=$(mktemp /tmp/cht.sh.XXXXXXXXXXXXX) +  curl -s "${CHTSH_URL}"/:cht.sh > "$TMP2" +  if ! cmp "$0" "$TMP2" > /dev/null 2>&1; then +    if grep -q ^__CHTSH_VERSION= "$TMP2"; then +      # section was vaildated by us already +      args=(--shell "$section") +      cp "$TMP2" "$0" && echo "Updated. Restarting..." && rm "$TMP2" && CHEATSH_RESTART=1 exec "$0" "${args[@]}" +    else +      echo "Something went wrong. Please update manually" +    fi +  else +    echo "cht.sh is up to date. No update needed" +  fi +  rm -f "$TMP2" > /dev/null 2>&1 +} + +cmd_version() { +  insttime=$(ls -l -- "$0" | sed 's/  */ /g' | cut -d ' ' -f 6-8) +  echo "cht.sh version $__CHTSH_VERSION of $__CHTSH_DATETIME; installed at: $insttime" +  TMP2=$(mktemp /tmp/cht.sh.XXXXXXXXXXXXX) +  if curl -s "${CHTSH_URL}"/:cht.sh > "$TMP2"; then +    if ! cmp "$0" "$TMP2" > /dev/null 2>&1; then +      echo "Update needed (type 'update' for that)". +    else +      echo "Up to date. No update needed" +    fi +  fi +  rm -f "$TMP2" > /dev/null 2>&1 +} + +TMP1=$(mktemp /tmp/cht.sh.XXXXXXXXXXXXX) +trap 'rm -f $TMP1 $TMP2' EXIT +trap 'true' INT + +if ! [ -e "$CHTSH_HOME/.hushlogin" ] && [ -z "$this_query" ]; then +  echo "type 'help' for the cht.sh shell help" +fi + +while true; do +  if [ "$section" != "" ]; then +    full_prompt="$prompt/$section> " +  else +    full_prompt="$prompt> " +  fi + +  input=$( +    rlwrap -H "$CHTSH_HOME/history" -pgreen -C cht.sh -S "$full_prompt" bash "$0" --read | sed 's/ *#.*//' +  ) + +  cmd_name=${input%% *} +  cmd_args=${input#* } +  case $cmd_name in +    "")             continue;;   # skip empty input lines +    '?'|h|help)     cmd_name=help;; +    hush)           cmd_name=hush;; +    cd)             cmd_name="cd";; +    exit|quit)      cmd_name="exit";; +    copy|yank|c|y)  cmd_name=copy;; +    ccopy|cc|C|Y)   cmd_name=ccopy;; +    id)             cmd_name=id;; +    stealth)        cmd_name=stealth;; +    update)         cmd_name=update;; +    version)        cmd_name=version;; +    *)              cmd_name="query"; cmd_args="$input";; +  esac +  "cmd_$cmd_name" $cmd_args +done diff --git a/bin/extra/colorscript b/bin/extra/colorscript new file mode 100755 index 0000000..90dacb1 --- /dev/null +++ b/bin/extra/colorscript @@ -0,0 +1,40 @@ +#!/bin/bash + +counter=0 +var1="$(seq 30 38)" +var2="$(seq 39 47)" +var3="$(seq 0 5) $(seq 7 9)" + + +echo +echo    "  ________________________________________________________" +echo    " |" +echo -n " | " + +for j in $var2 +do +  echo -ne "\e[0;37;${j}m  ${j}  \e[0m" +done + +echo +echo    " |" +echo -n " |" + +for j in $var1 +do +  echo -n "   $j " +done + +echo +echo -n " |________________________________________________________" + +for k in $var3 +do +  echo +  echo -n "$k| " +  for i in $var1 +  do +    echo -ne " \e[${k};${i}m[${i}]\e[0m " +  done +done +echo diff --git a/bin/extra/cycleKB b/bin/extra/cycleKB new file mode 100755 index 0000000..5674786 --- /dev/null +++ b/bin/extra/cycleKB @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +keyboards_file="/home/aluc/bin/keyboards.txt" +cur_keyboard="$(setxkbmap -print | grep "xkb_symbols" | cut -f 2 -d "+")" +# Get line number of match +line="$(awk "/${cur_keyboard}/ {print NR}" "${keyboards_file}")" +lines="$(wc -l "${keyboards_file}" | cut -f 1 -d ' ')" +# cycle back to first line +[[ "$line" == "$lines" ]] && line=1 || ((line++)) +new_keyboard="$(sed -n "${line}p" "${keyboards_file}")" +setxkbmap "${new_keyboard}" +dunstify "cycleKB" "keyboard: <b>${new_keyboard}</b>" diff --git a/bin/extra/ehbtodl b/bin/extra/ehbtodl new file mode 100755 index 0000000..39d8621 --- /dev/null +++ b/bin/extra/ehbtodl @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +echo "$1" | sed 's/-H/\\\n\t&/g' | sed '/gzip/d' > /tmp/curlcommand.sh  +sh /tmp/curlcommand.sh > /tmp/ehbso.html +vids="$(grep -oE "youtube\.com/embed/.{11}" /tmp/ehbso.html | cut -d'/' -f 3 | tr '\n' ' ')" +for i in $vids  +do +	echo "https://www.youtube.com/watch?v=$i" +done > /tmp/todownload +# yt-dlp -P "$HOME/Downloads/vids" -o "%(title)s" -a /tmp/todownload diff --git a/bin/extra/keyboards.txt b/bin/extra/keyboards.txt new file mode 100644 index 0000000..03ec74b --- /dev/null +++ b/bin/extra/keyboards.txt @@ -0,0 +1,2 @@ +be +us diff --git a/bin/extra/vimastp b/bin/extra/vimastp new file mode 100755 index 0000000..f4ae6b5 --- /dev/null +++ b/bin/extra/vimastp @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +for var in name vcpus memory cdrom disk_size osinfo +do + read -p "${var}:" "$var" +done +echo "virt-install --name=$name \ +--vcpus ${vcpus:-4} \ +--memory ${memory:-4096} \ +--cdrom ${cdrom} \ +--disk size=${disk_size-30},pool=VMs \ +--osinfo ${osinfo:-detect=on}\ +--boot cdrom,hd,network"  | 
