Add installation scripts
This commit is contained in:
185
binaries.org
185
binaries.org
@@ -5,50 +5,6 @@
|
||||
#+PROPERTY: header-args:bash+ :shebang "#!/usr/bin/env bash"
|
||||
#+PROPERTY: header-args:bash+ :tangle-mode (identity #o555)
|
||||
|
||||
* =dmenukill= - Kill program using Dmenu
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: dmenukill
|
||||
:END:
|
||||
|
||||
#+begin_src bash :tangle ~/.local/bin/dmenukill
|
||||
ps_line=$(ps -u $USER k -size -o pid=,%mem=,%cpu=,comm= | dmenu -i -l 15)
|
||||
|
||||
if [ ! -z "$ps_line" ]; then
|
||||
pid=$(echo $ps_line | awk '{print $1}')
|
||||
name=$(echo $ps_line | awk '{print $4}')
|
||||
|
||||
kill -15 $pid && \
|
||||
dunstify "Kill" "$name (PID $pid)" &
|
||||
fi
|
||||
|
||||
#+end_src
|
||||
|
||||
* =nordvpn-toggle= - Connect to VPN using NordVPN
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: nordvpn-toggle
|
||||
:END:
|
||||
|
||||
To use this this, =nordvpn= must be installed: =yay -S nordvpn-bin=.
|
||||
|
||||
In order to populate the country list, =nordvpn countries | tr '\t' '\n' | sed -r '/^\s*$/d' > ~/.local/data/nordvpn_countries.txt=.
|
||||
|
||||
#+begin_src bash :tangle ~/.local/bin/nordvpn-toggle
|
||||
tmpfile="/tmp/vpnstatus";
|
||||
|
||||
if [[ $(nordvpn status) == *"Connected"* ]]; then
|
||||
nordvpn disconnect && \
|
||||
dunstify --replace=23198 "VPN" "Disconnected" && \
|
||||
echo "off" > $tmpfile;
|
||||
else
|
||||
# Select Country to connect to
|
||||
country=`cat ~/.local/data/nordvpn_countries.txt | rofi -i -dmenu | sed 's/\s/_/g'`;
|
||||
dunstify --replace=23198 "VPN" "Connecting to $country...";
|
||||
nordvpn connect $country && \
|
||||
dunstify --replace=23198 "VPN" "Connected to $country" && \
|
||||
echo "on" > $tmpfile;
|
||||
fi
|
||||
#+end_src
|
||||
|
||||
* =i3exit= - Manage lock, suspend, reboot, ...
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: i3exit
|
||||
@@ -165,41 +121,6 @@ case "$status" in
|
||||
esac
|
||||
#+end_src
|
||||
|
||||
* =network-toggle= - Toggle Network
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: network-toggle
|
||||
:END:
|
||||
|
||||
Minimal network manager to just toggle the Wifi or Ethernet connection.
|
||||
|
||||
#+begin_src bash :tangle ~/.local/bin/network-toggle
|
||||
result=$(nmcli device | sed '1d' | dmenu -l 20);
|
||||
|
||||
interface=$(echo $result | awk -F ' ' '{print $1}');
|
||||
status=$(echo $result | awk -F ' ' '{print $3}');
|
||||
|
||||
if [ $status == 'disconnected' ]; then
|
||||
nmcli device connect $interface
|
||||
else
|
||||
nmcli device disconnect $interface
|
||||
fi
|
||||
#+end_src
|
||||
|
||||
* =make-gif= - Convert an =MP4= video to =GIF=
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: make-gif
|
||||
:END:
|
||||
|
||||
First argument is the =mp4= file and the second argument is the output =gif= file.
|
||||
|
||||
#+begin_src bash :tangle ~/.local/bin/make-gif
|
||||
palette="/tmp/palette.png"
|
||||
filters="fps=15,scale=320:-1:flags=lanczos"
|
||||
|
||||
ffmpeg -v warning -i $1 -vf "$filters,palettegen" -y $palette
|
||||
ffmpeg -v warning -i $1 -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $2
|
||||
#+end_src
|
||||
|
||||
* =yt-audio= - Download-Audio from youtube
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: yt-audio
|
||||
@@ -269,20 +190,10 @@ fi
|
||||
The list of emojis is available [[file:data.org::#emojis][here]].
|
||||
|
||||
#+begin_src bash :tangle ~/.local/bin/insert-unicode
|
||||
# Must have xclip installed to even show menu.
|
||||
xclip -h 2>/dev/null || exit 1
|
||||
|
||||
chosen=$(cut -d ';' -f1 ~/.local/data/emojis | rofi -dmenu -i -l 20 | sed "s/ .*//")
|
||||
|
||||
[ "$chosen" != "" ] || exit
|
||||
|
||||
# If you run this command with an argument, it will automatically insert the character.
|
||||
if [ -n "$1" ]; then
|
||||
xdotool key Shift+Insert
|
||||
else
|
||||
echo "$chosen" | tr -d '\n' | xsel -ib
|
||||
dunstify "'$chosen' copied to clipboard." &
|
||||
fi
|
||||
xdotool type --clearmodifiers "$chosen"
|
||||
#+end_src
|
||||
|
||||
* =insert-nerd-fonts= - Insert Nerd Font Icon
|
||||
@@ -293,20 +204,10 @@ fi
|
||||
The list of emojis is available [[file:data.org::#nerd-fonts][here]].
|
||||
|
||||
#+begin_src bash :tangle ~/.local/bin/insert-nerd-fonts
|
||||
# Must have xsel installed to even show menu.
|
||||
xsel -h 2>/dev/null || exit 1
|
||||
|
||||
chosen=$(cat ~/.local/data/nerd-fonts | rofi -dmenu -i -l 20 | sed "s/ .*//")
|
||||
|
||||
chosen=$(cut -d ';' -f1 ~/.local/data/emojis | rofi -dmenu -i -l 20 | sed "s/ .*//")
|
||||
[ "$chosen" != "" ] || exit
|
||||
|
||||
# If you run this command with an argument, it will automatically insert the character.
|
||||
if [ -n "$1" ]; then
|
||||
xdotool key Shift+Insert
|
||||
else
|
||||
echo "$chosen" | tr -d '\n' | xsel -ib
|
||||
dunstify "'$chosen' copied to clipboard." &
|
||||
fi
|
||||
xdotool type --clearmodifiers "$chosen"
|
||||
#+end_src
|
||||
|
||||
* =linkhandler= - Open any URL with Default application
|
||||
@@ -384,74 +285,6 @@ i3lock --ignore-empty-password --nofork --image=$temp_file && \
|
||||
killall -SIGUSR2 dunst && echo "on" > /tmp/dunststatus
|
||||
#+end_src
|
||||
|
||||
* =mopidy-restart= - Restart Mopidy
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: mopidy-restart
|
||||
:END:
|
||||
|
||||
Sometimes =mopidy= need to be restarted...
|
||||
|
||||
#+begin_src bash :tangle ~/.local/bin/mopidy-restart
|
||||
pids=( $(pgrep -f mopidy) )
|
||||
|
||||
for pid in "${pids[@]}"; do
|
||||
if [[ $pid != $$ ]]; then
|
||||
kill "$pid"
|
||||
fi
|
||||
done
|
||||
echo "Killed mopidy."
|
||||
|
||||
echo "Restarting mopidy..."
|
||||
~/.local/soft/mopidy-jellyfin/env/bin/mopidy -v >/tmp/mopidy.log 2>&1 &
|
||||
echo "Done"
|
||||
#+end_src
|
||||
|
||||
* =upload= - Upload Script
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: upload
|
||||
:END:
|
||||
|
||||
Upload a file to https://0x0.st/ and copy the generated url.
|
||||
|
||||
#+begin_src bash :tangle ~/.local/bin/upload
|
||||
if [ $TMUX ]; then
|
||||
tmux split -v -l 1 "curl --progress-bar -F\"file=@$1\" https://0x0.st | xsel -ib;" && tmux select-pane -U
|
||||
else
|
||||
curl --progress-bar -F"file=@$1" https://0x0.st | xsel -ib && \
|
||||
dunstify 'Upload' 'Successful' || \
|
||||
dunstify --urgency=critical 'Upload' 'Failed'
|
||||
fi
|
||||
#+end_src
|
||||
|
||||
* =weather= - Display Weather in terminal
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: weather
|
||||
:END:
|
||||
|
||||
Get the weather from http://wttr.in/.
|
||||
|
||||
#+begin_src bash :tangle ~/.local/bin/weather
|
||||
if [ -n "$*" ]; then
|
||||
address="wttr.in/"
|
||||
address+=$*
|
||||
else
|
||||
address="wttr.in/"
|
||||
fi
|
||||
|
||||
if type nsxiv > /dev/null 2>&1; then
|
||||
address+=".png"
|
||||
|
||||
wget -qO- "$address" > /tmp/weather.png && \
|
||||
nsxiv -b /tmp/weather.png
|
||||
elif type feh > /dev/null 2>&1; then
|
||||
address+=".png"
|
||||
|
||||
wget -qO- "$address" | feh -
|
||||
else
|
||||
curl "$address"
|
||||
fi
|
||||
#+end_src
|
||||
|
||||
* =convert-file= - Convert any file to another filetype
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: convert-file
|
||||
@@ -1429,17 +1262,6 @@ printf "$pass" | xclip -sel clip && \
|
||||
dunstify 'Password' 'Generated'
|
||||
#+end_src
|
||||
|
||||
* =sxhkd-help= - List of keybindings using Rofi
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: sxhkd-help
|
||||
:END:
|
||||
|
||||
#+begin_src bash :tangle ~/.local/bin/sxhkd-help
|
||||
awk '/^[a-z]/ && last {print "<small>",$0,"\t",last,"</small>"} {last=""} /^#/{last=$0}' ~/.config/sxhkd/sxhkdrc{,.i3} |
|
||||
column -t -s $'\t' |
|
||||
rofi -dmenu -i -markup-rows -no-show-icons -width 1000 -lines 15 -yoffset 40
|
||||
#+end_src
|
||||
|
||||
* =qrdecode= - Decode QRcode by taking screenshot
|
||||
To install:
|
||||
#+begin_src bash :tangle no
|
||||
@@ -1479,3 +1301,4 @@ dunstify "qrshot" "$decoded_text"
|
||||
# Cleaning up the trash that was left behind
|
||||
rm $image_file
|
||||
#+end_src
|
||||
|
||||
|
||||
Reference in New Issue
Block a user