aboutsummaryrefslogtreecommitdiff
path: root/.scripts
diff options
context:
space:
mode:
Diffstat (limited to '.scripts')
-rwxr-xr-x.scripts/adblock18
-rwxr-xr-x.scripts/beep11
-rwxr-xr-x.scripts/decrypt6
-rwxr-xr-x.scripts/encrypt7
-rwxr-xr-x.scripts/panic2
-rwxr-xr-x.scripts/whatamidoing7
6 files changed, 44 insertions, 7 deletions
diff --git a/.scripts/adblock b/.scripts/adblock
index 3fdbb97..a6d7c44 100755
--- a/.scripts/adblock
+++ b/.scripts/adblock
@@ -1,9 +1,21 @@
#!/bin/bash
-if grep -Fxq "##START" /etc/hosts; then
- sudo sed -i "/##START/,/##END/s/#\(.\)/\1/" /etc/hosts
+if grep -xq "^##START" /etc/hosts; then
+ echo "enabling..."
+ sudo sed -i "/^##START/,/^##END/s/#\(.\)/\1/" /etc/hosts
+ sudo mv /etc/opensnitchd/adblock/stevenblack /etc/opensnitchd/adblock/stevenblack.txt
+ while true; do
+ sleep 0.5s
+ dig adservice.google.com &>/dev/null || break
+ done
notify-send "Enabled adblock!"
else
- sudo sed -i "/#START/,/#END/s/./#&/" /etc/hosts
+ echo "disabling..."
+ sudo sed -i "/^#START/,/^#END/s/./#&/" /etc/hosts
+ sudo mv /etc/opensnitchd/adblock/stevenblack.txt /etc/opensnitchd/adblock/stevenblack
+ while true; do
+ sleep 0.5s
+ dig adservice.google.com &>/dev/null && break
+ done
notify-send "Disabled adblock!"
fi
diff --git a/.scripts/beep b/.scripts/beep
index c334bd9..60c93c1 100755
--- a/.scripts/beep
+++ b/.scripts/beep
@@ -1,4 +1,9 @@
-#!/bin/sh
+#!/bin/bash
-(amixer get Speaker | grep "off" &>/dev/null) || exit 0 # only beep on headphones
-paplay $HOME/.scripts/beep.ogg &
+# only beep on headphones
+(amixer get Speaker | grep "off" &>/dev/null) && (paplay "$HOME/.scripts/beep.ogg" &)
+
+# (
+# sleep 0.5
+# dunstctl action
+# ) &
diff --git a/.scripts/decrypt b/.scripts/decrypt
new file mode 100755
index 0000000..d509492
--- /dev/null
+++ b/.scripts/decrypt
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+set -e
+
+gpg -u "Master" --decrypt --armor -o "$1.dec" "$1"
+mv "$1.dec" "$1"
diff --git a/.scripts/encrypt b/.scripts/encrypt
new file mode 100755
index 0000000..6b399d8
--- /dev/null
+++ b/.scripts/encrypt
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+set -e
+
+gpg --encrypt --armor --recipient "Master" -o "$1.enc" "$1"
+shred "$1"
+mv "$1.enc" "$1"
diff --git a/.scripts/panic b/.scripts/panic
index 1c3de63..da98fb5 100755
--- a/.scripts/panic
+++ b/.scripts/panic
@@ -2,6 +2,8 @@
# xdotool search "" windowkill %@
+(printf "yes" | dmenu -p "stop" && killall -9 panic) &
+
for i in $(seq 5); do
printf "panic\npanic\npanic" | osd_cat -d 1 -A center -l 3 -p middle -c red -f '-*-*-*-*-*-*-*-240-*-*-*-*-*-*'
sleep 0.1
diff --git a/.scripts/whatamidoing b/.scripts/whatamidoing
index 3c65677..81612b1 100755
--- a/.scripts/whatamidoing
+++ b/.scripts/whatamidoing
@@ -1,8 +1,13 @@
#!/bin/sh
# arbtt files have limited read access (good!) ==> write current tag to file using cronjob
+if ! [ $(pgrep "arbtt-capture") ]; then
+ notify-send "arbtt" "arbtt-capture is not running!"
+fi
+
if [ "$1" = "sync" ]; then
- /home/melvin/.cabal/bin/arbtt-stats --logfile=/home/melvin/.arbtt/capture.log --categorizefile=/home/melvin/.arbtt/categorize.cfg -f '$sampleage < 0:01' | tail -n 1 | awk '{print $1}' >/home/melvin/.arbtt/current
+ /home/melvin/.cabal/bin/arbtt-stats --logfile=/home/melvin/.arbtt/capture.log --categorizefile=/home/melvin/.arbtt/categorize.cfg -f '$sampleage < 0:01' --also-inactive | tail -n 1 | awk '{print $1}' >/home/melvin/.arbtt/current.tmp
+ mv /home/melvin/.arbtt/current.tmp /home/melvin/.arbtt/current
else
cat /home/melvin/.arbtt/current
fi