diff options
Diffstat (limited to '.scripts')
-rwxr-xr-x | .scripts/boil | 21 | ||||
-rwxr-xr-x | .scripts/commstat | 1 | ||||
-rwxr-xr-x | .scripts/compile | 4 | ||||
-rwxr-xr-x | .scripts/dwm_time | 8 | ||||
-rwxr-xr-x | .scripts/ext | 42 | ||||
-rwxr-xr-x | .scripts/preview | 14 | ||||
-rwxr-xr-x | .scripts/rotate | 42 | ||||
-rwxr-xr-x | .scripts/wlan | 18 |
8 files changed, 108 insertions, 42 deletions
diff --git a/.scripts/boil b/.scripts/boil index ac1ab55..0805147 100755 --- a/.scripts/boil +++ b/.scripts/boil @@ -5,18 +5,23 @@ name="$2" boilerplates="$HOME/.boilerplates" if [ "${mode}" = "" ] || [ "${name}" = "" ]; then - echo "Not enough parameters" - exit 1 + echo "Not enough parameters" + exit 1 fi if [ "${mode}" = "clj" ]; then - lein new app "$name" - cp "$boilerplates/$mode/run" "$name" - rm -rf "$name/CHANGELOG.md" "$name/LICENSE" "$name/README.md" "$name/doc/" + lein new app "$name" + cp "$boilerplates/$mode/run" "$name" + rm -rf "$name/CHANGELOG.md" "$name/LICENSE" "$name/README.md" "$name/doc/" elif [ "${mode}" = "md" ] || [ "${mode}" = "ms" ]; then - cp "$boilerplates/txt/$mode.$mode" "$name.$mode" + cp "$boilerplates/txt/$mode.$mode" "$name.$mode" elif [ "${mode}" = "run" ]; then - cp "$boilerplates/txt/run" run + cp "$boilerplates/txt/run" run +elif [ "${mode}" = "cs" ]; then + mkdir -p "$name" + cd "$name" || exit 1 + dotnet new console + cp "$boilerplates/cs/run" run else - cp -r "$boilerplates/$mode" "$name" || echo "Something went wrong" + cp -r "$boilerplates/$mode" "$name" || echo "Something went wrong" fi diff --git a/.scripts/commstat b/.scripts/commstat deleted file mode 100755 index f1f641a..0000000 --- a/.scripts/commstat +++ /dev/null @@ -1 +0,0 @@ -#!/usr/bin/env bash diff --git a/.scripts/compile b/.scripts/compile index 38295e2..95f70c8 100755 --- a/.scripts/compile +++ b/.scripts/compile @@ -6,8 +6,8 @@ base="${file%.*}" ext="${file##*.}" if [ -f "$dir/run" ]; then - echo "Using run file" - exec "$dir/run" + echo "Using run file" + exec "$dir/run" fi case "$ext" in diff --git a/.scripts/dwm_time b/.scripts/dwm_time index fddff39..a68b913 100755 --- a/.scripts/dwm_time +++ b/.scripts/dwm_time @@ -1,7 +1,9 @@ #!/usr/bin/env sh while true; do - time=$( date +'%H:%M') - xsetroot -name "$time" - sleep 1 + time=$(date +'%H:%M') + # bat=$(acpi | awk '{print $4}' | head -c3) + # xsetroot -name " $bat | $time " + xsetroot -name " $time " + sleep 1 done diff --git a/.scripts/ext b/.scripts/ext index 3b41b1a..a1b9d0e 100755 --- a/.scripts/ext +++ b/.scripts/ext @@ -1,30 +1,30 @@ #!/usr/bin/env sh archive="$(readlink -f "$*")" && - directory="$(echo "$archive" | sed 's/\.[^\/.]*$//')" && - mkdir -p "$directory" && - cd "$directory" || exit + directory="$(echo "$archive" | sed 's/\.[^\/.]*$//')" && + mkdir -p "$directory" && + cd "$directory" || exit [ "$archive" = "" ] && printf "Give archive to extract as argument\\n" && exit if [ -f "$archive" ]; then - case "$archive" in - *.tar.bz2 | *.tbz2) tar xvjf "$archive" ;; - *.tar.xz) tar -xf "$archive" ;; - *.tar.gz | *.tgz) tar xvzf "$archive" ;; - *.tar.lz) tar --lzip -xvf "$archive" ;; - *.lzma) unlzma "$archive" ;; - *.bz2) bunzip2 "$archive" ;; - *.rar) unrar x -ad "$archive" ;; - *.gz) gunzip "$archive" ;; - *.tar) tar xvf "$archive" ;; - *.zip) unzip "$archive" ;; - *.Z) uncompress "$archive" ;; - *.7z) 7z x "$archive" ;; - *.xz) unxz "$archive" ;; - *.exe) cabextract "$archive" ;; - *) printf "extract: '%s' - unknown archive method\\n" "$archive" ;; - esac + case "$archive" in + *.tar.bz2 | *.tbz2) tar xvjf "$archive" ;; + *.tar.xz) tar -xf "$archive" ;; + *.tar.gz | *.tgz) tar xvzf "$archive" ;; + *.tar.lz) tar --lzip -xvf "$archive" ;; + *.lzma) unlzma "$archive" ;; + *.bz2) bunzip2 "$archive" ;; + *.rar) unrar x -ad "$archive" ;; + *.gz) gunzip "$archive" ;; + *.tar) tar xvf "$archive" ;; + *.zip) unzip "$archive" ;; + *.Z) uncompress "$archive" ;; + *.7z) 7z x "$archive" ;; + *.xz) unxz "$archive" ;; + *.exe) cabextract "$archive" ;; + *) printf "extract: '%s' - unknown archive method\\n" "$archive" ;; + esac else - printf "File \"%s\" not found\\n" "$archive" + printf "File \"%s\" not found\\n" "$archive" fi diff --git a/.scripts/preview b/.scripts/preview index 43ef6f0..099eb1b 100755 --- a/.scripts/preview +++ b/.scripts/preview @@ -5,13 +5,13 @@ if [ -z "$1" ]; then exit 1; fi basename="$(echo "$1" | sed 's/\.[^\/.]*$//')" wait_pdf() { - sleep 5 # Some start delay - while true; do - if ! pgrep -x "zathura" >/dev/null; then - rm -f "$basename".pdf - exit 0 - fi - done + sleep 5 # Some start delay + while true; do + if ! pgrep -x "zathura" >/dev/null; then + rm -f "$basename".pdf + exit 0 + fi + done } case "$1" in diff --git a/.scripts/rotate b/.scripts/rotate new file mode 100755 index 0000000..97b045a --- /dev/null +++ b/.scripts/rotate @@ -0,0 +1,42 @@ +#!/usr/bin/env bash + +nibble="TPPS/2 IBM TrackPoint" +stylus="Wacom ISDv4 90 Pen stylus" +eraser="Wacom ISDv4 90 Pen eraser" + +matrix="$(xinput list-props "$stylus" | awk '/Coordinate Transformation Matrix/{print $5$6$7$8$9$10$11$12$NF}')" + +# Matrix declarations + +normal="1 0 0 0 1 0 0 0 1" +normal_float="1.000000,0.000000,0.000000,0.000000,1.000000,0.000000,0.000000,0.000000,1.000000" + +inverted="-1 0 1 0 -1 1 0 0 1" +inverted_float="-1.000000,0.000000,1.000000,0.000000,-1.000000,1.000000,0.000000,0.000000,1.000000" + +left="0 -1 1 1 0 0 0 0 1" +left_float="0.000000,-1.000000,1.000000,1.000000,0.000000,0.000000,0.000000,0.000000,1.000000" + +right="0 1 0 -1 0 1 0 0 1" + +if [ "$matrix" == $normal_float ] && [ "$1" != "-n" ]; then + xrandr -o inverted + xinput set-prop "$stylus" 166 $inverted + xinput set-prop ""$eraser"" 166 $inverted + xinput set-prop ""$nibble"" 166 $inverted +elif [ "$matrix" == $inverted_float ] && [ "$1" != "-j" ] && [ "$1" != "-n" ]; then + xrandr -o left + xinput set-prop "$stylus" 166 $left + xinput set-prop "$eraser" 166 $left + xinput set-prop "$nibble" 166 $left +elif [ "$matrix" == $left_float ] && [ "$1" != "-j" ] && [ "$1" != "-n" ]; then + xrandr -o right + xinput set-prop "$stylus" 166 $right + xinput set-prop "$eraser" 166 $right + xinput set-prop "$nibble" 166 $right +else + xrandr -o normal + xinput set-prop "$stylus" 166 $normal + xinput set-prop "$eraser" 166 $normal + xinput set-prop "$nibble" 166 $normal +fi diff --git a/.scripts/wlan b/.scripts/wlan new file mode 100755 index 0000000..0df4aea --- /dev/null +++ b/.scripts/wlan @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +# Melvin's awesome wifi connection script! + +netctl list | grep -q "$1" || { + echo "This network doesn't exist. Please use 'sudo wifi-menu' to add a new network or use one of the following:" + netctl list + exit 1 +} + +sudo netctl stop-all +sudo killall -9 dhcpcd +sudo systemctl start dhcpcd || exit 1 +sudo ip link set wlp3s0 down +sudo netctl start "$1" || exit 1 + +echo "Connecting..." +while ! ping -c1 1.1.1.1 &>/dev/null; do sleep 1; done +echo "Connected!" |