aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rw-r--r--bin/.gitignore2
-rwxr-xr-xbin/4k-addmode.sh26
-rw-r--r--bin/Makefile31
-rwxr-xr-xbin/OpenBSDStatus.sh108
-rw-r--r--bin/backlight.c176
-rwxr-xr-xbin/day2
-rwxr-xr-xbin/ddmenu24
-rwxr-xr-xbin/mouse-props32
-rwxr-xr-xbin/night2
-rwxr-xr-xbin/rot48
-rwxr-xr-xbin/snipmenu19
-rwxr-xr-xbin/status-bar204
-rwxr-xr-xbin/touchpad-props32
-rwxr-xr-xbin/wallpaper8
-rwxr-xr-xbin/wpa59
-rw-r--r--bin/zzz.c87
16 files changed, 0 insertions, 860 deletions
diff --git a/bin/.gitignore b/bin/.gitignore
deleted file mode 100644
index 4711d71..0000000
--- a/bin/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-zzz
-backlight
diff --git a/bin/4k-addmode.sh b/bin/4k-addmode.sh
deleted file mode 100755
index ca5b712..0000000
--- a/bin/4k-addmode.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-help() {
-cat <<EOF
-$0 [-d <display_name>] [-x <x>] [-y <y>] [-ref <rate>]
-'xrandr' with no arguments will give you a listing.
-EOF
-printf 'Defaults: x: %-6d y: %-6d ref: %-6.2f\n' "$x" "$y" "$ref"
-exit 1
-}
-display=DisplayPort-0
-x=3840
-y=2160
-ref=110.00
-while [ $# -gt 0 ] ; do case $1 in
- -d) display="$2" ; shift ; shift ;;
- -x) x="$2"; shift ; shift ;;
- -y) y="$2"; shift ; shift ;;
- -ref) ref="$(printf "%0.2f" "$2")"; shift ; shift ;;
- *) help;;
-esac ; done
-modename="${x}x${y}_$ref"
-mdline="$(cvt "$x" "$y" "$ref" | sed -ne's/^Modeline "[^"]*"//p')"
-#shellcheck disable=SC2086
-xrandr --newmode "$modename" $mdline
-xrandr --addmode "$display" "$modename"
-xrandr --output "$display" --mode "$modename"
diff --git a/bin/Makefile b/bin/Makefile
deleted file mode 100644
index 56afbe8..0000000
--- a/bin/Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-WHEEL ?= wheel
-
-default: install
-
-install-zzz: zzz
- install -D -o root -g $(WHEEL) -m 755 zzz /sbin/
- chmod 6750 /sbin/zzz
-
-install-linux: backlight
- install -D -o root -g $(WHEEL) -m 755 backlight /sbin/
- chmod 6750 /sbin/backlight
-
-linux:
- install wpa $(HOME)/bin
- install touchpad-props $(HOME)/bin
-
-OpenBSD:
- install OpenBSDStatus.sh $(HOME)/bin/
-
-install:
- install -d $(HOME)/bin
- sed "s|__REPLACE__|$$(dirname `pwd`)/snips|g" < snipmenu > $(HOME)/bin/snipmenu
- chmod +x $(HOME)/bin/snipmenu
- install day $(HOME)/bin/
- install ddmenu $(HOME)/bin/
- install night $(HOME)/bin/
- install wallpaper $(HOME)/bin/
- install status-bar $(HOME)/bin/
- install vol $(HOME)/bin/
- install 4k-addmode.sh $(HOME)/bin/
-
diff --git a/bin/OpenBSDStatus.sh b/bin/OpenBSDStatus.sh
deleted file mode 100755
index 738f11f..0000000
--- a/bin/OpenBSDStatus.sh
+++ /dev/null
@@ -1,108 +0,0 @@
-#!/bin/sh
-timeout=1
-
-_sys_memory() {
- vmstat | sed -n '$p' | awk '{print $4}'
-}
-
-_sys_uptime() {
-uptime | sed -re's/^.*up[ ]+//g' -e's/^([^,]*),.*/\1/g' -e's/^([^ ]+)[ ]*(.).*/\1\2/g'
-}
-
-wireless_info() {
- _if="$1"
-
- printf "WiFi: %s %s %s %s" \
- "$_if" \
- "$(ifconfig "$_if" | sed -nre 's/^.*nwid ([^ ]+).*$/\1/p')" \
- "$(ifconfig "$_if" | sed -nre 's/^.* ([^ ]+dBm) .*$/\1/p')" \
- "$(ifconfig "$_if" | sed -nre 's/^.*inet ([^ ]+).*$/\1/p')"
-}
-
-eth_info() {
- _if="$1"
-
- printf "Eth: %s %s %s" \
- "$_if" \
- "$(ifconfig "$_if" | sed -nre 's/^.*inet ([^ ]+).*$/\1/p')"
- "$(ifconfig "$_if" | grep -oE '[0-9]+baseT')"
-}
-
-network_info() {
- default_if="$(netstat -rnf inet | awk '/^default/{print $8}')"
-
- if [ -z "$default_if" ] ; then
- echo "No conn"
- elif ifconfig "$default_if" | grep -q IEEE802.11 ; then
- wireless_info "$default_if"
- else
- eth_info "$default_if"
- fi
-}
-
-
-ac_status() {
- if [ `apm -a` -eq 1 ] ; then
- echo "charging"
- else
- printf "discharging "
-
- if [ `apm -m` != "unknown" ] ; then
- minutes="$(apm -m)"
- hours="$(echo "$minutes"/60 | bc)"
- hours2="$(echo "$minutes"/60 | bc -l)"
- minutes="$(echo "(${hours2}-${hours})*60" | bc -l )"
- printf "%d hours, %d minutes left" "$hours" "$minutes"
- fi
- fi
-}
-
-cpu_temp() {
- sysctl hw.sensors.cpu0.temp0 \
- | awk -F= '{print $2}' \
- | cut -d' ' -f 1 \
- | cut -d'.' -f 1 \
- | tr -d '\n'
- printf "c"
-}
-
-cpu_fan() {
- sysctl hw \
- | grep fan \
- | awk -F= '{print $2;exit}' \
- | cut -d' ' -f 1 \
- | tr -d '\n'
- printf "rpm"
-}
-
-get_status_simple() {
-echo \
- "Volume: $(sndioctl | awk 'BEGIN{FS="="}{if($1 ~ /output.level/){print ($2+0)*100}}') |"\
- "Fan: $(cpu_fan) |"\
- "Temp: $(cpu_temp) |"\
- "Setperf: $(sysctl hw.setperf | awk -F= '{print $2}') |"\
- "Batt: $(apm -l) $(ac_status)|"\
- "$(network_info) |"\
- "$(date '+%m.%d.%Y %H:%M:%S')"
-}
-
-get_status() {
-echo \
- "Volume: $(sndioctl | awk 'BEGIN{FS="="}{if($1 ~ /output.level/){print ($2+0)*100}}')|"\
- "Temp: $(sysctl hw.sensors.cpu0.temp0 | awk -F= '{print $2}')|"\
- "Fan: $(sysctl hw | grep fan | awk -F= '{print $2;exit}')|"\
- "Cpu Freq: $(sysctl hw.cpuspeed | awk -F= '{print $2}')mhz|"\
- "Setperf: $(sysctl hw.setperf | awk -F= '{print $2}')|"\
- "Batt: $(apm -l) $(ac_status)|"\
- "$(network_info) |"\
- "Free Mem: $(_sys_memory)|"\
- "uptime: $(_sys_uptime)|"\
- "$(date '+%m.%d.%Y %H:%M:%S')"
-}
-
-while true ; do
-
-xsetroot -name "$(get_status_simple)"
-
-sleep "$timeout"
-done
diff --git a/bin/backlight.c b/bin/backlight.c
deleted file mode 100644
index 497fd72..0000000
--- a/bin/backlight.c
+++ /dev/null
@@ -1,176 +0,0 @@
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stdlib.h>
-#include <limits.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <dirent.h>
-
-#define BACKLIGHT_DIR "/sys/class/backlight"
-
-void
-die(const char *msg)
-{
- puts(msg);
- exit(1);
-}
-
-void
-err(const char *msg)
-{
- perror(msg);
- exit(1);
-}
-
-void*
-ecalloc(size_t nmemb, size_t size)
-{
- void *ret = calloc(nmemb, size);
- if (!ret)
- err("ecalloc");
- return ret;
-}
-
-char*
-appendStr(size_t len, const char *a, const char *b)
-{
- char *buf = ecalloc(len, sizeof(char));
- int ret = snprintf(buf, len, "%s%s", a, b);
- if (ret == -1 || ret > len)
- err("snprintf");
- return buf;
-}
-
-/* returns errno */
-int
-maxBrightness(const char *prefix, long *max)
-{
- int e;
- char *buf = appendStr(256, prefix, "/max_brightness");
-
- int fd = open(buf, O_RDONLY);
- if (fd == -1) {
- e = errno;
- free(buf);
- return e;
- }
-
- memset(buf, '\0', 256);
-
- int b = read(fd, buf, 256);
- if (b==-1) {
- e = errno;
- free(buf);
- close(fd);
- return e;
- }
-
- for (int i=0; i<256 ; i++) {
- if (buf[i] == '\n') {
- buf[i] = '\0';
- break;
- }
- }
-
- long n = strtol(buf, NULL, 10);
- if (n == LONG_MIN || n == LONG_MAX || n == 0)
- err("strtol");
-
- free(buf);
- buf = NULL;
- close(fd);
- *max = n;
-
- return 0;
-}
-
-int
-setBacklight(const char *prefix, int percent)
-{
- char *fn = appendStr(256, prefix, "/brightness");
-
- int fd = open(fn, O_WRONLY);
- if (fd == -1) {
- free(fn);
- return -1;
- }
-
- int n = dprintf(fd, "%d\n", percent);
- if (n == -1) {
- close(fd);
- free(fn);
- return -1;
- }
-
- close(fd);
- free(fn);
- fn = NULL;
-
- return 0;
-}
-
-int
-main(int argc, char **argv)
-{
- uid_t euid = geteuid();
- char **a = argv+1;
-
- if (euid != 0)
- die("Program must be run as root/setuid");
-
- if (!*a)
- die("Brightness percentage must be supplied");
-
-
- long percent = strtol(*a, NULL, 10);
- if (percent <= LONG_MIN || percent >= LONG_MAX)
- err("invalid percent");
- if (percent < 0 || percent > 100)
- die("percent must be between 0 and 100");
-
- DIR *d = opendir(BACKLIGHT_DIR);
- if (!d)
- err("opendir");
-
- errno = 0;
- for (;;) {
- struct dirent *dent = readdir(d);
- if(!dent&&errno!=0)
- err("readdir");
-
- if (!dent)
- break;
-
- if (strcmp("..", dent->d_name)==0 || strcmp(".", dent->d_name)==0)
- continue;
-
- char *prefix = appendStr(1024, BACKLIGHT_DIR"/", dent->d_name);
-
- printf("found backlight: %s\n", prefix);
-
- int ret;
- long max = 0;
- ret = maxBrightness(prefix, &max);
- if (ret != 0) {
- const char *msg = strerror(ret);
- printf("Error getting max brightness for: %s : %s\n",
- prefix, msg);
- free(prefix);
- prefix = NULL;
- continue;
- }
-
- float p = (double)max*((double)percent/100.0);
-
- ret = setBacklight(prefix, (int)p);
- if (ret != 0) {
- perror("setBacklight");
- }
-
- free(prefix);
- prefix = NULL;
- }
-}
diff --git a/bin/day b/bin/day
deleted file mode 100755
index 80186c6..0000000
--- a/bin/day
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-redshift -x
diff --git a/bin/ddmenu b/bin/ddmenu
deleted file mode 100755
index 3682139..0000000
--- a/bin/ddmenu
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh
-# dmenu for dmenus
-command="$(dmenu "$@" <<EOF
-pass
-pass-type
-otp
-otp-type
-snip
-snip-type
-dmenu_run
-pm
-EOF
-)"
-
-case $command in
- pass) dpw-menu "$@" ;;
- pass-type) dpw-menu --type "$@" ;;
- otp) dpw-menu --otp "$@" ;;
- otp-type) dpw-menu --otp --type "$@" ;;
- snip) snipmenu copy "$@" ;;
- snip-type) snipmenu "$@" ;;
- dmenu_run) dmenu_run "$@" ;;
- pm) pm "$@" ;;
-esac
diff --git a/bin/mouse-props b/bin/mouse-props
deleted file mode 100755
index 1fb79ae..0000000
--- a/bin/mouse-props
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/sh
-
-mice="$(xinput list --name-only | grep -E 'Logitech G305|Naga Pro|Orochi V2|Viper' )"
-
-proplist='Accel Profile Enabled::0 1
-Accel Speed::0'
-# Accel Speed::-0.7'
-
-IFS='
-'
-
-for device in $mice ; do
- props=$(xinput --list-props "pointer:$device")
-
- for prop in $proplist ; do
- propName="$(echo "$prop" | awk -F:: '{print $1}')"
- propVal="$(echo "$prop" | awk -F:: '{print $2}')"
-
- prop="$(echo "$props" |
- sed -rne 's/^.*'"$propName"' \(([0-9]+).*$/\1/ip')"
- oldIFS="$IFS"
- IFS=' '
-
- #shellcheck disable=SC2086
- xinput --set-prop "pointer:$device" "$prop" $propVal
- #shellcheck disable=SC2086
- echo xinput --set-prop "pointer:$device" "$prop" $propVal
-
- IFS="$oldIFS"
- done
-done
-
diff --git a/bin/night b/bin/night
deleted file mode 100755
index 633353a..0000000
--- a/bin/night
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-redshift -P -O 3500K
diff --git a/bin/rot b/bin/rot
deleted file mode 100755
index 121471d..0000000
--- a/bin/rot
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/sh
-set -x
-
-IFS="
-"
-
-devices="$(xinput list --name-only | grep Wacom)"
-
-setTransform() {
- for d in $devices ; do
- xinput set-prop "$d" --type=float \
- "Coordinate Transformation Matrix" \
- "$@"
- done
-}
-
-while [ $# -gt 0 ] ; do case $1 in
- left)
- setTransform \
- 0 -1 1 1 0 0 0 0 1
- xrandr -o left
- shift
- ;;
- right)
- setTransform \
- 0 1 0 -1 0 1 0 0 1
- xrandr -o right
- shift
- ;;
- normal)
- setTransform \
- 0 0 0 0 0 0 0 0 0
- xrandr -o normal
- shift
- ;;
- inverted)
- setTransform \
- -1 0 1 0 -1 1 0 0 1
- xrandr -o inverted
- shift
- ;;
- *)
- echo Unknown option "$1";
- shift
- exit 1
- ;;
-esac ; done
-
diff --git a/bin/snipmenu b/bin/snipmenu
deleted file mode 100755
index bd54f7d..0000000
--- a/bin/snipmenu
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-set -e
-snipdir="__REPLACE__"
-act='type'
-
-while [ $# -gt 0 ] ; do case $1 in
- -s) snipdir="$2"; shift ; shift ;;
- copy) act='copy' ; shift ;;
- type) act='type' ; shift ;;
- *) break ;;
-esac ; done
-
-cd "$snipdir"
-_file=$(find -L . \! -type d | dmenu "$@")
-
-case $act in
-copy) xclip -selection clipboard < "$_file" ;;
-type) xdotool type --delay 1ms --clearmodifiers --file "$_file" ;;
-esac
diff --git a/bin/status-bar b/bin/status-bar
deleted file mode 100755
index 30fdbd7..0000000
--- a/bin/status-bar
+++ /dev/null
@@ -1,204 +0,0 @@
-#!/bin/sh
-timeout=10
-
-_sys_memory() {
- free -m | awk '/^Mem/{print $6;exit 0;}'
-}
-
-_sys_uptime() {
-uptime | sed -re's/^.*up[ ]+//g' -e's/^([^,]*),.*/\1/g' -e's/^([^ ]+)[ ]*(.).*/\1\2/g'
-}
-
-wireless_info() {
- _if="$1"
-
- printf "WiFi: %s %s %s %s" \
- "$_if" \
- "$(nmcli c | awk "/$_if/"'{print $1}')" \
- "$(ip -4 addr show dev "$_if" | awk '/inet /{print $2}')" \
- "$(awk "/^$_if/"'{print $4+0}' /proc/net/wireless)dbm"
-}
-
-eth_info() {
- _if="$1"
-
- printf "Eth: %s %s %s" \
- "$_if" \
- "$(ip -4 addr show dev "$_if" | awk '/inet /{print $2}')" \
- ""
-
- # "$(ifconfig "$_if" | grep -oE '[0-9]+baseT')"
-}
-
-network_info() {
- # default_if="$(netstat -rnf inet | awk '/^default/{print $8}')"
- default_if="$(ip route | awk '/^default/{print $5;exit 0;}')"
-
- if [ -z "$default_if" ] ; then
- echo "No conn"
- elif [ -d "/sys/class/net/$default_if/wireless" ] ; then
- wireless_info "$default_if"
- else
- eth_info "$default_if"
- fi
-}
-
-
-pine_batt_status() {
- cat \
- /sys/class/power_supply/axp20x-battery/capacity \
- /sys/class/power_supply/axp20x-battery/status
-}
-
-batt_status() {
- # sudo tlp-stat -b | awk 'BEGIN{ORS=" "} /\/status/{print $3}/^Charge/{print $3}';
- batt="BAT0"
- supplyN="AC"
- while [ $# -gt 0 ] ; do case $1 in
- -b) batt="$2"; shift ; shift ;;
- -s) supplyN="$2"; shift ; shift ;;
- *) exit 2;
- esac ; done
- printf "%s %s" \
- "$(cat "/sys/class/power_supply/$batt/capacity")" \
- "$(charging_status -s "$supplyN")"
-}
-
-charging_status() {
- supplyN="AC"
- while [ $# -gt 0 ] ; do case $1 in
- -s) supplyN="$2"; shift ; shift ;;
- *) exit 2;
- esac ; done
- online_f="/sys/class/power_supply/$supplyN/online"
- online="$(cat "$online_f")"
- if [ "$online" = "1" ] ; then
- printf "Charging"
- elif [ "$online" = "0" ] ; then
- printf "Discharging"
- else
- printf "Unknown charging status"
- fi
-}
-
-cpu_freq() {
-# cat /proc/cpuinfo | grep '^cpu MHz' | awk '{print $4}' | sort -nr | sed 1q
-# Average out the CPU frequency
-# cat /proc/cpuinfo | awk 'BEGIN{n=0;mhz=0;}/^cpu MHz/{mhz += $4;n++;}END{print mhz/n;}'
-# Max/min
-# cat /proc/cpuinfo \
-# | grep '^cpu MHz' \
-# | sort -rnk 4,4 \
-# | sed -n -e 1p -e '$p' \
-# | awk '{printf("%0.2f ", $4/1000)} END{print ""}'
-# Just show the first four CPUs
-# grep '^cpu MHz' /proc/cpuinfo \
-# | awk '{printf("%0.1f\n", $4/1000)}' \
-# | sort \
-# | uniq \
-# | sort -rn \
-# | sed 4q \
-# | tr '\n' ' '
-#
-grep '^cpu MHz' /proc/cpuinfo \
-| awk '{
- average = average + $4;
- counter = counter + 1
-} END {
- printf("%0.1f\n", (average/counter)/1000)
-}'
-}
-
-tlp_status() {
-tlp-stat -s | sed -n 's/^Mode *= //p'
-}
-
-_fan() {
- sensors | sed -n 's/^fan1:[\t ]*//p'
-}
-
-k10Temp() {
-sensors | sed -n '/^k10/,/^$/p' | awk '/^Tctl/{print $2}' \
- | sed -e's/+//g' -e's/\.[0-9][^0-9]*$//g'
-}
-
-core_0_temp() {
-sensors | grep 'Core 0' | awk '{print $3}' | grep -oE '[0-9.]*'
-}
-
-pine_Temp() {
- sensors | sed -n -e 's/^temp1[ \t:]*//p' | sed 1q
-}
-
-pine_status_line() {
-echo \
-"Batt: $(pine_batt_status)|"\
-"Temp: $(pine_Temp)|"\
-"$(network_info)|"\
-"$(date '+%m.%d.%Y %H:%M:%S')"
-}
-
-status_line() {
-echo \
-"Temp: $(sensors | sed -n 's/^temp1:[\t ]*//p' | sed 's/ *//g' | sed 1q | tr -d '\n')|"\
-
-"Fan: $(_fan)|"\
-"Cpu Freq: $(cpu_freq)mhz|"\
-"Batt: $(batt_status)|"\
-"$(network_info)|"\
-"Free Mem: $(_sys_memory)|"\
-"Uptime: $(_sys_uptime)|"\
-"$(date '+%m.%d.%Y %H:%M:%S')"
-}
-
-x230_status_line() {
-echo \
-"Fan: $(sensors | sed -n 's/^fan1:[\t ]*//p')|"\
-"Batt: $(batt_status | sed -e's/ *$//g')|"\
-"$(network_info)|"\
-"$(date '+%m.%d.%Y %H:%M:%S')"
-}
-
-dell7590_status_line() {
-echo \
-"Batt: $(batt_status | sed -e's/ *$//g')|"\
-"$(network_info)|"\
-"$(date '+%m.%d.%Y %H:%M:%S')"
-}
-
-t495_status_line() {
-echo \
-"Fan: $(_fan)|"\
-"Temp: $(k10Temp)|"\
-"CPU: $(cpu_freq)|"\
-"Batt: $(batt_status | sed -e's/ *$//g')|"\
-"$(network_info)|"\
-"$(date '+%m.%d.%Y %H:%M')"
-}
-
-yoga6_status_line() {
-echo \
-"Fan: $(_fan)|"\
-"Temp: $(k10Temp)|"\
-"CPU: $(cpu_freq)|"\
-"Batt: $(batt_status -b BAT1 -s ACAD | sed -e's/ *$//g')|"\
-"$(network_info)|"\
-"$(date '+%m.%d.%Y %H:%M')"
-}
-
-desktop_status_line() {
-echo \
-"Temp: $(core_0_temp)|"\
-"CPU: $(cpu_freq)|"\
-"$(network_info)|"\
-"$(date '+%m.%d.%Y %H:%M')"
-}
-
-# "$@" ;exit 0
-
-_type="$1"; shift
-while true ; do
-xsetroot -name "$("${_type}_status_line" "$@")"
-# echo "$("${_type}_status_line" "$@")"
-sleep "$timeout"
-done
diff --git a/bin/touchpad-props b/bin/touchpad-props
deleted file mode 100755
index 0851486..0000000
--- a/bin/touchpad-props
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/sh
-
-touchpads="$(xinput list --name-only | grep Touchpad)"
-
-proplist='Click Method Enabled::0 1
-Tapping Enabled::1
-Tapping Drag Enabled::1
-Tapping Button Mapping Enabled::1 0'
-
-IFS='
-'
-
-for device in $touchpads ; do
- props=$(xinput --list-props "$device")
-
- for prop in $proplist ; do
- propName="$(echo "$prop" | awk -F:: '{print $1}')"
- propVal="$(echo "$prop" | awk -F:: '{print $2}')"
-
- prop="$(echo "$props" |
- sed -rne 's/^.*'"$propName"' \(([0-9]+).*$/\1/ip')"
- oldIFS="$IFS"
- IFS=' '
-
- #shellcheck disable=SC2086
- xinput --set-prop "$device" "$prop" $propVal
- #shellcheck disable=SC2086
- echo xinput --set-prop "$device" "$prop" $propVal
-
- IFS="$oldIFS"
- done
-done
diff --git a/bin/wallpaper b/bin/wallpaper
deleted file mode 100755
index 73f9871..0000000
--- a/bin/wallpaper
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-set -e
-wallpaper="$1"; shift
-
-while true ; do
- feh --bg-fill "$wallpaper"
- sleep 15
-done
diff --git a/bin/wpa b/bin/wpa
deleted file mode 100755
index ea79adb..0000000
--- a/bin/wpa
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/bin/sh
-set -e
-session="wpa"
-t=3
-interface=
-nwid=
-wpakey=
-
-help() {
-cat <<EOF
-$0 [-i <interface>] [-n <network_name>] [-p <password>]
-EOF
-exit 1;
-}
-
-while [ $# -gt 0 ] ; do case $1 in
- -i|if) interface="$2"; shift ; shift ;;
- -n|nwid) nwid="$2"; shift ; shift ;;
- -p|wpakey) wpakey="$2"; shift ; shift ;;
- *) help ;;
-esac ; done
-
-err=0
-for _v in interface nwid wpakey ; do
- eval v="\$$_v";
- if [ -z "$v" ] ; then
- echo "$_v cannot be empty"
- err=1
- fi
-done
-if [ $err -eq 1 ] ; then exit 1 ; fi
-
-
-wpakey="$(echo "$wpakey" | sed -e's/"/\\"/g')"
-
-conf_f="$(mktemp /dev/shm/wpa.XXXX)"
-trap 'rm -f $conf_f; exit 1;' EXIT INT
-cat > "$conf_f" <<EOF
-network={
- ssid="$nwid"
- scan_ssid=1
- key_mgmt=WPA-PSK
- psk="$wpakey"
-}
-EOF
-
-
-if tmux ls -F '#{session_name}' | grep -q "^$session\$" ; then
- exec tmux att -t "$session"
-fi
-
-tmux new-session -s "$session" \;\
- send-keys -t "${session}:0" "sudo wpa_supplicant -i \"$interface\" -c \"$conf_f\"" \;\
- send-keys -t "${session}:0" Enter \;\
- new-window -n "dhclient" -t 1 \;\
- send-keys -t "${session}:1" "sleep $t ; sudo dhclient -d -i \"$interface\"" \;\
- send-keys -t "${session}:1" Enter \;\
- select-window -t "${session}:0" \;\
-
diff --git a/bin/zzz.c b/bin/zzz.c
deleted file mode 100644
index ad2ef6c..0000000
--- a/bin/zzz.c
+++ /dev/null
@@ -1,87 +0,0 @@
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <string.h>
-#include <sys/types.h>
-
-#define POWER_STATE_F "/sys/power/state"
-
-void
-die(const char *msg)
-{
- puts(msg);
- exit(1);
-}
-
-void
-err(const char *msg)
-{
- perror(msg);
- exit(1);
-}
-
-void
-suspend()
-{
- int fh = open(POWER_STATE_F, O_WRONLY);
- int n;
- const char *cmd = "mem";
-
- if (fh == -1)
- err("Opening "POWER_STATE_F);
-
- n = write(fh, cmd, 3);
- if (n == -1)
- err("Writing to "POWER_STATE_F);
-
- exit(0);
-}
-
-int
-main(int argc, char **argv)
-{
- uid_t uid = getuid();
- gid_t gid = getgid();
- uid_t euid = geteuid();
- char **a = argv+1;
- char *lockProg = "slock";
- pid_t pid;
- int ret;
-
- if (euid != 0)
- die("Program must be run as root/setuid");
-
- for (;*a;a++) {
- if (strcmp("-l", *a) == 0) {
- a++;
- if (*a)
- lockProg = *a;
- else
- die("-l must have an argument");
- } else {
- printf("Unknown argument: '%s'\n", *a);
- exit(1);
- }
- }
-
-
- pid = fork();
- switch (pid) {
- case -1:
- err("fork");
- case 0:
- ret = setuid(uid);
- if (ret == -1)
- err("setuid");
- ret = setgid(gid);
- if (ret == -1)
- err("setgid");
-
- execlp(lockProg, lockProg);
- err("execlp");
- default:
- suspend();
- }
-
-}