Compare commits
4 Commits
e3bd13a6c8
...
2dba69ed07
Author | SHA1 | Date |
---|---|---|
randomuser | 2dba69ed07 | |
randomuser | bbe9174e88 | |
randomuser | 8594f34cb6 | |
randomuser | 98d0a2fd68 |
1
Makefile
1
Makefile
|
@ -17,7 +17,6 @@ sh:
|
|||
cp -f sh/connect $(DESTDIR)$(PREFIX)/bin
|
||||
cp -f sh/nws $(DESTDIR)$(PREFIX)/bin
|
||||
cp -f sh/vol $(DESTDIR)$(PREFIX)/bin
|
||||
cp -f sh/proxtest $(DESTDIR)$(PREFIX)/bin
|
||||
cp -f sh/pco $(DESTDIR)$(PREFIX)/bin
|
||||
cp -f sh/git-survey $(DESTDIR)$(PREFIX)/bin
|
||||
cp -f sh/vim-swap-handler $(DESTDIR)$(PREFIX)/bin
|
||||
|
|
19
sh/connect
19
sh/connect
|
@ -1,36 +1,37 @@
|
|||
#!/bin/sh
|
||||
|
||||
[ "$(ps -aux | grep -c NetworkManager)" -eq 2 ] && \
|
||||
printf "NetworkManager is already running!" && \
|
||||
[ "$(pgrep -c NetworkManager)" -eq 1 ] &&
|
||||
printf "NetworkManager is already running!\n" &&
|
||||
exit
|
||||
|
||||
case $1 in
|
||||
"c"*)
|
||||
wpa_supplicant -iwlp3s0 -c/etc/wpa_supplicant/wpa_supplicant.conf -B
|
||||
dhcpcd wlp3s0
|
||||
tor & disown
|
||||
# make tor and nohup shut up in a posix-compliant way
|
||||
nohup tor >/dev/null 2>&1
|
||||
;;
|
||||
"d"*)
|
||||
killall -15 wpa_supplicant dhcpcd tor
|
||||
;;
|
||||
"r"*)
|
||||
sh $0 d
|
||||
sh $0 c
|
||||
sh "$0" d
|
||||
sh "$0" c
|
||||
;;
|
||||
"t"*)
|
||||
[ $(ps aux | grep wpa_supplicant | wc -l) -eq 2 ] && sh $0 d && exit
|
||||
sh $0 c
|
||||
[ "$(pgrep -c wpa_supplicant)" -eq 1 ] && sh "$0" d && exit
|
||||
sh "$0" c
|
||||
;;
|
||||
"l"*)
|
||||
iw dev wlp3s0 scan | \
|
||||
grep 'SSID\|signal' | \
|
||||
grep -v '* SSID List' | \
|
||||
grep -v 'SSID List' | \
|
||||
awk -F': ' '{print $2}' | \
|
||||
sed 'N;s/\n/ /' | \
|
||||
grep -v '\x00'
|
||||
;;
|
||||
*)
|
||||
printf "\
|
||||
echo "
|
||||
simple wrapper for connecting to a network
|
||||
${0} toggle to toggle wifi connection
|
||||
${0} restart to restart wifi
|
||||
|
|
4
sh/disp
4
sh/disp
|
@ -1,12 +1,12 @@
|
|||
#!/bin/sh
|
||||
|
||||
exists() {
|
||||
xrandr | grep ' connected' | grep "${1}" | wc -l
|
||||
xrandr | grep ' connected' | grep -c "${1}"
|
||||
}
|
||||
|
||||
bspc monitor -d 1 2 3 4 5 6 7 8 9
|
||||
|
||||
if [ $(exists "HDMI-2") -eq 1 ] && [ $(exists "LVDS-1") -eq 1 ]; then
|
||||
if [ "$(exists "HDMI-2")" -eq 1 ] && [ "$(exists "LVDS-1")" -eq 1 ]; then
|
||||
printf "two"
|
||||
xrandr --output HDMI-2 --right-of LVDS-1 --auto
|
||||
xrandr --output VGA-1 --off --auto
|
||||
|
|
2
sh/fire
2
sh/fire
|
@ -1,3 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
HOME="/home/usr/.local/share/firefox" firefox $@
|
||||
HOME="/home/usr/.local/share/firefox" firefox "$@"
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
#!/bin/sh
|
||||
|
||||
for i in $(ls); do
|
||||
cd $i
|
||||
for i in *; do
|
||||
cd "$i" || continue
|
||||
exists=$(
|
||||
git status |\
|
||||
grep 'Your branch is ahead of ' |\
|
||||
wc -l
|
||||
git status |
|
||||
grep -c 'Your branch is ahead of '
|
||||
)
|
||||
|
||||
[ "$exists" -eq 0 ] || printf "> %s\n" "$i"
|
||||
|
|
2
sh/net
2
sh/net
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
# designed to be called from sxhkd (x session)
|
||||
|
||||
[ "$(pgrep NetworkManager)" ] && st -e nmtui
|
||||
pgrep NetworkManager && st -e nmtui
|
||||
|
|
33
sh/nws
33
sh/nws
|
@ -3,8 +3,8 @@
|
|||
[ -z "${XDG_CONFIG_DIR}" ] && XDG_CONFIG_DIR="${HOME}/.config"
|
||||
[ -z "${NWS_CONFIG}" ] && NWS_CONFIG="${XDG_CONFIG_DIR}/nws"
|
||||
[ -n "${NWS_ZONE}" ] || \
|
||||
[ -e ${NWS_CONFIG} ] && NWS_ZONE=$(cat ${NWS_CONFIG}) || \
|
||||
NWS_ZONE="KGYX"
|
||||
[ -e "${NWS_CONFIG}" ] && NWS_ZONE=$(cat "${NWS_CONFIG}") ||
|
||||
NWS_ZONE="KGYX"
|
||||
[ -z "${NWS_GIF}" ] && NWS_GIF="mpv --loop"
|
||||
[ -z "${NWS_TORIFY}" ] && NWS_TORIFY=""
|
||||
|
||||
|
@ -28,9 +28,9 @@ Torify wrapper: export NWS_TORIFY=<command>
|
|||
"
|
||||
}
|
||||
err () {
|
||||
printf "err: %s\n" ${1}
|
||||
printf "err: %s\n" "${1}"
|
||||
[ -z "${2}" ] && exit 1
|
||||
exit ${2}
|
||||
exit "${2}"
|
||||
}
|
||||
kstrip () {
|
||||
printf %s "$1" | sed 's/^K\(.*\)/\1/'
|
||||
|
@ -43,10 +43,10 @@ localradar () {
|
|||
mosaic ${NWS_ZONE}
|
||||
}
|
||||
mosaic () {
|
||||
${NWS_GIF} "https://radar.weather.gov/ridge/lite/${1}_loop.gif"
|
||||
${NWS_GIF} "https://radar.weather.gov/ridge/standard/${1}_loop.gif"
|
||||
}
|
||||
setzone () {
|
||||
printf "%s" "${1}" > ${NWS_CONFIG}
|
||||
printf "%s" "${1}" > "${NWS_CONFIG}"
|
||||
}
|
||||
river () {
|
||||
textmessage "RVA"
|
||||
|
@ -66,36 +66,39 @@ textmessage () {
|
|||
case $1 in
|
||||
"n"*)
|
||||
national
|
||||
exit 0
|
||||
;;
|
||||
"l"*)
|
||||
localradar
|
||||
exit 0
|
||||
;;
|
||||
"r"*)
|
||||
river
|
||||
exit 0
|
||||
;;
|
||||
"w"*)
|
||||
weather
|
||||
exit 0
|
||||
;;
|
||||
"m"*)
|
||||
[ $# -eq 2 ] && mosaid $2 || \
|
||||
if [ "$#" -eq 2 ]; then
|
||||
mosaid "$2"
|
||||
else
|
||||
err "two args required"
|
||||
fi
|
||||
;;
|
||||
"s"*)
|
||||
[ $# -eq 2 ] && setzone $2 || \
|
||||
if [ "$#" -eq 2 ]; then
|
||||
setzone "$2"
|
||||
else
|
||||
err "two args required"
|
||||
exit 0
|
||||
fi
|
||||
;;
|
||||
"t"*)
|
||||
[ $# -eq 2 ] && textmessage $2 || \
|
||||
if [ "$#" -eq 2 ]; then
|
||||
textmessage "$2"
|
||||
else
|
||||
err "two args required"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
info
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
exit 0
|
||||
|
|
|
@ -4,4 +4,4 @@ sel="$(pash l | tmenu)"
|
|||
[ "$?" -eq 1 ] && exit 0
|
||||
|
||||
# requires bspc rule -a st-gpg-menu state=floating
|
||||
st -c st-gpg-menu -e pash-dmenu-backend $sel
|
||||
st -c st-gpg-menu -e pash-dmenu-backend "$sel"
|
||||
|
|
79
sh/proxtest
79
sh/proxtest
|
@ -1,79 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
output_as_proxychains=1
|
||||
randomize=1
|
||||
choose=0
|
||||
outputted_proxies=""
|
||||
temp_output=$(mktemp)
|
||||
while getopts ":pt:rc:" options; do
|
||||
case $options in
|
||||
p)
|
||||
output_as_proxychains=0
|
||||
;;
|
||||
t)
|
||||
temp_output=$OPTARG
|
||||
;;
|
||||
r)
|
||||
randomize=0
|
||||
;;
|
||||
c)
|
||||
choose=$OPTARG
|
||||
;;
|
||||
:)
|
||||
printf "specify argument\n"
|
||||
exit
|
||||
;;
|
||||
*)
|
||||
printf "what has happened\n"
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# get the tor port number using this lsof incantination
|
||||
torport=$(\
|
||||
sudo lsof -nP -iTCP -sTCP:LISTEN | \
|
||||
grep tor | \
|
||||
awk -F'[ :]+' 'NR = 1 {print $10}'
|
||||
)
|
||||
|
||||
curl --silent --preproxy socks5://127.0.0.1:$torport https://raw.githubusercontent.com/hookzof/socks5_list/master/proxy.txt -o $temp_output
|
||||
|
||||
printf "estimated worsecase run time: %i seconds\n" $(wc -l $temp_output | awk -F' ' '{print $1}') 1>&2
|
||||
|
||||
looped=$(\
|
||||
cat $temp_output | \
|
||||
( [ $randomize -eq 0 ] && shuf || cat ) | \
|
||||
( [ $choose -ne 0 ] && head -n $choose || cat ) | \
|
||||
tr '\n' ' ' | \
|
||||
tr -d '\r'
|
||||
)
|
||||
|
||||
for i in $looped; do
|
||||
ip=$(printf $i | awk -F':' '{print $1}')
|
||||
port=$(printf $i | awk -F':' '{print $2}' | tr -d '\r')
|
||||
|
||||
# TODO: timeout is a non-posix gnu extension, remove/replace it
|
||||
timeout 2s nc -zv -x 127.0.0.1:$torport $ip $port 2>/dev/null 1>&2 && \
|
||||
outputted_proxies="$outputted_proxies $i" && \
|
||||
printf "success! %s\n" $i 1>&2 || \
|
||||
printf "failure! %s\n" $i 1>&2
|
||||
done
|
||||
|
||||
if [ $output_as_proxychains -eq 0 ]; then
|
||||
printf "# generated by proxtest.sh @ %s\n" "$(date)"
|
||||
printf "random_chain\nproxy_dns\nchain_len = 5\n"
|
||||
printf "tcp_read_time_out 15000\ntcp_connect_time_out 8000\n"
|
||||
printf "[ProxyList]\n"
|
||||
|
||||
# assumes all socks5 proxies, change this in future
|
||||
for i in $outputted_proxies; do
|
||||
printf "socks5 %s\n" "$(printf %s $i | tr ':' ' ')"
|
||||
done
|
||||
|
||||
printf "# finished!\n"
|
||||
else
|
||||
for i in $outputted_proxies; do
|
||||
printf "%s\n" $i
|
||||
done
|
||||
fi
|
|
@ -5,15 +5,13 @@
|
|||
|
||||
printf "[info] this utility is used for adding youtube urls as rss feeds\n"
|
||||
|
||||
feed="$(curl ${1} -s | \
|
||||
feed="$(curl "$1" -s | \
|
||||
grep 'youtube/www\.youtube\.com/channel/.\{24\}' -o | \
|
||||
awk -F'/' '{print "https://www.youtube.com/feeds/videos.xml?channel_id=" $NF}' | \
|
||||
sed 1q)"
|
||||
|
||||
[ -z "$feed" ] && printf "[err] error processing the feed. are you sure it's *www*.youtube.com and not youtube.com?\n" && exit 1
|
||||
|
||||
tmp="$(mktemp)"
|
||||
|
||||
sfeedrc="$HOME/.config/sfeed/sfeedrc"
|
||||
|
||||
ed "$sfeedrc" <<EOF
|
||||
|
|
|
@ -4,7 +4,7 @@ power_prefix="/sys/class/power_supply/"
|
|||
[ -d "${power_prefix}sbs-20-000b" ] && bat="sbs-20-000b"
|
||||
[ -d "${power_prefix}BAT0" ] && bat="BAT0"
|
||||
|
||||
[ "$(ps aux | grep pulseaudio | wc -l)" -eq 2 ] && ss="pulse" || ss="alsa"
|
||||
[ "$(pgrep -c pulseaudio)" -eq 1 ] && ss="pulse" || ss="alsa"
|
||||
|
||||
mod_bspwm () {
|
||||
used_desk=$(bspc query -D -d .occupied --names | tr '\n' ' ')
|
||||
|
@ -67,7 +67,7 @@ echo_bar () {
|
|||
printf "\033[2J\033[H%s" "$left"
|
||||
|
||||
# print right side
|
||||
printf "\033[1;%if%s" "$(($width - $rightwidth + 1))" "$right"
|
||||
printf "\033[1;%if%s" "$((width - rightwidth + 1))" "$right"
|
||||
}
|
||||
|
||||
register_sigs () {
|
||||
|
@ -94,5 +94,5 @@ while true; do
|
|||
sleep 0.25
|
||||
[ "$i" -eq $((29 * 4)) ] && update_all && i=0
|
||||
echo_bar
|
||||
i="$(($i + 1))"
|
||||
i="$((i + 1))"
|
||||
done
|
||||
|
|
|
@ -3,10 +3,12 @@
|
|||
barwidth=20
|
||||
|
||||
# remove all current statusbars
|
||||
# pgrep doesn't handle arguments for running commands
|
||||
# shellcheck disable=2009
|
||||
processes="$(ps aux | grep 'st -c' | grep 'status' | awk -F' ' '{print $2}')"
|
||||
for i in $processes; do
|
||||
pkill -P "$i" 2>&1 > /dev/null
|
||||
kill $i
|
||||
pkill -P "$i" >/dev/null 2>&1
|
||||
kill "$i"
|
||||
done
|
||||
|
||||
# get all screens
|
||||
|
@ -16,6 +18,6 @@ screens="$(xrandr | grep ' connected' | sed 's/ primary//g' | awk -F' ' '{print
|
|||
IFS="
|
||||
"
|
||||
for i in $screens; do
|
||||
screenstring=$(echo $i | awk -v a="$barwidth" -F'[ x+]' '{print $2 "x" a "+" $4 "+" $5}')
|
||||
screenstring=$(echo "$i" | awk -v a="$barwidth" -F'[ x+]' '{print $2 "x" a "+" $4 "+" $5}')
|
||||
st -c statusbar -p -g "$screenstring" -e status &
|
||||
done
|
||||
|
|
2
sh/tmenu
2
sh/tmenu
|
@ -3,6 +3,6 @@
|
|||
file=$(mktemp)
|
||||
cat - > "$file"
|
||||
|
||||
st -c tmenu-prompt -g 40x10+0+0 -e tmenu-backend "$file" "$1"
|
||||
st -c tmenu-prompt -g 40x10+0+0 -e tmenu-backend "$file"
|
||||
cat "$file"
|
||||
rm "$file"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
printf "%s" $1
|
||||
printf "%s" "$1"
|
||||
|
||||
fzy $2 < "$1" > "${1}a"
|
||||
mv ${1}a ${1}
|
||||
fzy < "$1" > "${1}a"
|
||||
mv "${1}a" "${1}"
|
||||
|
|
|
@ -4,9 +4,9 @@ tmenu_path () {
|
|||
IFS=" :"
|
||||
for i in $PATH; do
|
||||
for j in "$i"/*; do
|
||||
[ -f $j ] && [ -x $j ] && printf "%s\n" $j
|
||||
[ -f "$j" ] && [ -x "$j" ] && printf "%s\n" "$j"
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
tmenu_path | tmenu "$@" | ${SHELL:-"/bin/sh"} &
|
||||
tmenu_path | tmenu | ${SHELL:-"/bin/sh"} &
|
||||
|
|
|
@ -19,7 +19,7 @@ desk=$(
|
|||
)
|
||||
|
||||
[ "$desk" = "none" ] && exit 1
|
||||
desk=$(($desk + 1))
|
||||
desk=$((desk + 1))
|
||||
|
||||
bspc desktop -f "^${desk}"
|
||||
killall -10 simplestatus
|
||||
|
|
8
sh/vol
8
sh/vol
|
@ -1,16 +1,16 @@
|
|||
#!/bin/sh
|
||||
|
||||
pulse=$(ps aux | grep pulseaudio | wc -l)
|
||||
pulse=$(pgrep -c pulseaudio)
|
||||
|
||||
[ "$1" = "inc" ] && sign="+"
|
||||
[ "$1" = "dec" ] && sign="-"
|
||||
|
||||
[ "$#" -eq 0 ] && exit 1
|
||||
|
||||
if [ "$pulse" -eq 2 ]; then
|
||||
for SINK in `pacmd list-sinks | grep 'index:' | cut -b12-`
|
||||
if [ "$pulse" -eq 1 ]; then
|
||||
for SINK in $(pacmd list-sinks | grep 'index:' | cut -b12-)
|
||||
do
|
||||
pactl set-sink-volume $SINK "${sign}5%"
|
||||
pactl set-sink-volume "$SINK" "${sign}5%"
|
||||
done
|
||||
else
|
||||
amixer -c 0 set Master "5%${sign}"
|
||||
|
|
30
sh/wallpaper
30
sh/wallpaper
|
@ -1,12 +1,11 @@
|
|||
#!/bin/sh
|
||||
|
||||
WALLDIR="${HOME}/.local/share/wallpapers"
|
||||
TEEFILE="${WALLDIR}/.hist"
|
||||
BASECMD="feh --no-fehbg --bg-fill"
|
||||
|
||||
generate_wall () {
|
||||
GENWALL=$( \
|
||||
ls $WALLDIR | \
|
||||
ls "$WALLDIR" | \
|
||||
grep "." | \
|
||||
shuf -n 1
|
||||
)
|
||||
|
@ -19,26 +18,15 @@ wall () {
|
|||
done
|
||||
}
|
||||
displays () {
|
||||
displays=$(xrandr | grep ' connected' | wc -l)
|
||||
}
|
||||
check () {
|
||||
which $1 &>/dev/null
|
||||
displays=$(xrandr | grep -c ' connected')
|
||||
}
|
||||
|
||||
cmd=""
|
||||
check "feh" || exit 1
|
||||
if check "xrandr"; then
|
||||
displays
|
||||
for i in $(seq 1 $displays); do
|
||||
wall ${tmp}
|
||||
tmp=${GENWALL}
|
||||
echo ${GENWALL} ${i} | tee $TEEFILE
|
||||
cmd="${cmd} ${GENWALL}"
|
||||
done
|
||||
eval ${BASECMD} ${cmd}
|
||||
else
|
||||
generate_wall
|
||||
eval ${BASECMD} ${GENWALL}
|
||||
fi
|
||||
unset GENWALL BASECMD tmp cmd displays i
|
||||
displays
|
||||
for i in $(seq 1 "$displays"); do
|
||||
wall "${tmp}"
|
||||
tmp="${GENWALL}"
|
||||
cmd="${cmd} ${GENWALL}"
|
||||
done
|
||||
eval "${BASECMD}" "${cmd}"
|
||||
exit 0
|
||||
|
|
Loading…
Reference in New Issue