add new scripts
This commit is contained in:
parent
148da2f140
commit
e330122465
8
scripts/beep-charlie
Executable file
8
scripts/beep-charlie
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
head -c 8 /dev/urandom | \
|
||||
hexdump -v -e '/1 "%u\n"' | \
|
||||
awk '{ split("0,3,5,6,7,10,12",a,","); \
|
||||
for (i = 0; i < 1; i+= 0.00011) \
|
||||
printf("%08X\n", 60*sin(450*exp((a[$1 % 8]/12)*log(2))*i)) }' | \
|
||||
xxd -r -p | \
|
||||
aplay -c 1 -f S32_LE -r 48000 -D plug:default
|
@ -1,39 +1,27 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Set brightness for DDC/CI enabled monitors
|
||||
# set backlight brightness level
|
||||
|
||||
export PATH="/var/setuid-wrappers:$PATH"
|
||||
current=$(cat /sys/class/backlight/intel_backlight/brightness)
|
||||
|
||||
# monitor i2c device
|
||||
device=dev:/dev/i2c-0
|
||||
|
||||
# brightness values
|
||||
night=35
|
||||
transition=45
|
||||
daytime=60
|
||||
|
||||
|
||||
deref() {
|
||||
eval "echo \$$1"
|
||||
}
|
||||
|
||||
set_brightness() {
|
||||
sudo ddccontrol $device -r 0x10 -w > /dev/null $1 2>&1
|
||||
}
|
||||
|
||||
fade_to() {
|
||||
current=$(sudo ddccontrol $device -r 0x10 2> /dev/null | grep -oP '\+/\K[0-9]+')
|
||||
[ $current -gt $1 ] && step=-1 || step=1
|
||||
for i in $(seq $current $step $1); do
|
||||
set_brightness $i
|
||||
sleep 1
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
if [ $1 = "period-changed" ]; then
|
||||
if ! (lsmod | grep -q "^i2c_dev"); then
|
||||
sudo modprobe i2c-dev
|
||||
if test -z "$1"; then
|
||||
echo $current
|
||||
exit 0
|
||||
fi
|
||||
fade_to $(deref $3)
|
||||
|
||||
case "$1" in
|
||||
'+' | '-')
|
||||
if test -z "$2"; then
|
||||
echo "missing increment"
|
||||
exit 1
|
||||
fi
|
||||
new=$(("$current" "$1" "$2"))
|
||||
;;
|
||||
*)
|
||||
echo "invalid argument '$1'"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "current: $new"
|
||||
echo $new > /sys/class/backlight/intel_backlight/brightness
|
||||
|
18
scripts/colors
Executable file
18
scripts/colors
Executable file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env fish
|
||||
|
||||
set colors black red green yellow blue magenta cyan white
|
||||
|
||||
function colored
|
||||
set_color -b $argv[1]
|
||||
set_color 181b20
|
||||
echo -n $argv[2]
|
||||
set_color normal
|
||||
end
|
||||
|
||||
for i in (seq 8)
|
||||
printf "%02d %32s %02d %40s\n" \
|
||||
(math $i - 1) \
|
||||
(colored $colors[$i] $colors[$i]) \
|
||||
(math $i + 7) \
|
||||
(colored br$colors[$i] "bright "$colors[$i])
|
||||
end
|
40
scripts/fetch
Executable file
40
scripts/fetch
Executable file
@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env fish
|
||||
|
||||
# Outputs colored text
|
||||
function color
|
||||
set_color $argv[1]
|
||||
for i in $argv[2..-1]
|
||||
echo -n $i
|
||||
end
|
||||
set_color normal
|
||||
end
|
||||
|
||||
|
||||
set cpu_model (awk '/model name/ {print $6; exit}' /proc/cpuinfo)
|
||||
set cpu_freq (awk '{printf("%.2fHz", $0/1e6)}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq)
|
||||
set cpu_temp (awk '{printf("%dK", $0/1e3+273.15)}' /sys/class/thermal/thermal_zone3/temp)
|
||||
|
||||
set gpu_model (lspci | awk -F [][] '/VGA/ {print $4}')
|
||||
|
||||
set mem_used (awk '/Active/ {printf("%.1f", $2/1e6); exit}' /proc/meminfo)
|
||||
set mem_tot (awk '/MemTotal/ {printf("%.1f", $2/1e6); exit}' /proc/meminfo)
|
||||
|
||||
set uptime (awk '{printf("%d:%02d:%02d",($1/60/60/24),($1/60/60%24),($1/60%60))}' /proc/uptime)
|
||||
|
||||
set kernel (uname -sr)
|
||||
set os (awk -F= '/^NAME/ {print $2}' /etc/os-release)
|
||||
|
||||
set screen (xrandr | grep \* | awk '{print $1}')
|
||||
set shell (basename $SHELL)
|
||||
|
||||
echo -n \33c
|
||||
echo (color blue OS:) $os GNU+$kernel
|
||||
echo (color blue CPU:) $cpu_model $cpu_freq [$cpu_temp]
|
||||
echo (color blue GPU:) $gpu_model
|
||||
echo (color blue RAM:) $mem_used/$mem_tot GB
|
||||
echo (color blue Screen:) $screen
|
||||
echo (color blue Uptime:) $uptime
|
||||
echo (color blue WM:) bspwm
|
||||
echo (color blue Shell:) $shell
|
||||
echo (color blue Font:) gohufont
|
||||
echo
|
10
scripts/lines
Executable file
10
scripts/lines
Executable file
@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env fish
|
||||
|
||||
set char ╱ ╲
|
||||
set num (math (tput cols)'*'(tput lines))
|
||||
|
||||
set_color yellow
|
||||
for i in (seq $num)
|
||||
echo -n $char[(random 1 2)]
|
||||
end
|
||||
cat -
|
63
scripts/make-raspi-img
Executable file
63
scripts/make-raspi-img
Executable file
@ -0,0 +1,63 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Packages required
|
||||
# dosfstools parted
|
||||
# Can be run on any Linux system
|
||||
# loop.max_part=15 must be in kernel cmdline (cmdline.txt for rpi)
|
||||
# then reboot
|
||||
|
||||
echo "creating image to fit on 2Gb card"
|
||||
dd if=/dev/zero of=arch-rpi.img bs=1M count=1850
|
||||
|
||||
echo "Partitioning"
|
||||
fdisk arch-rpi.img <<EOF
|
||||
o
|
||||
n
|
||||
p
|
||||
1
|
||||
|
||||
+100M
|
||||
|
||||
t
|
||||
c
|
||||
n
|
||||
p
|
||||
2
|
||||
|
||||
|
||||
w
|
||||
EOF
|
||||
|
||||
sleep 5
|
||||
|
||||
losetup -f arch-rpi.img
|
||||
sleep 5
|
||||
kpartx -a /dev/loop0
|
||||
|
||||
echo "Formatting vfat"
|
||||
mkfs.vfat /dev/loop0p1
|
||||
sleep 5
|
||||
mkdir boot
|
||||
echo "Mounting boot"
|
||||
mount /dev/loop0p1 boot
|
||||
echo "Installing"
|
||||
|
||||
echo "Formatting ext4"
|
||||
mkfs.ext4 /dev/loop0p2
|
||||
sleep 5
|
||||
mkdir root
|
||||
echo "Mounting root"
|
||||
mount /dev/loop0p2 root
|
||||
|
||||
wget http://archlinuxarm.org/os/ArchLinuxARM-rpi-latest.tar.gz
|
||||
echo "Installing"
|
||||
bsdtar -xpf ArchLinuxARM-rpi-latest.tar.gz -C root
|
||||
sync
|
||||
mv root/boot/* boot
|
||||
sync
|
||||
umount boot root
|
||||
losetup -d /dev/loop0p1
|
||||
losetup -d /dev/loop0p1
|
||||
losetup -d /dev/loop0
|
||||
echo "All complete, image arch-rpi.img created, compressing...."
|
||||
zip -9 arch-rpi.img.zip arch-rpi.img
|
30
scripts/redshift-acpi
Executable file
30
scripts/redshift-acpi
Executable file
@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Set brightness for laptops backlight
|
||||
|
||||
PATH="$HOME/.local/bin:$PATH"
|
||||
|
||||
# brightness values
|
||||
night=1000
|
||||
transition=1500
|
||||
daytime=2000
|
||||
|
||||
deref() {
|
||||
eval "echo \$$1"
|
||||
}
|
||||
|
||||
fade_to() {
|
||||
current=$(brightness)
|
||||
echo $current $1
|
||||
step=10
|
||||
[ "$current" -gt "$1" ] && sign=- || sign=+
|
||||
for i in $(seq "$current" "${sign}$step" "$1"); do
|
||||
brightness "$sign" "$step" > /dev/null
|
||||
sleep 1
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
if [ "$1" = "period-changed" ]; then
|
||||
fade_to "$(deref "$3")"
|
||||
fi
|
39
scripts/redshift-i2c
Executable file
39
scripts/redshift-i2c
Executable file
@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Set brightness for DDC/CI enabled monitors
|
||||
|
||||
export PATH="/var/setuid-wrappers:$PATH"
|
||||
|
||||
# monitor i2c device
|
||||
device=dev:/dev/i2c-0
|
||||
|
||||
# brightness values
|
||||
night=35
|
||||
transition=45
|
||||
daytime=60
|
||||
|
||||
|
||||
deref() {
|
||||
eval "echo \$$1"
|
||||
}
|
||||
|
||||
set_brightness() {
|
||||
sudo ddccontrol $device -r 0x10 -w > /dev/null $1 2>&1
|
||||
}
|
||||
|
||||
fade_to() {
|
||||
current=$(sudo ddccontrol $device -r 0x10 2> /dev/null | grep -oP '\+/\K[0-9]+')
|
||||
[ $current -gt $1 ] && step=-1 || step=1
|
||||
for i in $(seq $current $step $1); do
|
||||
set_brightness $i
|
||||
sleep 1
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
if [ $1 = "period-changed" ]; then
|
||||
if ! (lsmod | grep -q "^i2c_dev"); then
|
||||
sudo modprobe i2c-dev
|
||||
fi
|
||||
fade_to $(deref $3)
|
||||
fi
|
Loading…
Reference in New Issue
Block a user