Add some scripts
This commit is contained in:
parent
2684fbfae2
commit
7d9c45878f
22
scripts/ex
Normal file
22
scripts/ex
Normal file
@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
# ex - archive extractor
|
||||
# usage: ex <file>
|
||||
if [ -f $1 ] ; then
|
||||
case $1 in
|
||||
*.tar.bz2) tar xjf $1 ;;
|
||||
*.tar.gz) tar xzf $1 ;;
|
||||
*.bz2) bunzip2 $1 ;;
|
||||
*.rar) unrar x $1 ;;
|
||||
*.gz) gunzip $1 ;;
|
||||
*.tar) tar xf $1 ;;
|
||||
*.tbz2) tar xjf $1 ;;
|
||||
*.tgz) tar xzf $1 ;;
|
||||
*.zip) unzip $1 ;;
|
||||
*.Z) uncompress $1;;
|
||||
*.7z) 7z x $1 ;;
|
||||
*) echo "'$1' cannot be extracted via ex()" ;;
|
||||
esac
|
||||
else
|
||||
echo "'$1' is not a valid file"
|
||||
fi
|
10
scripts/mdToPdf
Executable file
10
scripts/mdToPdf
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
pandoc "$1" \
|
||||
-f gfm \
|
||||
-V linkcolor:blue \
|
||||
-V geometry:a4paper \
|
||||
-V geometry:margin=2cm \
|
||||
-V mainfont="Droid Sans" \
|
||||
--pdf-engine=xelatex \
|
||||
-o "$2"
|
20
scripts/rofi/config-selector.py
Executable file
20
scripts/rofi/config-selector.py
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/python3
|
||||
|
||||
from subprocess import Popen, PIPE
|
||||
from os.path import expandvars
|
||||
|
||||
def call_rofi(entries,command):
|
||||
proc = Popen(command,
|
||||
stdin=PIPE,
|
||||
stdout=PIPE)
|
||||
for e in entries:
|
||||
proc.stdin.write((e+"\n").encode('utf-8'))
|
||||
proc.stdin.close()
|
||||
answer = proc.stdout.read().decode('utf-8')
|
||||
return answer.replace("\n","")
|
||||
|
||||
with open('$HOME/.scripts/rofi/configfiles', 'r') as file:
|
||||
choices = dict([(file.capitalize(), path) for file, path in [line.split(' ') for line in file.readlines()]])
|
||||
choice = call_rofi(choices, ['rofi', '-dmenu','-i', '-matching', 'fuzzy', '-p', 'Configfile'])
|
||||
print(expandvars(choices[choice]), end='')
|
||||
|
28
scripts/tmux/fcitx
Executable file
28
scripts/tmux/fcitx
Executable file
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
printState() {
|
||||
# REQUIRES QT5-TOOLS
|
||||
STATUS=$(qdbus "org.fcitx.Fcitx" "/inputmethod" "GetCurrentIM")
|
||||
|
||||
case $STATUS in
|
||||
fcitx-keyboard-us)
|
||||
echo 'US'
|
||||
;;
|
||||
fcitx-keyboard-no)
|
||||
echo 'NO'
|
||||
;;
|
||||
mozc)
|
||||
echo '日本語'
|
||||
;;
|
||||
*)
|
||||
echo "$STATUS?"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
while :
|
||||
do
|
||||
printState
|
||||
sleep 1
|
||||
done
|
18
scripts/tmux/mpd
Executable file
18
scripts/tmux/mpd
Executable file
@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
isPlaying() {
|
||||
if mpc status | grep playing >/dev/null
|
||||
then
|
||||
echo -e "▶"
|
||||
else
|
||||
echo -e "⏸"
|
||||
fi
|
||||
}
|
||||
|
||||
while true; do
|
||||
PLAYING=$(isPlaying)
|
||||
TITLE=$(mpc --format '[%artist% - ]%title%' | /usr/bin/head -n 1)
|
||||
TIME=$(mpc | awk '(NR==2){print $3}')
|
||||
echo -e "$PLAYING $TITLE | [$TIME]"
|
||||
sleep 1
|
||||
done
|
6
scripts/toCbz
Executable file
6
scripts/toCbz
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
# Convert manga picture folders in current folder to cbz
|
||||
|
||||
for i in ./*; do
|
||||
zip -r "$i.cbz" "$i"
|
||||
done
|
16
scripts/touchpadToggle.sh
Executable file
16
scripts/touchpadToggle.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
declare -i ID
|
||||
ID=`xinput list | grep -Eio '(touchpad|glidepoint)\s*id\=[0-9]{1,2}' | grep -Eo '[0-9]{1,2}'`
|
||||
declare -i STATE
|
||||
STATE=`xinput list-props $ID|grep 'Device Enabled'|awk '{print $4}'`
|
||||
if [ $STATE -eq 1 ]
|
||||
then
|
||||
xinput disable $ID
|
||||
# echo "Touchpad disabled."
|
||||
# notify-send -a 'Touchpad' 'Disabled' -i input-touchpad
|
||||
else
|
||||
xinput enable $ID
|
||||
# echo "Touchpad enabled."
|
||||
# notify-send -a 'Touchpad' 'Enabled' -i input-touchpad
|
||||
fi
|
Loading…
Reference in New Issue
Block a user