summaryrefslogtreecommitdiff
path: root/bin/.bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin/.bin')
-rwxr-xr-xbin/.bin/bat_check14
-rwxr-xr-xbin/.bin/dotstow21
-rwxr-xr-xbin/.bin/fixmap2
-rwxr-xr-xbin/.bin/gitit10
-rwxr-xr-xbin/.bin/lay3
-rwxr-xr-xbin/.bin/lay_both2
-rwxr-xr-xbin/.bin/lay_edp2
-rwxr-xr-xbin/.bin/lay_hdmi2
-rwxr-xr-xbin/.bin/lemonconf74
-rwxr-xr-xbin/.bin/light19
-rwxr-xr-xbin/.bin/pcolor3
-rwxr-xr-xbin/.bin/pkg22
-rwxr-xr-xbin/.bin/record10
-rwxr-xr-xbin/.bin/shut11
-rwxr-xr-xbin/.bin/statusbar45
-rwxr-xr-xbin/.bin/sysinfo20
-rwxr-xr-xbin/.bin/temp2
-rwxr-xr-xbin/.bin/unblock8
-rwxr-xr-xbin/.bin/update-resolv-conf.sh71
-rwxr-xr-xbin/.bin/wpa16
20 files changed, 357 insertions, 0 deletions
diff --git a/bin/.bin/bat_check b/bin/.bin/bat_check
new file mode 100755
index 0000000..547b976
--- /dev/null
+++ b/bin/.bin/bat_check
@@ -0,0 +1,14 @@
1#!/bin/bash
2while true
3do
4 battery_level=$(cat /sys/class/power_supply/BAT0/capacity)
5 state=$(cat /sys/class/power_supply/BAT0/status)
6 if [ $battery_level -ge 90 ] && [ $state == "Charging" ]; then
7 notify-send 'Pull the plug!' $battery_level%
8 elif [ $battery_level -le 30 -a $battery_level -ge 20 ] && [ $state == "Discharging" ]; then
9 notify-send 'Plug me!' $battery_level%
10 elif [ $battery_level -le 20 ] && [ $state == "Discharging" ]; then
11 notify-send -u critical 'Plug me NOW!' $battery_level%
12 fi
13 sleep 300 # 300 seconds or 5 minutes
14done
diff --git a/bin/.bin/dotstow b/bin/.bin/dotstow
new file mode 100755
index 0000000..bcadc5e
--- /dev/null
+++ b/bin/.bin/dotstow
@@ -0,0 +1,21 @@
1#!/bin/bash
2
3# This script will Stow all the dotfiles located in the ~/dotfiles folder.
4# The -R flag is used to force a 'restow' which will remove any existing symlinks before attempting to Stow.
5
6echo "Stowing Dotfiles...";
7
8cd ~/dotfiles
9for file in ~/dotfiles/*; do
10 # Only run Stow on the directories in the dotfiles folder and not the individual files.
11 # Using 'basename' strips the filepath from the directory name.
12 if [ -d ${file} ]; then
13 stow -R $(basename $file)
14 echo "$(basename $file) stowed.";
15 fi
16done
17
18# Return back to the your PWD from before you ran the script
19cd ~-
20
21echo 'All stowed';
diff --git a/bin/.bin/fixmap b/bin/.bin/fixmap
new file mode 100755
index 0000000..e937e7c
--- /dev/null
+++ b/bin/.bin/fixmap
@@ -0,0 +1,2 @@
1#!/bin/bash
2setxkbmap -layout us -option caps:ctrl_modifier
diff --git a/bin/.bin/gitit b/bin/.bin/gitit
new file mode 100755
index 0000000..5d576c2
--- /dev/null
+++ b/bin/.bin/gitit
@@ -0,0 +1,10 @@
1#!/bin/sh
2set -e
3printf "\033[0;32mDeploying updates to server...\033[0m\n"
4git add .
5msg="changes"
6if [ -n "$*" ]; then
7 msg="$*"
8fi
9git commit -m "$msg"
10git push origin master
diff --git a/bin/.bin/lay b/bin/.bin/lay
new file mode 100755
index 0000000..b891ab1
--- /dev/null
+++ b/bin/.bin/lay
@@ -0,0 +1,3 @@
1#!/bin/sh
2~/bin/lay_hdmi
3xrandr --output HDMI-1 --primary --mode 1366x768 --pos 0x0 --rotate normal --output eDP-1 --mode 1366x768 --pos 1366x0 --rotate normal
diff --git a/bin/.bin/lay_both b/bin/.bin/lay_both
new file mode 100755
index 0000000..245ff20
--- /dev/null
+++ b/bin/.bin/lay_both
@@ -0,0 +1,2 @@
1#!/bin/sh
2xrandr --output eDP-1 --primary --mode 1366x768 --pos 0x0 --rotate normal --output HDMI-1 --mode 1366x768 --pos 0x0 --rotate normal
diff --git a/bin/.bin/lay_edp b/bin/.bin/lay_edp
new file mode 100755
index 0000000..e83d882
--- /dev/null
+++ b/bin/.bin/lay_edp
@@ -0,0 +1,2 @@
1#!/bin/sh
2xrandr --output eDP-1 --primary --mode 1366x768 --pos 0x0 --rotate normal --output HDMI-1 --off
diff --git a/bin/.bin/lay_hdmi b/bin/.bin/lay_hdmi
new file mode 100755
index 0000000..9f84242
--- /dev/null
+++ b/bin/.bin/lay_hdmi
@@ -0,0 +1,2 @@
1#!/bin/sh
2xrandr --output eDP-1 --off --output HDMI-1 --mode 1366x768 --pos 0x0 --rotate normal
diff --git a/bin/.bin/lemonconf b/bin/.bin/lemonconf
new file mode 100755
index 0000000..cb5e505
--- /dev/null
+++ b/bin/.bin/lemonconf
@@ -0,0 +1,74 @@
1#!/bin/bash
2# Outputs a configuration for lemonbar
3
4vol(){
5 vol=$(pulsemixer --get-volume | awk '{print $1}')
6 mute=$(pulsemixer --get-mute)
7 if [ "$mute" == 1 ]; then
8 echo -e "%{F#787878}vol%{F-} muted "
9 elif [ "$mute" == 0 ]; then
10 echo -e "%{F#787878}vol%{F-} $vol% "
11 fi
12}
13
14bat() {
15 power=$(cat /sys/class/power_supply/BAT0/capacity)
16 status=$(cat /sys/class/power_supply/BAT0/status)
17 if [ "$status" == "Charging" ]; then
18 echo -e "%{F#787878}bat%{F-} +$power% "
19 elif [ "$status" == "Discharging" ]; then
20 echo -e "%{F#787878}bat%{F-} $power% "
21 fi
22}
23
24dte() {
25 dte=$(date +"%a, %b %d")
26 echo -e "%{F#787878}date%{F-} $dte "
27}
28
29tie() {
30 tme=$(date +"%I:%M %P")
31 echo -e "%{F#787878}time%{F-} $tme "
32}
33
34groups() {
35 cur=`xprop -root _NET_CURRENT_DESKTOP | awk '{print $3}'`
36 tot=`xprop -root _NET_NUMBER_OF_DESKTOPS | awk '{print $3}'`
37
38 for w in `seq 0 $((cur - 1))`; do line="${line}  "; done
39 line="${line}  "
40 for w in `seq $((cur + 2)) $tot`; do line="${line}  "; done
41 echo $line
42}
43
44workspaces() {
45 all=$(bspc query -D)
46 occupied=$(bspc query -D -d .occupied)
47 current=$(bspc query -D -d .focused)
48 result=""
49 padding=" "
50 while IFS= read -r line; do
51 # Get the name of the current desktop
52 name=""
53 if [[ "$occupied" == *"$line"* ]];
54 then
55 name=""
56 fi
57
58 if [[ "$current" == *"$line"* ]];
59 then
60 name=""
61 fi
62
63 result="$result$padding"
64 result="$result$name"
65 result="$result$padding"
66 done <<< "$all"
67 echo -e "$result"
68}
69
70while true; do
71 echo " $(vol) $(bat) $(tie) $(dte) %{F#787878}%{r}$(workspaces)%{F-} "
72 xdo above -t $(xdo id -n root) $(xdo id -n lemonbar)
73 sleep 3
74done
diff --git a/bin/.bin/light b/bin/.bin/light
new file mode 100755
index 0000000..bba7e82
--- /dev/null
+++ b/bin/.bin/light
@@ -0,0 +1,19 @@
1#!/bin/bash
2# brightness wrapper
3
4case "$1" in
5 u*)
6 for f in /sys/class/backlight/*; do
7 echo $(($(<$f/brightness)+5*$(<$f/max_brightness)/100)) > $f/brightness;
8 done
9 ;;
10 d*)
11 for f in /sys/class/backlight/*; do
12 echo $(($(<$f/brightness)-5*$(<$f/max_brightness)/100)) > $f/brightness;
13 done
14 ;;
15 *)
16 echo "choose u or d"
17 ;;
18esac
19
diff --git a/bin/.bin/pcolor b/bin/.bin/pcolor
new file mode 100755
index 0000000..4cc28a0
--- /dev/null
+++ b/bin/.bin/pcolor
@@ -0,0 +1,3 @@
1#!/bin/bash
2pcs() { for i in {0..7}; do echo -en "\e[${1}$((30+$i))m \u2588\u2588 \e[0m"; done; }
3printf "\n%s\n%s\n\n" "$(pcs)" "$(pcs '1;')"
diff --git a/bin/.bin/pkg b/bin/.bin/pkg
new file mode 100755
index 0000000..5eea459
--- /dev/null
+++ b/bin/.bin/pkg
@@ -0,0 +1,22 @@
1#!/bin/sh
2
3case "$1" in
4 i*)
5 sudo xbps-install "$@"
6 ;;
7 d*)
8 sudo xbps-remove -R "$@"
9 ;;
10 q*)
11 sudo xbps-query "$@"
12 ;;
13 u*)
14 sudo xbps-install -Syu
15 ;;
16 o*)
17 sudo xbps-remove -Oo
18 ;;
19 *)
20 printf "i - install\nd - delete\nq - query\nu - update\no - remove obs"
21 ;;
22esac
diff --git a/bin/.bin/record b/bin/.bin/record
new file mode 100755
index 0000000..5c6b499
--- /dev/null
+++ b/bin/.bin/record
@@ -0,0 +1,10 @@
1#!/bin/bash
2
3ffmpeg -f x11grab \
4-s 1980x1080 \
5-an -i :0.0 \
6-c:v libvpx \
7-b:v 5M \
8-crf 10 \
9-quality realtime \
10-y ~/record.mkv
diff --git a/bin/.bin/shut b/bin/.bin/shut
new file mode 100755
index 0000000..1fb1295
--- /dev/null
+++ b/bin/.bin/shut
@@ -0,0 +1,11 @@
1#!/bin/bash
2
3RET=$(echo -e "shutdown\nreboot\nsleep\nlock\ncancel" | dmenu -l 5 -p "Sayonara" -nb "#000000" -nf "#bfbfbf" -sb "#84a0c6" -sf "#000000" -fn "Hermit:size=10:antialias=true:autohint=true")
4
5case $RET in
6 shutdown) doas poweroff ;;
7 reboot) doas reboot ;;
8 sleep) xset s activate & doas zzz;;
9 lock) xset s activate ;;
10 *) ;;
11esac
diff --git a/bin/.bin/statusbar b/bin/.bin/statusbar
new file mode 100755
index 0000000..c506244
--- /dev/null
+++ b/bin/.bin/statusbar
@@ -0,0 +1,45 @@
1#!/bin/bash
2
3# Color definitions.
4export BLK="\e[30m"
5export RED="\e[31m"
6export GRN="\e[32m"
7export YLW="\e[33m"
8export BLU="\e[34m"
9export PUR="\e[35m"
10export CYN="\e[36m"
11export RST="\e[0m"
12
13# Other formatting.
14export BLD="\e[1m"
15export DIM="\e[2m"
16export ITA="\e[3m"
17export UND="\e[4m"
18export FLS="\e[5m"
19export REV="\e[7m"
20export INV="\e[8m"
21export STR="\e[9m"
22
23vol(){
24 vol=$(pulsemixer --get-volume | awk '{print $1}')
25 echo -e "vol $vol%"
26}
27
28bat() {
29 power=$(cat /sys/class/power_supply/BAT0/capacity)
30 echo -e "bat $power%"
31}
32
33dte() {
34 dte=$(date +"%A, %B %d")
35 echo -e "date $dte"
36}
37
38tie() {
39 tme=$(date +"%I:%M %p")
40 echo -e "time $tme"
41}
42while :; do
43 echo "$(vol) $(bat) $(tie) $(dte)"
44 sleep 2
45done
diff --git a/bin/.bin/sysinfo b/bin/.bin/sysinfo
new file mode 100755
index 0000000..4f9f456
--- /dev/null
+++ b/bin/.bin/sysinfo
@@ -0,0 +1,20 @@
1#!/bin/bash
2#
3# System info
4
5wm="$(echo $XDG_CURRENT_DESKTOP)"
6distro="$(cat /etc/*-release | grep PRETTY_NAME | cut -d '=' -f2 | tr -d '"')"
7packages="$(xbps-query -l | wc -l)"
8font="jetbrains mono"
9colors="pencil"
10
11printf " \e[0m\n"
12printf " \e[1;34m distro \e[0m$distro\n"
13printf " \e[1;34m pkgs \e[0m$packages\n"
14printf " \e[1;34m wm \e[0m$wm\n"
15printf " \e[1;34m font \e[0m$font $fontsize\n"
16printf " \e[1;34m colors \e[0m$colors\n"
17printf " \e[0m\n"
18
19pcs() { for i in {0..7}; do echo -en "\e[${1}$((30+$i))m \u2588\u2588 \e[0m"; done; }
20printf "\n%s\n%s\n\n" "$(pcs)" "$(pcs '1;')"
diff --git a/bin/.bin/temp b/bin/.bin/temp
new file mode 100755
index 0000000..fec8439
--- /dev/null
+++ b/bin/.bin/temp
@@ -0,0 +1,2 @@
1#!/bin/bash
2paste <(cat /sys/class/thermal/thermal_zone*/type) <(cat /sys/class/thermal/thermal_zone*/temp) | column -s $'\t' -t | sed 's/\(.\)..$/.\1°C/'
diff --git a/bin/.bin/unblock b/bin/.bin/unblock
new file mode 100755
index 0000000..257c4fb
--- /dev/null
+++ b/bin/.bin/unblock
@@ -0,0 +1,8 @@
1#!/bin/sh
2#whitelist escape
3set -e
4printf "\033[0;35mSetting wlo1 down....\033[0m\n"
5sudo ip link set wlo1 down
6printf "\033[0;36mChanging MAC address....\033[0m\n"
7sudo macchanger --mac=FC:77:74:C7:71:71 wlo1
8printf "\033[0;32mEnjoy....\033[0m\n"
diff --git a/bin/.bin/update-resolv-conf.sh b/bin/.bin/update-resolv-conf.sh
new file mode 100755
index 0000000..16622a1
--- /dev/null
+++ b/bin/.bin/update-resolv-conf.sh
@@ -0,0 +1,71 @@
1#!/usr/bin/env bash
2#
3# Parses DHCP options from openvpn to update resolv.conf
4# To use set as 'up' and 'down' script in your openvpn *.conf:
5# up /etc/openvpn/update-resolv-conf
6# down /etc/openvpn/update-resolv-conf
7#
8# Used snippets of resolvconf script by Thomas Hood <jdthood@yahoo.co.uk>
9# and Chris Hanson
10# Licensed under the GNU GPL. See /usr/share/common-licenses/GPL.
11# 07/2013 colin@daedrum.net Fixed intet name
12# 05/2006 chlauber@bnc.ch
13#
14# Example envs set from openvpn:
15# foreign_option_1='dhcp-option DNS 193.43.27.132'
16# foreign_option_2='dhcp-option DNS 193.43.27.133'
17# foreign_option_3='dhcp-option DOMAIN be.bnc.ch'
18# foreign_option_4='dhcp-option DOMAIN-SEARCH bnc.local'
19
20## The 'type' builtins will look for file in $PATH variable, so we set the
21## PATH below. You might need to directly set the path to 'resolvconf'
22## manually if it still doesn't work, i.e.
23## RESOLVCONF=/usr/sbin/resolvconf
24export PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin
25RESOLVCONF=$(type -p resolvconf)
26
27case $script_type in
28
29up)
30 for optionname in ${!foreign_option_*} ; do
31 option="${!optionname}"
32 echo $option
33 part1=$(echo "$option" | cut -d " " -f 1)
34 if [ "$part1" == "dhcp-option" ] ; then
35 part2=$(echo "$option" | cut -d " " -f 2)
36 part3=$(echo "$option" | cut -d " " -f 3)
37 if [ "$part2" == "DNS" ] ; then
38 IF_DNS_NAMESERVERS="$IF_DNS_NAMESERVERS $part3"
39 fi
40 if [[ "$part2" == "DOMAIN" || "$part2" == "DOMAIN-SEARCH" ]] ; then
41 IF_DNS_SEARCH="$IF_DNS_SEARCH $part3"
42 fi
43 fi
44 done
45 R=""
46 if [ "$IF_DNS_SEARCH" ]; then
47 R="search "
48 for DS in $IF_DNS_SEARCH ; do
49 R="${R} $DS"
50 done
51 R="${R}
52"
53 fi
54
55 for NS in $IF_DNS_NAMESERVERS ; do
56 R="${R}nameserver $NS
57"
58 done
59 #echo -n "$R" | $RESOLVCONF -x -p -a "${dev}"
60 echo -n "$R" | $RESOLVCONF -x -a "${dev}.inet"
61 ;;
62down)
63 $RESOLVCONF -d "${dev}.inet"
64 ;;
65esac
66
67# Workaround / jm@epiclabs.io
68# force exit with no errors. Due to an apparent conflict with the Network Manager
69# $RESOLVCONF sometimes exits with error code 6 even though it has performed the
70# action correctly and OpenVPN shuts down.
71exit 0
diff --git a/bin/.bin/wpa b/bin/.bin/wpa
new file mode 100755
index 0000000..89f0141
--- /dev/null
+++ b/bin/.bin/wpa
@@ -0,0 +1,16 @@
1#!/usr/bin/env bash
2#https://github.com/icyphox/bin/blob/master/wpa
3case "$1" in
4 r*)
5 sudo pkill wpa_supplicant
6 sudo wpa_supplicant -i wlp3s0 -B -c /etc/wpa_supplicant/wpa_supplicant.conf
7 ;;
8 n*)
9 sudo wpa_cli -i wlp3s0 select_network "$2"
10 ;;
11 l*)
12 sudo wpa_cli -i wlp3s0 list_networks
13 ;;
14 *)
15 sudo wpa_cli -i wlp3s0 "$*"
16esac