citadel

My dotfiles, scripts and nix configs
git clone git://jb55.com/citadel
Log | Files | Refs | README | LICENSE

commit 50d53c3d05d363623da5671b2fdbd983ce77dd5b
parent 4c55ff7d576c58dab2e0c8ee3ac22c5e6f0ef78a
Author: William Casarin <jb55@jb55.com>
Date:   Sun,  7 Aug 2022 07:18:50 -0700

many updates

Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Mbin/bcli | 2+-
Mbin/findex | 2+-
Abin/fuzz-git-modified | 5+++++
Mbin/hist | 2+-
Abin/lnaddress | 5+++++
Mbin/nannypay | 2+-
Abin/notmuch-select-threads | 3+++
Mbin/plainweb | 13+++++++++++--
Abin/read-thread-later | 9+++++++++
Abin/readlater | 19+++++++++++++++++++
Abin/relayer | 12++++++++++++
Abin/rq | 30++++++++++++++++++++++++++++++
Mdotfiles/.config/neomutt/neomuttrc | 8++++++++
Mdotfiles/.mail_aliases | 2++
Mdotfiles/.mailcap | 1+
Mdotfiles/rssfeeds | 2+-
16 files changed, 110 insertions(+), 7 deletions(-)

diff --git a/bin/bcli b/bin/bcli @@ -3,6 +3,6 @@ if [ $(hostname) == "monad" ] then exec bitcoin-cli -rpcuser=rpcuser -rpcpassword=rpcpass -datadir=/zbig/bitcoin "$@" else - exec bitcoin-cli "$@" + ssh monad bcli "$@" fi diff --git a/bin/findex b/bin/findex @@ -1,7 +1,7 @@ #!/usr/bin/env bash if [ -z "$1" ]; then - printf 'usage: find-example <rg query>\n' + printf 'usage: findex <rg query>\n' exit 1 fi diff --git a/bin/fuzz-git-modified b/bin/fuzz-git-modified @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +file=$(git status | grep modified: | awkp 2 | fzf) + +echo "edit $file" diff --git a/bin/hist b/bin/hist @@ -10,4 +10,4 @@ for line in sys.stdin.readlines(): hist[x] = (hist.get(x) or 0) + 1 for key, count in hist.items(): - print "%s\t%s" % (count, key) + print("{}\t{}".format(count,key)) diff --git a/bin/lnaddress b/bin/lnaddress @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +name=$(cut -f1 -d@ <<<"$1") +host=$(cut -f2 -d@ <<<"$1") + +curl -sL "https://$host/.well-known/lnurlp/$name" | jq diff --git a/bin/nannypay b/bin/nannypay @@ -7,7 +7,7 @@ if [ -z "$NANNY" ]; then exit 1 fi -pay=20 +pay=25 if [ -z $pay ]; then printf "unknown pay for %s\n" "$NANNY" diff --git a/bin/notmuch-select-threads b/bin/notmuch-select-threads @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +cmd=$(fuzz-notmuch-select-threads) +eval "$cmd" diff --git a/bin/plainweb b/bin/plainweb @@ -2,6 +2,11 @@ USER_AGENT='User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.15.2 Chrome/83.0.4103.122 Safari/537.36' +if [ "$1" = "-f" ]; then + FORCE=1 + shift +fi + if [ -z "$1" ]; then printf "usage: plainweb <url>\n" exit 1 @@ -10,9 +15,13 @@ fi HURL="/tmp/$(sha256sum <<<"$1" | awk '{print $1}').txt" OUT=${2:-$HURL} -if [ ! -f "$HURL" ]; then +if [[ $FORCE -eq 1 ]] || [[ ! -f "$HURL" ]]; then + printf "fetching...\n" >&2 #w3m -header "$USER_AGENT" -dump "$1" > "$HURL" - w3m -dump "$1" | par -w$(tput cols) > "$HURL" + #w3m -dump "$1" | par -w$(tput cols) > "$HURL" + w3m -dump "$1" > "$HURL" + #<"$HURL" par -w$(tput cols) > "$HURL.par" fi lessr "$HURL" +printf "$HURL\n" >&2 diff --git a/bin/read-thread-later b/bin/read-thread-later @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +set -e + +if [[ -z $1 ]] || [[ -z $2 ]]; then + printf "usage: read-thread-later <thread:threadid> filename.txt\n" >&2 + exit 1 +fi + +notmuch show --format=text "$1" | collapse | readlater "$2" diff --git a/bin/readlater b/bin/readlater @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -e + +tmp=$(mktemp) +cat > "$tmp" +fname="$1" + +if [ -z $1 ]; then + printf "usage: readlater fname.txt\n" + exit 2 +fi + +fname=${fname%.txt}.txt + +mkdir -p $HOME/docs/queue +mv "$tmp" "$HOME/docs/queue/$fname" +printf "Added '$fname' to read queue\n" >&2 +rm -f "$tmp" diff --git a/bin/relayer b/bin/relayer @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +POST="$(cat)" + +printf "using post '%s'\n" "$POST" >&2 + +for relay in $(cat ~/dotfiles/relays) +do + <<<"$POST" jq -c '["EVENT", .]' | websocat "$relay" & +done + +wait diff --git a/bin/rq b/bin/rq @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +set -e + +DOCS_DIR=${DOCS_DIR:-$HOME/docs} + +cmd=$(fuzz-reader $DOCS_DIR/queue) + +path=$(cut -f2 -d" " <<<"$cmd") +fname=$(basename "$path") + +$cmd + + +printf "Are you done with '$fname'?\n" >&2 +read -rep "(a)rchive, (d)elete, (q)uit: " reply + +case $reply in + [Dd]* ) + rm -f "$path" + printf 'Deleting %s\n' "$fname" >&2 + ;; + [Aa]* ) + mkdir -p "$DOCS_DIR/archive" + mv "$path" "$DOCS_DIR/archive" + mv "$DOCS_DIR/queue/.$fname.hst" "$DOCS_DIR/archive" || : + printf 'Archiving %s\n' "$fname" >&2 + ;; + * ) ;; +esac diff --git a/dotfiles/.config/neomutt/neomuttrc b/dotfiles/.config/neomutt/neomuttrc @@ -7,6 +7,7 @@ set wait_key=no set pager_stop=yes set from="jb55@jb55.com" set pipe_decode=yes +set pipe_split=no set envelope_from=yes set mime_forward=no unset markers @@ -46,6 +47,7 @@ macro pager d "<next-page>" macro pager u "<previous-page>" macro pager c "|cols|less<enter>" macro pager t "|collapse|less<enter>" +macro attach h "|w3m -dump -T text/html | less<enter>" "View text/html with w3m" #macro pager P "|grep patch$ | xargs curl -sL | delta --paging always<enter>" macro pager P "| mail-prpatch | delta --paging always" @@ -64,4 +66,10 @@ color quoted9 blue default # Quoting Ebene 10 color header brightcyan default '^Subject:' +#collapse threads +folder-hook . "push \eV" +set collapse_unread=yes +set uncollapse_jump=yes + source ~/.mail_aliases + diff --git a/dotfiles/.mail_aliases b/dotfiles/.mail_aliases @@ -6,3 +6,5 @@ alias jesse Jesse Brydle <jesse.brydle@steamoji.com> alias v Vanessa Gray <vanessagray31@gmail.com> alias steam William Casarin <will.casarin@steamoji.com> alias rusty Rusty Russell <rusty@rustcorp.com.au> + +alias managers Kitsilano <kitsilano@steamoji.com>, Kerrisdale <kerrisdale@steamoji.com>, West Vancouver <westvancouver@steamoji.com> diff --git a/dotfiles/.mailcap b/dotfiles/.mailcap @@ -1,4 +1,5 @@ text/html; open %s; nametemplate=%s.html +#text/html; w3m -dump '%s'; copiousoutput text/csv; pcsv %s image/*; open %s video/*; open %s diff --git a/dotfiles/rssfeeds b/dotfiles/rssfeeds @@ -31,10 +31,10 @@ squarebitcoin @blog https://squareselfcustody.substack.com/feed.xml stackernews @busy https://stacker.news/rss susskind @arxiv 'http://export.arxiv.org/api/query?search_query=au:susskind_l&sortBy=lastUpdatedDate&sortOrder=descending' thedrive @pod https://peterattiadrive.libsyn.com/rss -timferris @pod https://rss.art19.com/tim-ferriss-show veritasium @yt https://www.youtube.com/feeds/videos.xml?channel_id=UCHnyfMqiRRG1u-2MsSQLbXA witten @arxiv 'http://export.arxiv.org/api/query?search_query=au:witten_e&sortBy=lastUpdatedDate&sortOrder=descending' zvibern @arxiv 'http://export.arxiv.org/api/query?search_query=au:bern_zvi&sortBy=lastUpdatedDate&sortOrder=descending' +nielsen @arxiv 'http://export.arxiv.org/api/query?search_query=au:nielsen_m_a&sortBy=lastUpdatedDate&sortOrder=descending' scott-aaronson @blog https://scottaaronson.blog/?feed=rss2 dietterich-labs @yt https://www.youtube.com/feeds/videos.xml?channel_id=UCd02pSRrecAVFOPjB-bfv-Q allen-farrington @blog https://medium.com/feed/@allenfarrington