dotfiles

<-- duh.
Log | Files | Refs | LICENSE

commit 5d59990a5f451c076c6c9c7c0d88c76a8fe6fa98
parent d1d2fa6978bcadcc03d0d72d306e0f2a71cd2190
Author: Hayden Hamilton <hayden@haydenvh.com>
Date:   Fri,  5 Jun 2020 22:18:26 +0100

alcl script

Diffstat:
M.config/irssi/config | 2+-
A.config/nvim/ftdetect/alcl.vim | 2++
M.config/nvim/ftdetect/greet.vim | 2+-
A.config/nvim/syntax/alcl.vim | 9+++++++++
M.config/vimb/config | 2+-
M.scripts/bin/misc/alcl | 47+++++++++++++++++++++++++++++++++++++++--------
M.scripts/bin/misc/srssbnbc | 35+++++++++++++++++++++++++++++++++--
M.scripts/custom/dock | 4++--
M.scripts/dwmblocks/bat | 11++---------
M.scripts/dwmblocks/dwmbar | 2+-
M.scripts/dwmblocks/news | 4++--
M.scripts/input/keyboard | 6------
12 files changed, 93 insertions(+), 33 deletions(-)

diff --git a/.config/irssi/config b/.config/irssi/config @@ -242,7 +242,7 @@ settings = { core = { real_name = "haydenvh.com"; user_name = "haydenh"; - nick = "blerghghgh"; + nick = "haydenh"; recode_transliterate = "no"; timestamp_format = "%H:%M:%S"; }; diff --git a/.config/nvim/ftdetect/alcl.vim b/.config/nvim/ftdetect/alcl.vim @@ -0,0 +1,2 @@ +au BufNewFile,BufRead *.alcl set filetype=alcl +au BufNewFile,BufRead *.alcl set syntax=alcl diff --git a/.config/nvim/ftdetect/greet.vim b/.config/nvim/ftdetect/greet.vim @@ -1,2 +1,2 @@ au BufNewFile,BufRead *.greet set filetype=greet -au BufNewFile,BufRead *.greet set syntax=great +au BufNewFile,BufRead *.greet set syntax=greet diff --git a/.config/nvim/syntax/alcl.vim b/.config/nvim/syntax/alcl.vim @@ -0,0 +1,9 @@ +if exists("b:current_syntax") + finish +endif + +runtime! syntax/markdown.vim + +syn match alclComment '^!.*' + +hi link alclComment Comment diff --git a/.config/vimb/config b/.config/vimb/config @@ -23,7 +23,7 @@ nnoremap h <C-o> nnoremap l <C-i> shortcut-add sx=https://searx.me/ -shortcut-add sch=https://occusearch.de/?q=$0 +shortcut-add sch=https://searx.ninja/?q=$0 shortcut-add bit=https://bitchute.com/search?q=$0 shortcut-add yt=https://youtube.com/results?search_query=$0 shortcut-add hh=http://www.haydenvh.com/h/ diff --git a/.scripts/bin/misc/alcl b/.scripts/bin/misc/alcl @@ -1,7 +1,13 @@ #!/bin/sh -PHLOG="$HOME/net/alcl/write" +GOPHERDIR="/alcl/write" +PHLOG="$HOME/net/$GOPHERDIR" RSSBNB="$HOME/net/phlog.rssbnb" +HOSTNAME="haydenh.null" + +sanitise(){ + sed 's/\\:/\&#58;/g;s/\\,/\&#44;/g;s/:/\&#58;/g;s/,/\&#44;/g' < /dev/stdin +} _list(){ for f in $(find $PHLOG/$1 -type f -name "*.gph" -o -name "*.txt" -not -name "links.gph") @@ -15,11 +21,36 @@ _list(){ } _new(){ - [ -d "$PHLOG/$1" ] && dir="$PHLOG/$1" && shift || dir="$PHLOG" - name="$@" - filename=$(echo "$@" | tr '[[:space:]]' '.' | tr -dc '[A-Za-z0-9-.+=%#!]') - echo "#$name" >> $dir/$filename - $EDITOR $dir/$filename + [ -d "$PHLOG/$1" ] && { + dir="$PHLOG/$1" + gopherdir="$GOPHERDIR/$1" + } || { + dir="$PHLOG" + gopherdir="$GOPHERDIR" + } + printf "Entry title? " && read name < /dev/tty + filename=$(echo "$name" | tr '[[:space:]]' '.' | tr '[:upper:]' '[:lower:]' | tr -dc '[A-Za-z0-9-.+=%#!]') + printf "gph or txt? " && read filetype < /dev/tty + [ -f $dir/$filename$filetype ] && echo "Entry already exists... quitting" && exit 1 + case "$filetype" in + gph) gophertype="1";; + *) gophetype="0";; + esac + echo "#$name" > $dir/$filename$filetype + $EDITOR $dir/$filename$filetype + [ ! -f $RSSBNB ] && { + printf "No RSSBNB file... creating.\nPhlog title? " + read title < /dev/tty + printf "Phlog link? " + read link < /dev/tty + printf "! Phlog description?\n! All lines starting with '!' are ignored\n" > /tmp/desc.alcl + $EDITOR /tmp/desc.alcl + echo ":main,$(echo "$title" | sanitise),$(echo "$link" | sanitise),$(sed '/^\!/d' < /tmp/desc.alcl | sanitise):" + } + + printf "! Entry description?\n! All lines starting with '!' are ignored\n" > /tmp/desc.alcl + $EDITOR /tmp/desc.alcl + echo ":sub,$(echo "$name" | sanitise),gopher\://$(echo "$HOSTNAME" | sanitise)/$gophertype$(echo "$gopherdir" | sanitise)/$filename$filetype,$(sanitise < /tmp/desc.alcl | sed '/^\!/d'):" >> $PHLOG } case "$1" in @@ -28,7 +59,7 @@ case "$1" in *) echo 'usage: alcl <subcommand> SUBCOMMANDS: - ls - new' ;; + ls [dir] + new [dir]' ;; esac diff --git a/.scripts/bin/misc/srssbnbc b/.scripts/bin/misc/srssbnbc @@ -22,7 +22,18 @@ cache=${XDG_CACHE_HOME:=$HOME/.cache} config=${XDG_CONFIG_HOME:=$HOME/.config} -[ ! -z $1 ] && grep -rnw $cache/srssbnbc/ -e 'Read[[:space:]]*:[[:space:]]*unread' | wc -l && exit +[ "$1" = "-n" ] && grep -rnw $cache/srssbnbc/ -e 'Read[[:space:]]*:[[:space:]]*unread' | wc -l && exit +[ "$1" = "-h" ] && { + echo "usage: [-h] [-n] + +-n count number of unread entries +-h display this usage + +files: + $config/srssbnbc/feeds one rssbnbc url on each line + $config/srssbnbc/rss first column is a url, second is a name for the feed + columns are seperated with tab chars '\t'" && exit 1 +} parseconfig(){ mkdir -p $config/srssbnbc @@ -39,6 +50,25 @@ parseconfig(){ done < $config/srssbnbc/feeds } +parserssconfig(){ + [ ! -f $config/srssbnbc/rss ] && return + + while IFS= read -r line + do + f=$(mktemp) + curl ${line%% *} > $f + sfeed < $f | sed 's/:/\&#58;/g;s/,/\&#44;/g' | awk ' + BEGIN { + FS="\t" + } + + //{print ":sub,"$2","$3","$4":"}' | sed 's~\\t~\t~g;s~\\n~\n~g;s~\\\\~\\~g' | awk '{a[i++]=$0} END {for (j=i-1; j>=0;) print a[j--] }'> $f + parsefile $f "$(echo "${line##* }" | base32 | head -n 1)" "${line%% *}" + printf "Read : Null\nTitle : %s\nLink :\n\n" "${line##* }" > $cache/srssbnbc/$(echo "${line##* }" | base32 | head -n 1)/main.txt + rm $f + done < $config/srssbnbc/rss +} + parsefile(){ # usage $1=file, $2=id, $3=name mkdir -p $cache/srssbnbc/$2 -p @@ -63,7 +93,7 @@ parsefile(){ } ' - [ "$?" = "2" ] && echo "Two 'main' items... quiting in feed $3" >/dev/stderr && exit + [ "$?" = "2" ] && echo "Two 'main' items... quiting in feed $3" >/dev/stderr && return } _ui(){ @@ -123,4 +153,5 @@ _ui(){ parseconfig +parserssconfig _ui diff --git a/.scripts/custom/dock b/.scripts/custom/dock @@ -5,5 +5,5 @@ do ds="$ds --output $d --off" done -xrandr $ds --output VGA1 --mode 1920x1080 --primary --pos 0x0 -xrandr --output HDMI1 --mode 1920x1080 --pos 1920x0 --rotate left +xrandr $ds --output LVDS1 --mode 1920x1080 --primary --pos 0x0 +xrandr --output HDMI2 --mode 1920x1080 --pos 1920x0 --rotate left diff --git a/.scripts/dwmblocks/bat b/.scripts/dwmblocks/bat @@ -1,10 +1,5 @@ #!/bin/bash -# -# dwmblocks/bat -# Created by Hayden Hamilton -# -# haydenvh.com -# Copyright (c) 2019 Hayden Hamilton. + total=0 charge=0 for b in $(find /sys/class/power_supply -name "BAT*") @@ -20,9 +15,7 @@ colour="#aa6600" [ "$charging" = "y" ] && colour="#00aa00" [ $num -ge 19 ] && colour="#00aa00" [ "$discharging" = "y" ] && colour="#aa0000" -echo "^r0,5,2,4^^r2,2,22,10^^c#000000^^r3,3,20,8^^c$colour^^r$((23-$num)),3,$num,8^^d^^f24^" > /tmp/bat -read output < /tmp/bat -printf "[B $output]" +echo "[^r0,5,2,4^^r2,2,22,10^^c#000000^^r3,3,20,8^^c$colour^^r$((23-$num)),3,$num,8^^d^^f24^]" echo echo echo \#C625C8 diff --git a/.scripts/dwmblocks/dwmbar b/.scripts/dwmblocks/dwmbar @@ -44,5 +44,5 @@ do do grep '[[:alnum:]]' < $f >/dev/null && cp $f /tmp/dwmblocks done - xsetroot -name "$(for void in $(seq 150); do printf " "; done) $(cat mpv bat cpu disk disk2 mem net news mail rem vol time time2 host | sed '/^#/d;/^$/d' | sed '1~2s/^/\^c#ffaaaa\^/;2~2s/^/\^c#aaaaff\^/;s~\[~ ^b#1a3136^ ~g;s~\]~ ^d^~g' | tr '\n' ' ') " + xsetroot -name "$(for void in $(seq 150); do printf " "; done) $(cat * | sed '/^#/d;/^$/d' | sed '1~2s/^/\^c#ffaaaa\^/;2~2s/^/\^c#aaaaff\^/;s~\[~ ^b#1a3136^ ~g;s~\]~ ^d^~g' | tr '\n' ' ') " done & diff --git a/.scripts/dwmblocks/news b/.scripts/dwmblocks/news @@ -7,8 +7,8 @@ # Copyright (c) 2019 Hayden Hamilton. newsboat -x reload 2>/dev/null && { - unread=$(newsboat -x print-unread | sed 's/ unread articles//g') - [ "$unread" = "0" ] || [ "$unread" = "" ] && exit 1 + rss=$(newsboat -x print-unread | sed 's/ unread articles//g') + rssbnb=$(srssbnbc -n) echo "[NWS $unread]" echo echo \#498364 diff --git a/.scripts/input/keyboard b/.scripts/input/keyboard @@ -1,10 +1,4 @@ #!/bin/bash -# -# input/keyboard -# Created by Hayden Hamilton -# -# haydenvh.com -# Copyright (c) 2019 Hayden Hamilton. setxkbmap -layout us setxkbmap -option caps:escape