diff --git a/.config/crontab b/.config/crontab new file mode 100644 index 0000000..29f8437 --- /dev/null +++ b/.config/crontab @@ -0,0 +1,9 @@ + +DISPLAY=:0 +XDG_RUNTIME_DIR=/run/user/1000 + +* * * * * /home/sahin/scripts/check-battery.sh 6 + +*/15 * * * * curl 'https://sks.itu.edu.tr/ExternalPages/sks/yemek-menu-v2/uzerinde-calisilan/yemek-menu.aspx' 2>/dev/null | grep -oP "js-nyro-modal.*?>\K(.+)(?=)" > /home/sahin/.todaysmenu + +* * * * * cat /var/spool/cron/sahin > /home/sahin/.config/crontab diff --git a/.config/zsh/.aliases b/.config/zsh/.aliases index e6408c2..74dd0d0 100644 --- a/.config/zsh/.aliases +++ b/.config/zsh/.aliases @@ -1,4 +1,5 @@ # alias af=alias-finder +alias menu="menu | lolcat" alias ls=lsd alias lt="lsd --tree" alias rake='noglob bundled_rake' diff --git a/scripts/misc/adjust_terminal_colors.py b/scripts/adjust_terminal_colors.py similarity index 100% rename from scripts/misc/adjust_terminal_colors.py rename to scripts/adjust_terminal_colors.py diff --git a/scripts/check-battery.sh b/scripts/check-battery.sh new file mode 100755 index 0000000..e579b32 --- /dev/null +++ b/scripts/check-battery.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Set limit to shell argument +batteryLimit=$1 +fullAt=92 + +# Get the current battery level with acpi +batteryLevel=$(acpi | cut -d ' ' -f 4 | tr -d '%|,| ') +charging=$(acpi | cut -d ' ' -f 3 | tr -d ',| ') + +echo $batteryLevel + +if [[ "$batteryLevel" -le "$batteryLimit" ]] && [[ "$charging" == "Discharging" ]]; then + /usr/bin/notify-send -a "Battery Warning" --urgency critical "Battery level at ${batteryLevel}%" -i abrt -t 10000 + /usr/bin/paplay /usr/share/sounds/freedesktop/stereo/dialog-warning.oga +#elif [[ "$batteryLevel" -gt "$fullAt" ]] && [[ ! "$charging" == "Discharging" ]]; then +# /usr/bin/notify-send -a "Battery Warning" "Battery is full: ${batteryLevel}" -i abrt -t 10000 +# /usr/bin/paplay /usr/share/sounds/freedesktop/stereo/dialog-warning.oga +fi diff --git a/scripts/copy2clipboard b/scripts/copy2clipboard new file mode 100755 index 0000000..dac5e37 --- /dev/null +++ b/scripts/copy2clipboard @@ -0,0 +1,15 @@ +#!/bin/bash + +if [ -z "$1" ] + then + file=$(find . -maxdepth 1 -type f | cut -c 3- | rofi -i -dmenu -p "Select file to copy its contents") + else + file=$1 +fi + + +if [ -z "$file" ]; then + exit +fi +cat $file | xclip -selection c +notify-send "Contents of the '$file' is copied to clipboard!" diff --git a/scripts/misc/i3-lock.sh b/scripts/lock-screen similarity index 73% rename from scripts/misc/i3-lock.sh rename to scripts/lock-screen index bdfa44b..6af9792 100755 --- a/scripts/misc/i3-lock.sh +++ b/scripts/lock-screen @@ -7,10 +7,10 @@ C='#ffffff22' # clear ish # W='#880000bb' # wrong # V='#bb00bbbb' # verifying -D="$(xrdb -query | grep "*.color12\b" | cut -d":" -f2 | xargs)cc" -T="$(xrdb -query | grep "*.color13\b" | cut -d":" -f2 | xargs)ee" -W="$(xrdb -query | grep "*.color1\b" | cut -d":" -f2 | xargs)bb" -V="$(xrdb -query | grep "*.color6\b" | cut -d":" -f2 | xargs)bb" +D="$(xrdb -query | grep ".color12" | cut -d":" -f2 | xargs)cc" +T="$(xrdb -query | grep ".color13" | cut -d":" -f2 | xargs)ee" +W="$(xrdb -query | grep ".color1" | cut -d":" -f2 | xargs)bb" +V="$(xrdb -query | grep ".color6" | cut -d":" -f2 | xargs)bb" i3lock \ diff --git a/scripts/menu b/scripts/menu new file mode 100755 index 0000000..aab74e2 --- /dev/null +++ b/scripts/menu @@ -0,0 +1,9 @@ +#!/bin/bash +clear +figlet -f slant "Today's + menu" + + +cat ~/.todaysmenu + +cowsay "Bon appetit!" diff --git a/scripts/misc/battery-level.sh b/scripts/misc/battery-level.sh deleted file mode 100755 index d936554..0000000 --- a/scripts/misc/battery-level.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -# Set path for running in a cron job -PATH='/snap/bin:/home/sahin/.poetry/bin:/home/sahin/.pyenv/bin:/home/sahin/.pyenv/shims:/home/sahin/.pyenv/bin:/home/sahin/.cargo/bin:/home/sahin/.poetry/bin:/home/sahin/.local/bin:/home/sahin/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/sahin/Downloads/ArchiveFiles/idea-IU-211.7628.21/bin:/home/sahin/scripts:/home/sahin/.fzf/bin' - -# Set limit to shell argument -batteryLimit=$1 - -export DISPLAY=:0 -export XDG_RUNTIME_DIR=/run/user/$(id -u) - -# Get the current battery level with acpi -batteryLevel=$(acpi | cut -d ' ' -f 4 | tr -d '%|,| ') -charging=$(acpi | cut -d ' ' -f 3 | tr -d ',| ') - -# Must have the Xdus file to run in a cron job. If this is not -# necessary functionality, this can be ignored, otherwise one must -# run the /scripts/xdbus.sh script in this repository at startup, -# which is called by default from my i3/config file. -# if [ -r "$HOME/.dbus/Xdbus" ]; then -# . "$HOME/.dbus/Xdbus" -# fi - -if [[ "$batteryLevel" -le "$batteryLimit" ]] && [[ "$charging" == "Discharging" ]]; then - /usr/bin/notify-send -a "Battery Warning" --urgency critical "Battery level at ${batteryLevel}%" -i abrt -t 10000 - /usr/bin/paplay /usr/share/sounds/Oxygen-K3B-Finish-Error.ogg -fi diff --git a/scripts/misc/restart_dunst.sh b/scripts/restart_dunst.sh similarity index 100% rename from scripts/misc/restart_dunst.sh rename to scripts/restart_dunst.sh diff --git a/scripts/shrfile b/scripts/shrfile new file mode 100755 index 0000000..6676cc9 --- /dev/null +++ b/scripts/shrfile @@ -0,0 +1,14 @@ +#!/bin/bash + +if [ -z "$1" ] + then + file=$(find . -maxdepth 1 -type f | cut -c 3- | rofi -i -dmenu -p "Select file to share") + else + file=$1 +fi + +if [ -z "$file" ]; then + exit +fi +curl -F "file=@$file" https://0x0.st | xclip -selection c +notify-send "Link to $file is copied to clipboard!" diff --git a/scripts/whereami b/scripts/whereami new file mode 100755 index 0000000..ed234ae --- /dev/null +++ b/scripts/whereami @@ -0,0 +1,7 @@ +#!/bin/bash + +ip=$(curl "https://api.ipify.org" 2>/dev/null) + +res=$(curl -s "http://ip-api.com/json/$ip" 2>/dev/null) +# echo $res | jq '.' +echo $res | jq -r -j '.city, ", ", .country, "\n"'