dotfiles

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

commit 9a198d8b74068eac8b6c4ad56019a62abfa6cb15
parent 0dff47c28da1787ebcc0266e67a34559ef8de0b0
Author: Hayden Hamilton <hayden@haydenvh.com>
Date:   Sat, 23 May 2020 00:04:12 +0100

updates

Diffstat:
M.config/alias | 10+++++-----
D.config/irssi/scripts/autorun/url_hilight.pl | 33---------------------------------
M.config/mpv/input.conf | 1+
M.config/mpv/mpv.conf | 2+-
M.config/nvim/modules/filetype.vim | 13+------------
M.config/zsh/alias.zsh | 10+++++-----
M.scripts/bin/dmenu/dmpvurl | 2+-
A.scripts/bin/misc/asciiclip | 22++++++++++++++++++++++
D.scripts/bin/misc/lsc | 15---------------
A.scripts/bin/misc/popupcgo | 3+++
A.scripts/bin/misc/popupcurl | 3+++
A.scripts/bin/misc/srssbnbc | 123+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
M.scripts/bin/misc/urlhand | 3++-
13 files changed, 167 insertions(+), 73 deletions(-)

diff --git a/.config/alias b/.config/alias @@ -1,7 +1,7 @@ -l \lsc -la \lsc -A -ll \lsc -lh -lla \lsc -lAh +l \ls --color +la \ls --color -A +ll \ls --color -lh +lla \ls --color -lAh r \rm rr \rm -rf m \mv @@ -31,7 +31,7 @@ vimb \vimb --no-maximize cleancache sudo xbps-remove -Ooy; rm -rf ~/.cache ~/.mozilla ~/.local/share/webkitgtk ~/.viminfo ~/.wget-hsts ~/.lesshst ~/.sh_history ~/.python_history ~/.*history ~/.*hst* ~/.dbus ~/.sciminfo ~/.viminfo ~/.w3m ~/.config/vimb/cookies.db; sudo vkpurge rm all; mkconfall mkmailpass; mkalias tmux tmux -f ~/.config/tmux/config -nw newsboat +nw pkill newsboat; newsboat nm neomutt ; rm /tmp/mail maic sudo make all install clean homesync rsync --port 222 --delete -azPe 'ssh -p 222' --exclude=general --exclude=.cache --exclude=.local/cache $HOME/ void@192.168.1.20:/home/void/homedir/ diff --git a/.config/irssi/scripts/autorun/url_hilight.pl b/.config/irssi/scripts/autorun/url_hilight.pl @@ -1,33 +0,0 @@ -# url_hilight.pl -# -# This script is a work in progress, and will probably not do anything useful -# at the moment. Please fork and implement, or bug me on #irssi if you can -# decide what it ought to do, since I've forgotten. - - - -use strict; -use warnings; -use Irssi; - -our %IRSSI = ( - "author" => 'shabble', - "contact" => 'shabble+irssi@metavore.org, shabble@Freenode/#irssi', - "name" => 'URL Highlighter', - "description" => ' ', - "license" => 'WTFPL: http://sam.zoy.org/wtfpl/', - "version" => '0.1', - ); - -# regex taken from http://daringfireball.net/2010/07/improved_regex_for_matching_urls -my $url_regex = qr((?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))); - -sub handle_gui_print_text { - my ($win, $fg, $bg, $flags, $text, $text_dest) = @_; - if ($text =~ $url_regex) { - print "matched!"; - } -} - -Irssi::signal_add('gui print text', \&handle_gui_print_text); - diff --git a/.config/mpv/input.conf b/.config/mpv/input.conf @@ -2,3 +2,4 @@ l seek 5 h seek -5 j seek -60 k seek 60 +a ab-loop diff --git a/.config/mpv/mpv.conf b/.config/mpv/mpv.conf @@ -1,3 +1,3 @@ vo=xv -ytdl-format="(bestvideo[height<=1080]+bestaudio)[ext=webm]/bestvideo[height<=1080]+bestaudio/best[height<=1080]/bestvideo+bestaudio/best" +ytdl-format="(bestvideo[height<=720]+bestaudio)[ext=webm]/bestvideo[height<=720]+bestaudio/best[height<=720]/bestvideo+bestaudio/best" diff --git a/.config/nvim/modules/filetype.vim b/.config/nvim/modules/filetype.vim @@ -7,7 +7,7 @@ function Shconfig() nnoremap <buffer> <localleader>$ca i$cache nnoremap <buffer> <localleader>$co i$config nnoremap <buffer> <localleader><space> i[[:space:]]<esc> - nnoremap <buffer> <localleader><localleader><space> [[:space:]] + inoremap <buffer> <localleader><localleader><space> [[:space:]] iabbrev <buffer> ccachedir cache=${XDG_CACHE_HOME:=$HOME/.cache} iabbrev <buffer> cconfigdir cache=${XDG_CONFIG_HOME:=$HOME/.config} endfunction @@ -30,22 +30,11 @@ function GphCitation() endfunction augroup autocmd - "netrw autocmd FileType,WinEnter,BufEnter netrw call Configurenetrw() - - "Get rid of shitty indenting autocmd FileType html :normal gg=G - - "Nowrap autocmd FileType html :setlocal nowrap - - "C autocmd FileType c :noremap <buffer> <localleader>e $a;<esc> autocmd FileType c :inoremap <buffer> <localleader><localleader>e <esc>$a;<esc> - - "SH autocmd FileType sh :call Shconfig() - - "GPH autocmd FileType *.gph :call Gphconfig() augroup END diff --git a/.config/zsh/alias.zsh b/.config/zsh/alias.zsh @@ -11,10 +11,10 @@ alias -g ............=" ../../../../../../../../../../.." alias -g om=" origin master" alias -g gm=" github master" alias -g aic=" all install clean" -alias l=" \lsc" -alias la=" \lsc -A" -alias ll=" \lsc -lh" -alias lla=" \lsc -lAh" +alias l=" \ls --color" +alias la=" \ls --color -A" +alias ll=" \ls --color -lh" +alias lla=" \ls --color -lAh" alias r=" \rm" alias rr=" \rm -rf" alias m=" \mv" @@ -44,7 +44,7 @@ alias vimb=" \vimb --no-maximize" alias cleancache=" sudo xbps-remove -Ooy; rm -rf ~/.cache ~/.mozilla ~/.local/share/webkitgtk ~/.viminfo ~/.wget-hsts ~/.lesshst ~/.sh_history ~/.python_history ~/.*history ~/.*hst* ~/.dbus ~/.sciminfo ~/.viminfo ~/.w3m ~/.config/vimb/cookies.db; sudo vkpurge rm all;" alias mkconfall=" mkmailpass; mkalias" alias tmux=" tmux -f ~/.config/tmux/config" -alias nw=" newsboat" +alias nw=" pkill newsboat; newsboat" alias nm=" neomutt ; rm /tmp/mail" alias maic=" sudo make all install clean" alias homesync=" rsync --port 222 --delete -azPe 'ssh -p 222' --exclude=general --exclude=.cache --exclude=.local/cache $HOME/ void@192.168.1.20:/home/void/homedir/" diff --git a/.scripts/bin/dmenu/dmpvurl b/.scripts/bin/dmenu/dmpvurl @@ -14,5 +14,5 @@ socket2="$2" do_url() { hmpv pause $socket;echo $url | xargs $1 } -url=$(xclip -o | tr " " "\n" | awk '/http/ {print}' | $dmenu -p "URL:") +url=$(xclip -o | tr " " "\n" | awk '/http|gopher/ {print $0}' | $dmenu -p "URL:") do_url "mpv --input-ipc-server=$socket2" diff --git a/.scripts/bin/misc/asciiclip b/.scripts/bin/misc/asciiclip @@ -0,0 +1,22 @@ +#!/bin/sh + +chars="‾ (overline) +░ (block) +▒ (block) +▓ (block) +█ (block) +┌ (box) +┐ (box) +┼ (box) +┘ (box) +┤ (box) +├ (box) +└ (box)" + +#NOTE: a char being in this file, does not mean you should use it! Avoid the box +#drawing chars, as your art becomes TOO bland if they are everywhere. + +chars=$(echo "$chars" | nl | tee /dev/stderr) +printf 'Select a number: ' +read num < /dev/tty +echo "$chars" | grep "^[[:space:]]*$num[[:space:]]" | awk '{print $2}' | tr -d '[[:space:]]' | xclip diff --git a/.scripts/bin/misc/lsc b/.scripts/bin/misc/lsc @@ -1,15 +0,0 @@ -#!/bin/sh - -t=$(mktemp -d) - -for o in $(ls --color $@) -do - o2="$(echo "$@" | sed 's~[[:alnum:][:punct:]]$~&/~')$(echo "$o" | perl -pe 's/\e\[?.*?[\@-~]//g')" - [ -d $o2 ] && echo "$o" >> $t/dir || echo "$o" >> $t/file -done - -[ ! -f $t/dir ] && ls --color $@ && exit 0 -[ ! -f $t/file ] && ls --color $@ && exit 0 - -diff -y -W $(tput cols) $t/* | sed 's/ *>[[:space:]]*//g;s/<//g;s/|\t/\t/g' -rm -rf $t diff --git a/.scripts/bin/misc/popupcgo b/.scripts/bin/misc/popupcgo @@ -0,0 +1,3 @@ +#!/bin/sh + +exec $TERMINAL -e cgo $@ diff --git a/.scripts/bin/misc/popupcurl b/.scripts/bin/misc/popupcurl @@ -0,0 +1,3 @@ +#!/bin/sh + +exec $TERMINAL -e curl $@ diff --git a/.scripts/bin/misc/srssbnbc b/.scripts/bin/misc/srssbnbc @@ -0,0 +1,123 @@ +#!/bin/sh +# +# SRSSBNBC - simple RSSBNB client +# Created by Hayden Hamilton +# +# haydenvh.com +# Copyright (c) 2020 Hayden Hamilton +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +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 + +parseconfig(){ + mkdir -p $config/srssbnbc + [ ! -f $config/srssbnbc/feeds ] && { + printf "No feed file!\nSyntax: url^1\n url^2\n ...\n url^N\n" + exit 1 + } + while IFS= read -r line + do + f=$(mktemp) + curl -qs $line > $f + parsefile $f "$(echo "$line" | base32)" "$line" + rm $f + done < $config/srssbnbc/feeds +} + +parsefile(){ + # usage $1=file, $2=id, $3=name + mkdir -p $cache/srssbnbc/$2 -p + sed 's/\\:/\&#58;/g;s/\\,/\&#44;/g' < $1 | tr '\t\n:' '\f\t\n' | sed '/^[[:space:]]*$/d' | awk -v "cachedir=$cache/srssbnbc/$2" ' + BEGIN { + FS="," + count="0" + } + + $1 == "main" { + if (seenmain=="yes") + exit 2 + seenmain="yes" + printf("Read : Null\nTitle : %s\nLink : %s\n\n%s\n\n", $2, $3, $4) > cachedir"/main.txt" + } + + $1 != "main" { + count++ + if (system("test -f " cachedir"/"count".txt") != "0") + printf("Read : unread\nTitle : %s\nLink : %s\n\n%s\n", $2, $3, $4) > cachedir"/"count".txt" + } + ' + + [ "$?" = "2" ] && echo "Two 'main' items... quiting in feed $3" >/dev/stderr && exit +} + +_ui(){ + count=0 + dirs=$(ls $cache/srssbnbc/ | nl) + IFS=' +' + while true + do + clear + + for d in $dirs + do + dir=$(echo "$d" | awk '{$1="";print $0}' | sed 's/[[:space:]]//g') + num=$(echo "$d" | awk '{print $1}') + name=$(grep 'Title[[:space:]]*:' < $cache/srssbnbc/$dir/main.txt | awk '{$1="";$2="";print $0}' | sed 's/^[[:space:]]*/ /') + unread=$(grep -rnw $cache/srssbnbc/$dir -e 'Read[[:space:]]*:[[:space:]]*unread' | wc -l) + [ $unread -gt 0 ] && echo "$num $name $(tput bold)*$unread UNREAD ENTRIES*$(tput sgr0)" || echo "$num $name" + done | sed 's/&#58;/:/g;s/&#44;/,/g' + + printf '\n\nSelect a feed: ' + read feed < /dev/tty + cd $cache/srssbnbc/$(echo "$dirs" | grep "^[[:space:]]*$feed[[:space:]]" | awk '{$1="";print $0}' | sed 's/[[:space:]]//g') + + while true + do + clear + + temp=$(mktemp) + files=$(ls | nl | sed '/main\.txt/d') + for f in $files + do + file=$(echo "$f" | awk '{$1="";print $0}' | sed 's/[[:space:]]//g') + num=$(echo "$f" | awk '{print $1}') + name=$(grep 'Title[[:space:]]*:' < $file | awk '{$1="";$2="";print $0}' | sed 's/^[[:space:]]*/ /') + grep 'Read[[:space:]]*:[[:space:]]*unread' < $file >/dev/null && echo "$num $name $(tput bold)*UNREAD*$(tput sgr0)" || echo "$num $name" + done > $temp + tail -n 20 < $temp | cat main.txt /dev/stdin | sed 's/&#58;/:/g;s/&#44;/,/g' + printf "\n\nSelect an item, 'list' to veiw all items, or 'q' to go back: " + read choice < /dev/tty + [ "$choice" = "list" ] && less $temp && printf "\n\nSelect an item: " && read choice < /dev/tty + [ "$choice" = "q" ] && break + fchoice=$(echo "$files" | grep "^[[:space:]]*$choice[[:space:]]*" | awk '{$1="";print $0}' | sed 's/[[:space:]]//g') + tr '\f\t' '\t\n' < $fchoice | sed 's/&#58;/:/g;s/&#44;/,/g' | less + out=$(sed '/^Read[[:space:]]*:[[:space:]]*unread/d' < $fchoice) + echo "$out" > $fchoice + done + done +} + + +parseconfig +_ui diff --git a/.scripts/bin/misc/urlhand b/.scripts/bin/misc/urlhand @@ -12,7 +12,8 @@ vimb --no-maximize xclip webimg webkmv -st -e curl" | dmenu -i -p "Select a handler:") +popupcurl +popupcgo" | dmenu -i -p "Select a handler:") pkill mpvlisten hmpv pause /tmp/mpv-socket