citadel

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

commit 2fd04c0cb77518661f0b4a9dbb0d9a6a6ed6c089
parent 7a4dfbcd71d667cb2a5e74fd8e04cd6683ef4bc7
Author: William Casarin <jb55@jb55.com>
Date:   Sun, 21 Nov 2021 13:44:41 -0800

Merge branch 'quiver'

Diffstat:
M.gitignore | 1+
Mbin/bcli | 6+++---
Mbin/btc | 6+++---
Mbin/btc-balance | 12+++++++-----
Abin/btc-blocks-behind | 7+++++++
Abin/btc-reqblocks | 1+
Mbin/btc-submitblocks | 10+++++++---
Abin/btc-taproot | 6++++++
Abin/callq | 2++
Mbin/curl-activity | 2+-
Mbin/edit-gui | 4++--
Abin/fuzz-jump-branchdiff | 3+++
Mbin/fuzz-jump-tag | 11++---------
Mbin/fuzz-make | 2+-
Mbin/fuzz-search-file | 26++++++++++++++++++++------
Abin/fuzz-trello-sprint | 31+++++++++++++++++++++++++++++++
Abin/fuzzdoc | 6++++++
Abin/fuzzedit | 6++++++
Abin/git-hash | 3+++
Abin/gm | 2++
Mbin/lcli | 2+-
Abin/monad-run | 3+++
Abin/monad-ytdl | 2++
Abin/nncp-cat-handler | 27+++++++++++++++++++++++++++
Abin/nncp-next-uplink | 2++
Abin/nncp-run | 11+++++++++++
Mbin/nostat | 17+++--------------
Abin/nsync | 3+++
Abin/project-root | 2++
Abin/repl | 15+++++++++++++++
Mbin/rfc | 2+-
Mbin/search-files | 2+-
Abin/sql | 13+++++++++++++
Mbin/stripansi | 4++--
Abin/timer | 20++++++++++++++++++++
Abin/trello-sprint | 6++++++
Mdotfiles/.Xresources | 8++++----
Mdotfiles/.bash_aliases | 4----
Mdotfiles/.bashrc | 76++++++++++++++++++++++++++++++++++++----------------------------------------
Mdotfiles/.config/mimi/mime.conf | 9+++++----
Mdotfiles/.config/neomutt/neomuttrc | 8++++++--
Mdotfiles/.config/nvim/init.vim | 31++++++++++++++++++++++++++++++-
Mdotfiles/.config/qutebrowser/config.py | 3++-
Mdotfiles/.config/qutebrowser/quickmarks | 1+
Mdotfiles/.config/zathura/zathurarc | 2+-
Mdotfiles/.gitconfig | 5+++--
Mdotfiles/.mail_aliases | 1+
Mdotfiles/.mailcap | 1+
Mdotfiles/.vim/.vimrc | 389++++---------------------------------------------------------------------------
Mdotfiles/.xmonad/xmonad.hs | 12++++++++++--
Mdotfiles/commands | 35++++++++++++++++++++++-------------
Mdotfiles/gemmarks | 2++
Mjb55pkgs/default.nix | 4++--
Mnix-config/environment/default.nix | 26+++++++++++++++++++++-----
Mnix-config/environment/desktop/default.nix | 22+++++++++++++++-------
Mnix-config/machines/monad/networking/default.nix | 3+--
Mnix-config/machines/quiver/default.nix | 46++++++++++++++++++++++++++++++++++++++++++++--
Mnix-config/machines/quiver/networking/default.nix | 62+++++++++++++++++++++++++-------------------------------------
Mnix-config/machines/quiver/timers/default.nix | 14++++++++++++++
Mnix-config/misc/imap-notifier/default.nix | 6++++--
Mnix-config/nixpkgs/config.nix | 45+++++++++------------------------------------
61 files changed, 504 insertions(+), 589 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -3,3 +3,4 @@ bin/viscal bin/gmni bin/lagrange bin/resources.lgr +.direnv diff --git a/bin/bcli b/bin/bcli @@ -1,8 +1,8 @@ -#!/usr/bin/env sh +#!/bin/sh if [ $(hostname) == "monad" ] then -exec bitcoin-cli -rpcuser=rpcuser -rpcpassword=rpcpass -datadir=/zbig/bitcoin "$@" + exec bitcoin-cli -rpcuser=rpcuser -rpcpassword=rpcpass -datadir=/zbig/bitcoin "$@" else -ssh monad bitcoin-cli -rpcuser=rpcuser -rpcpassword=rpcpass -datadir=/zbig/bitcoin "$@" + exec bitcoin-cli "$@" fi diff --git a/bin/btc b/bin/btc @@ -3,8 +3,8 @@ cmd=${1:-price} shift -if [ $cmd != "price" ] && [ $HOSTNAME != "monad" ]; then - exec ssh monad env PATH=/home/jb55/bin:\$PATH btc-$cmd "$@" -fi +#if [ $cmd != "price" ] && [ $HOSTNAME != "monad" ]; then + #exec ssh monad env PATH=/home/jb55/bin:\$PATH btc-$cmd "$@" +#fi exec btc-$cmd "$@" diff --git a/bin/btc-balance b/bin/btc-balance @@ -1,7 +1,9 @@ #!/usr/bin/env bash -btc coins | awk '{print $3}' | xargs printf '%.8f * 100000000\n' | bc -l | xargs printf '%.0f\n' | paste -sd+ | bc -l | xargs printf '%s sats to btc\n' | bcalc -n +#btc coins | awk '{print $3}' | xargs printf '%.8f * 100000000\n' | bc -l | xargs printf '%.0f\n' | paste -sd+ | bc -l | xargs printf '%s sats to btc\n' | bcalc -n -if [ -n "$1" ]; then - FIAT=$(printf '%s sats to fiat\n' "$SATS" | bcalc --price "$1") - printf 'fiat\t%s\n' "$FIAT" -fi +bcli -rpcwallet=personal getbalance + +#if [ -n "$1" ]; then +# FIAT=$(printf '%s sats to fiat\n' "$SATS" | bcalc --price "$1") +# printf 'fiat\t%s\n' "$FIAT" +#fi diff --git a/bin/btc-blocks-behind b/bin/btc-blocks-behind @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +monad_blocks=$(ssh monad btc-blocks 2>/dev/null) +our_blocks=$(btc blocks) +behind=$(bc <<<"$monad_blocks - $our_blocks") + +printf "%s\n" "$behind" diff --git a/bin/btc-reqblocks b/bin/btc-reqblocks @@ -0,0 +1 @@ +nncp-run monad btc-sendblocks $(bitcoin-cli getblockcount) quiver diff --git a/bin/btc-submitblocks b/bin/btc-submitblocks @@ -6,14 +6,18 @@ mkdir -p /tmp/blocks nncp-toss -blocks=$(bcli getblockcount) +blocks=$(bitcoin-cli getblockcount) cd /tmp/blocks -for block in $(ls -1 | sort -n) +blocklist=$(ls -1 | sort -n) +to_submit=$(wc -l <<<"$blocklist") +printf "%d blocks to submit...\n" "$to_submit" >&2 + +for block in $blocklist do printf "submitting block $block ... " >&2 - res=$(<$block bcli -stdin submitblock) + res=$(<$block bitcoin-cli -stdin submitblock) printf "$res\n" >&2 diff --git a/bin/btc-taproot b/bin/btc-taproot @@ -0,0 +1,6 @@ +#!/bin/sh + +qalc -t "$(bcli getblockchaininfo | +jq -r .softforks.taproot.bip9.min_activation_height) - $(bcli getblockcount)) * 10 minutes" | +tee /dev/stderr | +xargs -I{} qalc -t now + {} diff --git a/bin/callq b/bin/callq @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +objdump -d "$@" | grep callq | sedcut '<\([^>]*\)>' | sortur diff --git a/bin/curl-activity b/bin/curl-activity @@ -1,3 +1,3 @@ #!/usr/bin/env bash -curl -sL -H 'Accept: application/ld+json; profile="https://www.w3.org/ns/activitystreams"' "$@" | jq -C . +curl -sL -H 'Accept: application/ld+json; profile="https://www.w3.org/ns/activitystreams"' "$@" diff --git a/bin/edit-gui b/bin/edit-gui @@ -1,2 +1,2 @@ -#!/usr/bin/env sh -urxvtc -e nvim "$@" +#!/bin/sh +urxvt -e edit "$@" diff --git a/bin/fuzz-jump-branchdiff b/bin/fuzz-jump-branchdiff @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -eou pipefail +find .git/refs | sed 's,^.git/,...,g' | fzf | xargs fuzz-edit-diff-line diff --git a/bin/fuzz-jump-tag b/bin/fuzz-jump-tag @@ -1,5 +1,4 @@ #!/usr/bin/env bash - set -eou pipefail TAGS=tags @@ -13,12 +12,6 @@ if [ ! -f tags ]; then fi fi -cutt() { - cut -d $'\t' --output-delimiter=$'\t' "$@" -} - -res=$(grep -v '^!_TAG' "$TAGS" | fzf) -file=$(<<<"$res" cutt -f2) -search=$(<<<"$res" cutt -f3- | sed -E -n 's,^([^"]+).*,\1,p') +tag=$(grep -v '!_TAG' "$TAGS" | fuzzer ^"$@" | cutt -f1) -printf "vim '%s' -c %q -c :noh\n" "$file" "$search" +echo "$EDITOR -t $tag" diff --git a/bin/fuzz-make b/bin/fuzz-make @@ -2,7 +2,7 @@ set -eou pipefail -cmd=$(grep '^[^#[:space:]].*:' Makefile | grep -v PHONY | cut -d: -f1 | sort | +cmd=$(grep '^[^#[:space:]].*:' Makefile | grep -v PHONY | cut -d: -f1 | sort -u | env FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS --select-1 --exit-0" fuzzer "$@") echo $cmd diff --git a/bin/fuzz-search-file b/bin/fuzz-search-file @@ -1,8 +1,22 @@ #!/usr/bin/env bash -set -eou pipefail -file=$(rg --files | fuzzer "$@") +set -eo pipefail + +file="$1" +if [ -n $1 ]; then + if [ ! -f "$1" ]; then + file=$(rg --files | fuzzer "$1") + fi +else + file=$(rg --files | fuzzer) +fi + + file=$(readlink -f "$file") -batcmd="bat --color=always \"$file\" | cat -n | $FUZZER --ansi --tac | awk '{print \$1}'" -fuzz-record-command "$batcmd | xargs -I{} $EDITOR \"$file\" +\{\}" -line=$(eval $batcmd) -echo $EDITOR \"$file\" +$line +q="" +if [ -n "$2" ] && [ "$2" != "" ]; then + q="--query '$2'" +fi + +linecmd="awkt '{print \$0, NR}' '$file' | fzf --ansi --tac $q | sed -En 's,.*\t([0-9]+)$,\1,p'" +num=$(eval $linecmd) +echo ${3:-$EDITOR} +$num \"$file\" "# $(sed -n ${num}p "$file")" diff --git a/bin/fuzz-trello-sprint b/bin/fuzz-trello-sprint @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +set -eo pipefail + +board=${TRELLO_BOARD:-Sprint} + +all=$(cat <<\EOS +/^[^*]/ { + list="" + for(i=6;i<=NF;i++) { + list = list" "$i + } +} + +/^\*/ { + print list " " $0 +} +EOS +) + +stripansi() { + sed 's/\x1b\[[0-9;]*m//g' +} + +card=$(trello show-cards -b $board | stripansi | awk "$all" | fuzzer "$1") +#list=$(trello show-lists -b $board | grep ID | fuzzer "$1" | sed -En 's,^([^(]+) \(ID:.*,\1,p') +#card=$(trello show-cards -b $board -l "$list" | grep '^\*' | fzf) +card_id=$(sed -En 's,.*\* ([^ ]+).*,\1,p' <<<"$card") +card_name=$(cut -d- -f 2- <<<"$card") +list=$(cut -d\* -f1 <<<"$card") +echo "trello card-details $card_id | less --quit-if-one-screen # $list > $card_name" diff --git a/bin/fuzzdoc b/bin/fuzzdoc @@ -0,0 +1,6 @@ +#!/usr/bin/env sh +file=$1 +prefix=$2 +shift +shift +fuzz-search-file "$file" "$prefix $@" "less -S" diff --git a/bin/fuzzedit b/bin/fuzzedit @@ -0,0 +1,6 @@ +#!/usr/bin/env sh +file=$1 +prefix=$2 +shift +shift +fuzz-search-file "$file" "$prefix$@" edit diff --git a/bin/git-hash b/bin/git-hash @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +git rev-parse HEAD | tee /dev/stderr | tr -d '\n' | xclip diff --git a/bin/gm b/bin/gm @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +gmni -j always "$@" diff --git a/bin/lcli b/bin/lcli @@ -1,2 +1,2 @@ #!/usr/bin/env sh -$HOME/dev/github/ElementsProject/lightning/cli/lightning-cli --lightning-dir $HOME/.lightning "$@" +ssh monad /home/jb55/bin/lcli "$@" diff --git a/bin/monad-run b/bin/monad-run @@ -0,0 +1,3 @@ +#!/bin/sh + +nncp-run monad "$@" diff --git a/bin/monad-ytdl b/bin/monad-ytdl @@ -0,0 +1,2 @@ +#!/bin/sh +nncp-run monad yt-dlp --exec 'quiver-file {}' "$1" diff --git a/bin/nncp-cat-handler b/bin/nncp-cat-handler @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +. /home/jb55/.nncpenv + +msgfile=$(mktemp) +tmp=$(mktemp) +cat > "$tmp" + +cat <<EOF > $msgfile +response from $NNCP_SENDER for command: + +$ $@ + +Output saved to $tmp + +THIS FILE WILL BE DELETED when this closes +Make sure to move it or lose it! + +Go to the next page to view output. +EOF + +read -r -d '' cmds <<EOF +less $msgfile $tmp +rm -f $tmp $msgfile +EOF + +urxvtc -e bash -c "$cmds" diff --git a/bin/nncp-next-uplink b/bin/nncp-next-uplink @@ -0,0 +1,2 @@ +#!/bin/sh +qalc -t "$(cat ~/var/nsync-sleep) seconds - ($(date +%s) - $(cat ~/var/nsync)) seconds" diff --git a/bin/nncp-run b/bin/nncp-run @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +dst=${1:-monad} +shift + +if [ -t 0 ]; then + echo -n "" | nncp-exec $dst cmd "$@" +else + nncp-exec $dst cmd "$@" +fi + diff --git a/bin/nostat b/bin/nostat @@ -1,18 +1,9 @@ #!/usr/bin/env bash -services="home-email-notifier work-email-notifier email-notify-switcher" - -export SYSTEMD_COLORS=1 - ctl () { printf "%s-ing %s email notifier\n" "$1" "$2" >&2 } -if [ $# -eq 0 ] -then - printf "nostat [ARGS].. - ARGS: {+,-}h, +start, -stop\n" >&2 -fi - for var in "$@" do case $var in @@ -27,12 +18,10 @@ do esac done -printf '\n' >&2 - -res=$(ls -1 ~/var/notify) -if [ -z "$res" ] +res=off +if [ -f ~/var/notify/home ] then - res=off + res=on fi printf '%s\n' "$res" diff --git a/bin/nsync b/bin/nsync @@ -0,0 +1,3 @@ +#!/bin/sh + +nncp-call -onlinedeadline ${1:-10} -autotoss ${2:-monad} diff --git a/bin/project-root b/bin/project-root @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +exec git rev-parse --show-toplevel diff --git a/bin/repl b/bin/repl @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +cmd="$@" +name="$1" + +while true +do + printf "%s> " "$name" + + read args + + $cmd "$args" +done + +printf "\n" diff --git a/bin/rfc b/bin/rfc @@ -15,7 +15,7 @@ rfc_file="$RFC_DIR/rfc${1}.txt" if [ ! -f "$rfc_file" ] then - url="https://tools.ietf.org/rfc/rfc${1}.txt" + url="https://www.rfc-editor.org/rfc/rfc${1}.txt" curl --fail --compressed -s "$url" > "$rfc_file" || (rm -f "$rfc_file" && exit 1) fi diff --git a/bin/search-files b/bin/search-files @@ -10,4 +10,4 @@ res=$(fzf --bind "change:reload:$RG_PREFIX {q} || true" --ansi --phony --query " file=$(readlink -f $(cut -d: -f1 <<<"$res")) line=$(cut -d: -f2 <<<"$res") -echo \"$file\" +$line +echo +$line \"$file\" "# $(cut -d: -f4- <<<"$res")" diff --git a/bin/sql b/bin/sql @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +dosql() { + local query="$1" + local args=("-U" "$pg_user" -A) + if [ ! -z "$query" ]; + then + args+=(-c "$query") + fi + psql -F $'\t' "${args[@]}" +} + +dosql "$@" | column -t -s $'\t' | less -S diff --git a/bin/stripansi b/bin/stripansi @@ -1,2 +1,2 @@ -#!/usr/bin/env bash -exec perl -pe 's/\e\[?.*?[\@-~]//g' +#!/bin/sh +exec sed 's/\x1b\[[0-9;]*m//g' diff --git a/bin/timer b/bin/timer @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -e + +usage() { + printf "usage: timer "food is ready!" 10min\n" + exit 0 +} + +if [ -z "$1" ]; then + usage +fi + +now=$(date +%s) +target=$(date -d "$2" +%s) + +duration=$(($target - $now)) + +sleep $duration +notify-send -u critical "$1" diff --git a/bin/trello-sprint b/bin/trello-sprint @@ -0,0 +1,6 @@ +#!/bin/sh +trello show-cards -b Sprint -l "In Progress" | +grep '^\*' | +fzf | +awkp 2 | +xargs trello card-details diff --git a/dotfiles/.Xresources b/dotfiles/.Xresources @@ -20,8 +20,8 @@ URxvt.keysym.M-v: perl:keyboard-select:activate URxvt.keysym.M-s: perl:keyboard-select:search URxvt.keysym.M-f: perl:url-picker -URxvt.resize-font.smaller: M-j -URxvt.resize-font.bigger: M-k +URxvt.resize-font.smaller: M-9 +URxvt.resize-font.bigger: M-0 ! urxvt @@ -30,14 +30,14 @@ URxvt.resize-font.bigger: M-k !URxvt*font: xft:Source Code Pro:size=13:antialias=true;hinting=true,\ ! xft:Kochi Gothic:antialias=true,hinting=true !URxvt*font: xft:PT Mono:size=11 -URxvt*font: xft:Inconsolata:size=18:hinting=true +URxvt*font: xft:Inconsolata:size=20:hinting=true !urxvt.font: xft:terminus:antialias=false:pixelsize=16 !xft:Inconsolata:size=18:antialias=true;hinting=true ! /* URxvt*font: xft:Noto Serif:size=10:antialias=true;hinting=true */ -URxvt*internalBorder: 22 +URxvt*internalBorder: 14 URxvt*matcher.button: 1 URxvt.color-themes.autosave: 1 diff --git a/dotfiles/.bash_aliases b/dotfiles/.bash_aliases @@ -1,5 +1 @@ #!/usr/bin/env bash - -# generic stuff for non-interactive shells - -# sharefile diff --git a/dotfiles/.bashrc b/dotfiles/.bashrc @@ -5,6 +5,12 @@ set -o vi export HOME=/home/jb55 +export NIXPKGS=$HOME/nixpkgs +export NIX_PATH="nixpkgs=$NIXPKGS:$NIX_PATH" +export NIX_PATH="nixos-config=$NIX_FILES:$NIX_PATH" +export NIX_PATH="jb55pkgs=$HOME/etc/jb55pkgs:$NIX_PATH" +export NIX_PATH="dotfiles=$HOME/dotfiles:$NIX_PATH" + # If not running interactively, don't do anything #[ -z "$PS1" ] && return @@ -40,6 +46,8 @@ fi export NNCPCFG=~/.nncprc export PANDOC=pandoc-nice +export MAIL=/home/jb55/var/notify/email-notify +export MAILREADER=/run/current-system/sw/bin/neomutt export BAT_STYLE=plain export LPASS_HOME="$HOME/.config/lpass" export FUZZER=fzf @@ -48,9 +56,6 @@ export GEMINICLIENT=av98 export GOPHER=$GOPHERCLIENT export GNUPGHOME="$HOME/.gnupg" export SHAREFILE_HOST='charon:public/s/' -export KINDLE_FROM_EMAIL='jackbox55@gmail.com' -export KINDLE_TXT_EMAIL='jb55@jb55.com' -export KINDLE_EMAIL='jb55@free.kindle.com' export SHAREFILE_URL='https://jb55.com/s/' export SHARE_SS_DIR="$HOME/var/img/ss" export DOTFILES=${DOTFILES:-$HOME/dotfiles} @@ -62,16 +67,6 @@ export FZF_DEFAULT_OPTS="-e" export FZF_DEFAULT_COMMAND='rg --files --hidden' export EMACSCLIENT=edit -export NIXPKGS=$HOME/nixpkgs - -# nix paths -export NIX_PATH="nixpkgs=$NIXPKGS:$NIX_PATH" -export NIX_PATH="nixos-config=$NIX_FILES:$NIX_PATH" -export NIX_PATH="jb55pkgs=$HOME/etc/jb55pkgs:$NIX_PATH" -export NIX_PATH="dotfiles=$HOME/dotfiles:$NIX_PATH" - -# Customize to your needs... - # other export EDITOR="edit" export VISUAL="edit" @@ -93,52 +88,55 @@ function run_fuzzer() { eval "$(fuzz-run-command "$@")" } -alias C="pcal list" -alias Ci="pcal interactive" -alias m="neomutt" -alias mq="msmtp-queue" -alias s="general-status" -alias t="todo.sh" -alias e="edit -n" -alias g=git -alias f=run_fuzzer -alias vim=nvim -alias feh="feh --conversion-timeout 2" -alias info="info --vi-keys" alias ag="ag --pager=less" alias attach="grabssh; screen -rD" alias awkt="awk -v FS=$'\t' -v OFS=$'\t'" alias catt="pygmentize -O style=monokai -f console256 -g" +alias Ci="pcal interactive" alias clip="xclip -selection clipboard" +alias C="pcal list" alias cpptags="ctags -R --sort=1 --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++" alias crontab="VIM_CRONTAB=true crontab" alias cutt="cut -d $'\t' --output-delimiter=$'\t'" +alias e="edit -n" alias emacs="env TERM=xterm-256color emacs" +alias feh="feh --conversion-timeout 2" alias fixssh="source $HOME/bin/fixssh" +alias f=run_fuzzer +alias fzf="fzf --exact" +alias g=git alias githist="git reflog show | grep '}: commit' | nl | sort -nr | nl | sort -nr | cut --fields=1,3 | sed s/commit://g | sed -e 's/HEAD*@{[0-9]*}://g'" +alias ibmgfx="cp437" +alias info="info --vi-keys" +alias jc="journalctl -u" +alias jcu="journalctl --user -u" alias jsonpp="python -mjson.tool" alias ls="ls --color" +alias m="neomutt" +alias mq="msmtp-queue" +alias mt="f nt query:today" +alias myipaddress=myip +alias myip="dig +short myip.opendns.com @resolver1.opendns.com" alias noder="env NODE_NO_READLINE=1 rlwrap node" alias nr="npm run" +alias ns="nix-shell -p" alias page=$PAGER alias prettyjson=jsonpp +alias qud="steam-run ~/.local/share/Steam/steamapps/common/Caves\ of\ Qud/CoQ.x86_64" +alias scs="systemctl status" +alias scsu="systemctl status --user" +alias s="general-status" alias sorry='sudo $(fc -l -n -1)' alias tmuxa="tmux a -d -t " alias tmux="tmux -2" +alias t="todo.sh" +alias u="cd .." +alias vim=nvim alias vless="/usr/share/vim/vim72/macros/less.sh" alias vnc_once="x11vnc -safer -nopw -once -display :0" +alias wanip=myip alias wget="wget -c" alias xclip="xclip -selection clipboard" -alias myip="dig +short myip.opendns.com @resolver1.opendns.com" -alias wanip=myip -alias myipaddress=myip -alias ns="nix-shell -p" -alias fzf="fzf --exact" -alias u="cd .." -alias scs="systemctl status" -alias scsu="systemctl status --user" -alias jc="journalctl -u" -alias jcu="journalctl --user -u" ghclone () { cd "$(gh-clone "$@")" @@ -285,10 +283,6 @@ source $DOTFILES/.fzf_helpers # z source $HOME/bin/z.sh -# nix -#. /Users/jb55/.nix-profile/etc/profile.d/nix.sh - -CURL_CA_BUNDLE=/opt/local/share/curl/curl-ca-bundle.crt [ -e "$DIRCOLORS" ] && eval "$(dircolors -b "$DIRCOLORS")" [ -f ~/.fzf.bash ] && source ~/.fzf.bash [ -f ~/bin/z.sh ] && source ~/bin/z.sh @@ -304,6 +298,8 @@ bind '"\C-x^": history-expand-line' bind '"\C-f": "\C-x\C-addi`fuzz-run-command`\C-x\C-e\C-x^\C-x\C-a$a\C-x\C-r"' bind -m vi-command '"\C-f": "i\C-f"' -bind '"\C-h": "\C-x\C-addi`fuzz-run-command sh`\C-x\C-e\C-x^\C-x\C-a$a\C-x\C-r"' +bind '"\C-g": "\C-x\C-addi`fuzz-run-command sh`\C-x\C-e\C-x^\C-x\C-a$a\C-x\C-r"' bind -m vi-command '"\C-h": "i\C-h"' bind '"\C-l":clear-screen' + + diff --git a/dotfiles/.config/mimi/mime.conf b/dotfiles/.config/mimi/mime.conf @@ -1,12 +1,13 @@ txt: urxvtc -e lessr tsv: urxvtc -e sc-im -text/: edit +text/: urxvtc -e edit application/pdf: zathura djvu: zathura text/html: /home/jb55/bin/browser html: /home/jb55/bin/browser mhtml: /home/jb55/bin/browser video/: mpv +video/mp4: mpv image/: sxiv audio/: mpv svg: feh --conversion-timeout 2 @@ -18,10 +19,10 @@ application/x-rar: urxvtc -e una application/x-xz: urxvtc -e una application/zip: urxvtc -e una inode/directory: urxvtc -e ranger -gopher: /home/jb55/bin/lagrange -gemini: /home/jb55/bin/lagrange +gopher: lagrange +gemini: lagrange zoommtg: zoom-us -mailto: urxvtc -e neomutt +mailto: urxvt -e neomutt spotify: /home/jb55/bin/spotify-open ps: zathura epub: zathura diff --git a/dotfiles/.config/neomutt/neomuttrc b/dotfiles/.config/neomutt/neomuttrc @@ -4,14 +4,15 @@ set sendmail="/home/jb55/bin/sendmail" set virtual_spoolfile=yes set folder="/home/jb55/mail/personal" set wait_key=no +set pager_stop=yes set from="jb55@jb55.com" set pipe_decode=yes -#set envelope_from=yes +set envelope_from=yes set mime_forward=no unset markers set text_flowed -set sort = threads +set sort = threads set sort_aux = reverse-last-date-received virtual-mailboxes \ @@ -37,6 +38,9 @@ macro index,pager S "<modify-labels>+spam -unread -inbox<enter>j<enter> macro index c "<change-vfolder>?" "Change to vfolder overview" macro index \\\\ "<vfolder-from-query>" "Search mailbox" macro pager p "|delta --paging always<enter>" +macro pager d "<next-page>" +macro pager u "<previous-page>" +macro pager c "|cols<enter>" macro pager P "|grep patch$ | xargs curl -sL | delta --paging always<enter>" my_hdr Bcc: William Casarin <jb55@jb55.com> diff --git a/dotfiles/.config/nvim/init.vim b/dotfiles/.config/nvim/init.vim @@ -9,20 +9,49 @@ set colorcolumn=80 set nowrap set hidden +hi ColorColumn ctermbg=8 + map Y y$ syntax on -set clipboard+=unnamedplus +set clipboard=unnamedplus let mapleader = "\\" let maplocalleader = "\\" nmap <Leader>xda ma:%s/\s\+$//g<CR>`a + +nmap <C-q> :q<CR> nmap <C-x> :x<CR> +nmap <C-s> ^D +nmap <C-n> :tn<CR> +nmap <C-p> :tp<CR> + +imap <A-j> { +imap <A-k> } +imap <A-n> [ +imap <A-m> ] +imap <A-h> ( +imap <A-l> ) +imap <A-u> _ +imap <A-i> - +imap <A-o> + +imap <A-,> = +imap <A-Space> <CR> autocmd FileType go autocmd BufWritePre <buffer> execute "normal! mz:mkview\<esc>:%!fmtsafe gofmt\<esc>:loadview\<esc>`z" +autocmd FileType go set wrap rnu autocmd FileType rust autocmd BufWritePre <buffer> execute "normal! mz:mkview\<esc>:%!fmtsafe rustfmt\<esc>:loadview\<esc>`z" autocmd filetype javascript set sw=4 ts=4 expandtab +"autocmd filetype html set sw=2 ts=2 expandtab + +autocmd BufEnter,BufNew *.nix set sw=2 ts=2 expandtab autocmd BufEnter,BufNew *.gmi set wrap linebreak + au BufWritePost,FileWritePost ~/.Xdefaults,~/.Xresources silent! !xrdb -load % >/dev/null 2>&1 + +if has("autocmd") + au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") + \| exe "normal! g'\"" | endif +endif diff --git a/dotfiles/.config/qutebrowser/config.py b/dotfiles/.config/qutebrowser/config.py @@ -32,7 +32,7 @@ config.set('fonts.default_family', 'terminus') if hostname == 'monad': config.set('zoom.default', 125) else: - config.set('zoom.default', 150) + config.set('zoom.default', 125) # Editor (and arguments) to use for the `open-editor` command. The @@ -67,6 +67,7 @@ config.bind('<Ctrl-m>', 'set-mark') #config.bind('<Ctrl-d>', 'scroll-page 0 0.5') #config.bind('<Ctrl-u>', 'scroll-page 0 -0.5') config.bind('<Ctrl-r>', 'reload') +config.bind('<Ctrl-e>', 'edit-text') config.bind('e', 'open-editor') config.bind('co', 'tab-only') diff --git a/dotfiles/.config/qutebrowser/quickmarks b/dotfiles/.config/qutebrowser/quickmarks @@ -26,3 +26,4 @@ zlibrary https://ca1lib.org/ scihub https://sci-hub.se/ twitter https://tweetdeck.twitter.com/ wasm-instantiation https://webassembly.github.io/spec/core/exec/modules.html#exec-instantiation +topology-lectures https://www.youtube.com/playlist?list=PLRlVmXqzHjUQHEx63ZFxV-0Ortgf-rpJo diff --git a/dotfiles/.config/zathura/zathurarc b/dotfiles/.config/zathura/zathurarc @@ -11,4 +11,4 @@ set recolor-darkcolor "#afb6c3" set recolor-keephue "false" set scroll-page-aware "false" -set scroll-step 100 +set scroll-step 10 diff --git a/dotfiles/.gitconfig b/dotfiles/.gitconfig @@ -47,7 +47,6 @@ default = !git config branch.master.remote origin && git config branch.master.merge refs/heads/master ds = diff --staged ff = merge --ff-only - hash = !"git rev-parse HEAD | tr -d '\n' | xclip" lnd = log --no-decorate lg1 = log --graph --branches --tags --remotes --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %s %C(bold)— %an%C(reset)%C(bold yellow)%d%C(reset)' --abbrev-commit --date=relative lgl = log --format='%h %cr %s' @@ -88,7 +87,7 @@ enabled = false autoupdate = false [gpg] - program = ~/bin/ots-git + program = /home/jb55/bin/ots-git [magit] hideCampaign = true [github] @@ -99,3 +98,5 @@ lineNumber = true [credential "https://github.com"] helper = !gh auth git-credential +[init] + defaultBranch = master diff --git a/dotfiles/.mail_aliases b/dotfiles/.mail_aliases @@ -4,3 +4,4 @@ alias mikhail Mikhail Baiman <mikhail.baiman@steamoji.com> alias alex Alex Chunn <alex.chunn@steamoji.com> alias jesse Jesse Brydle <jesse.brydle@steamoji.com> alias v Vanessa Gray <vanessagray31@gmail.com> +alias steam William Casarin <will.casarin@steamoji.com> diff --git a/dotfiles/.mailcap b/dotfiles/.mailcap @@ -1,4 +1,5 @@ text/html; open %s; nametemplate=%s.html text/csv; pcsv %s image/*; open %s +video/*; open %s application/pdf; open %s diff --git a/dotfiles/.vim/.vimrc b/dotfiles/.vim/.vimrc @@ -1,389 +1,38 @@ -" vim: foldmethod=marker: +inoremap <Esc> <Nop> +inoremap <special> fd <Esc> -"if 0 | endif - -filetype plugin indent on - -" Settings -set modeline -set modelines=1 -set nocp set tabstop=8 set shiftwidth=8 -set expandtab set ai set hlsearch -set hidden -set nowrap -set ruler set colorcolumn=80 -set t_Co=16 -highlight ColorColumn ctermbg=8 -set relativenumber -set dir=~/.vim/tmp -exe 'set t_kB=' . nr2char(27) . '[Z' -set vb t_vb= -syntax on - -if $VIM_CRONTAB == "true" - set nobackup - set nowritebackup -endif +set nowrap +set hidden -set clipboard+=unnamedplus +hi ColorColumn ctermbg=8 -" gvim fonts -" if has("gui_running") -" colorscheme molokai -" else -" set t_Co=256 -" set clipboard=unnamed -" colorscheme base16-onedark -" endif +map Y y$ -" +syntax on -" Mappings +set clipboard=unnamed -"call arpeggio#map('i', '', 0, 'fd', '<Esc>') -"let g:arpeggio_timeoutlen = 100 -"let mapleader = "\<SPACE>" -"let maplocalleader = "\<SPACE>" let mapleader = "\\" let maplocalleader = "\\" - -" digraphs - -nmap Q :qa<CR> - -" lambda λ -imap <C-d>j <C-k>l* -" approx equal ≅ -imap <C-d>a <C-k>?= -" subset ⊆ -imap <C-d>s <C-k>(_ -" element of ∈ -imap <C-d>e <C-k>(- -" right arrow → -imap <C-d>l <C-k>-> -" left arrow ← -imap <C-d>h <C-k><- -" compose ∘ -imap <C-d>o <C-k>Ob - -nnoremap <F10> :set invpaste paste?<CR> -imap <F10> <C-O><F10> -set pastetoggle=<F10> -nmap <F9> :TagbarToggle<CR> -map <F8> :make tags<CR> -map <F12> :TlistToggle<CR> -map <F11> :NERDTreeToggle<CR> -map <F2> :exec ":!hasktags -x -c --ignore src"<CR><CR> -map <F4> :call RCmd("make")<CR> -map <F5> :make<CR> -map <F6> :call RCmd("make test")<CR> -map <F7> :call RCmd("make deploy")<CR> - -nmap <Leader>nr "nyiW:call RCmd("npm repo <C-r>n")<CR> - -map <C-j> kddpkJ -map <Leader>] :tnext<CR> -map <Leader>[ :tprev<CR> -map <S-l> :cn<CR> -map <S-h> :cN<CR> -map <C-n> :lnext<CR> -map <C-p> :lprev<CR> -nmap <C-h> <C-w>h -nmap <C-l> <C-w>l -map <Leader>a :%s/\ at\ /\r\ at\ /g<CR> - -" Replace whitespace before and after commas -map <Leader>, :%s/\s\+,/,/g<CR>:%s/,\s\+/,/g<CR> - -map <Leader>y :Lodgeit<CR> -nmap <Leader>C :ccl<CR> -nmap <Leader>vs vip:sort<CR> nmap <Leader>xda ma:%s/\s\+$//g<CR>`a -nmap <Leader>rr :call ReloadSnippets(&filetype)<CR> -map <Leader><Leader>x :silent %!xmllint --encode UTF-8 --format -<CR> -vmap <Leader><Leader>x :!xmllint --encode UTF-8 --format -<CR> -vmap <Leader><Leader>j !jade -p % -o "{ prettyprint: true }"<CR> - -"map <Leader>cr :!newclay % && ./main<CR> - -cmap w!! %!sudo tee > /dev/null % - -" I never use ctrl-b anyways -nmap <C-b> <C-a> - -" Tabular bindings -nmap <Leader>== :Tabularize /=<CR> -vmap <Leader>== :Tabularize /=<CR> -nmap <Leader>=, :Tabularize /,<CR> -vmap <Leader>=, :Tabularize /,<CR> -nmap <Leader>=<Bar> :Tabularize /<Bar><CR> -vmap <Leader>=<Bar> :Tabularize /<Bar><CR> -nmap <Leader>=:: :Tabularize /::<CR> -vmap <Leader>=:: :Tabularize /::<CR> -nmap <Leader>=: :Tabularize /:\zs<CR> -vmap <Leader>=: :Tabularize /:\zs<CR> - -" Plugin Options - -let g:SuperTabDefaultCompletionType = "context" - -" For snippet_complete marker. -if has('conceal') - set conceallevel=2 concealcursor=i -endif - -let g:haddock_browser="open" - -let g:gitgutter_enabled = 1 -let g:indent_guides_auto_colors = 0 -let g:indent_guides_guide_size = 1 -let g:indent_guides_start_level = 2 -let g:indent_guides_enable_on_vim_startup = 1 - -let g:Powerline_symbols = 'fancy' - -let g:miniBufExplMapCTabSwitchBufs = 1 -let g:miniBufExplModSelTarget = 1 - -let g:clj_highlight_builtins=1 " Highlight Clojure's builtins -let g:clj_paren_rainbow=1 " Rainbow parentheses'! - -let g:SuperTabDefaultCompletionType = "context" - -let g:clang_complete_copen = 1 -let g:clang_snippets = 1 -let g:clang_use_library = 1 - -let g:syntastic_loc_list_height=3 -let g:syntastic_always_populate_loc_list = 1 -let g:syntastic_auto_loc_list = 1 -let g:syntastic_check_on_open = 1 -let g:syntastic_check_on_wq = 0 -let g:syntastic_coffee_coffeelint_conf = '~/.coffeelintrc' -let g:syntastic_enable_signs=1 -let g:syntastic_error_symbol='✗' -let g:syntastic_haskell_checkers = [] -let g:syntastic_javascript_checkers = ['eslint'] -let g:syntastic_javascript_eslint_args = '~/.eslintrc' -let g:syntastic_warning_symbol='⚠' -let g:EasyMotion_leader_key = '<Leader>' +nmap <C-q> :q<CR> +nmap <C-x> :x<CR> +nmap <C-s> ^D +nmap <C-n> :tn<CR> +nmap <C-p> :tp<CR> -let g:ctrlp_cmd = 'CtrlPMixed' -let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|\.git\|\.hg\|\.svn\|\.redo\|dist\|cabal-dev\|lib-cov' -let g:ctrlp_extensions = ['tag'] -let g:ctrlp_switch_buffer=0 +autocmd FileType go autocmd BufWritePre <buffer> execute "normal! mz:mkview\<esc>:%!fmtsafe gofmt\<esc>:loadview\<esc>`z" +autocmd FileType go set wrap rnu +autocmd FileType rust autocmd BufWritePre <buffer> execute "normal! mz:mkview\<esc>:%!fmtsafe rustfmt\<esc>:loadview\<esc>`z" +"autocmd filetype html set sw=2 ts=2 expandtab -" fix gitgutter color -highlight clear SignColumn +autocmd BufEnter,BufNew *.nix set sw=2 ts=2 expandtab +autocmd BufEnter,BufNew *.gmi set wrap linebreak -" Linux style C - - -if exists("g:loaded_linuxsty") - finish -endif -let g:loaded_linuxsty = 1 - -set wildignore+=*.ko,*.mod.c,*.order,modules.builtin - -augroup linuxsty - autocmd! - - autocmd FileType c,cpp call s:LinuxConfigure() - autocmd FileType diff setlocal ts=8 - autocmd FileType kconfig setlocal ts=8 sw=8 sts=8 noet - autocmd FileType dts setlocal ts=8 sw=8 sts=8 noet -augroup END - -function s:LinuxConfigure() - let apply_style = 0 - - if exists("g:linuxsty_patterns") - let path = expand('%:p') - for p in g:linuxsty_patterns - if path =~ p - let apply_style = 1 - break - endif - endfor - else - let apply_style = 1 - endif - - if apply_style - call s:LinuxCodingStyle() - endif -endfunction - -command! LinuxCodingStyle call s:LinuxCodingStyle() - -function! s:LinuxCodingStyle() - call s:LinuxFormatting() - call s:LinuxKeywords() - call s:LinuxHighlighting() -endfunction - -function s:LinuxFormatting() - setlocal tabstop=8 - setlocal shiftwidth=8 - setlocal softtabstop=8 - setlocal textwidth=80 - setlocal noexpandtab - - setlocal cindent - setlocal cinoptions=:0,l1,t0,g0,(0 -endfunction - -function s:LinuxKeywords() - syn keyword cOperator likely unlikely - syn keyword cType u8 u16 u32 u64 s8 s16 s32 s64 - syn keyword cType __u8 __u16 __u32 __u64 __s8 __s16 __s32 __s64 -endfunction - -function s:LinuxHighlighting() - highlight default link LinuxError ErrorMsg - - syn match LinuxError / \+\ze\t/ " spaces before tab - syn match LinuxError /\%>80v[^()\{\}\[\]<>]\+/ " virtual column 81 and more - - " Highlight trailing whitespace, unless we're in insert mode and the - " cursor's placed right after the whitespace. This prevents us from having - " to put up with whitespace being highlighted in the middle of typing - " something - autocmd InsertEnter * match LinuxError /\s\+\%#\@<!$/ - autocmd InsertLeave * match LinuxError /\s\+$/ -endfunction - -" Autocommands - -augroup encrypted - au! - - " First make sure nothing is written to ~/.viminfo while editing - " an encrypted file. - autocmd BufReadPre,FileReadPre *.gpg set viminfo= - " We don't want a various options which write unencrypted data to disk - autocmd BufReadPre,FileReadPre *.gpg set noswapfile noundofile nobackup - - " Switch to binary mode to read the encrypted file - autocmd BufReadPre,FileReadPre *.gpg set bin - autocmd BufReadPre,FileReadPre *.gpg let ch_save = &ch|set ch=2 - " (If you use tcsh, you may need to alter this line.) - autocmd BufReadPost,FileReadPost *.gpg '[,']!gpg2 --decrypt 2> /dev/null - - " Switch to normal mode for editing - autocmd BufReadPost,FileReadPost *.gpg set nobin - autocmd BufReadPost,FileReadPost *.gpg let &ch = ch_save|unlet ch_save - autocmd BufReadPost,FileReadPost *.gpg execute ":doautocmd BufReadPost " . expand("%:r") - - " Convert all text to encrypted text before writing - " (If you use tcsh, you may need to alter this line.) - autocmd BufWritePre,FileWritePre *.gpg '[,']!gpg2 --default-recipient-self -ae 2>/dev/null - " Undo the encryption so we are back in the normal text, directly - " after the file has been written. - autocmd BufWritePost,FileWritePost *.gpg u -augroup END - -"au BufEnter *.hs compiler ghc -au BufRead,BufNewFile *.nix set syn=nix -au BufRead,BufNewFile *.nix set filetype=nix -au BufRead,BufNewFile *.c,*.cpp,*.h set cindent -au BufRead,BufNewFile *.c,*.cpp,*.h set cino=(0 -au BufRead,BufNewFile *.clay set syn=clay -au BufRead,BufNewFile *.clj set syntax=clojure -au BufRead,BufNewFile *.coffee set ft=coffee -au BufRead,BufNewFile *.do set syn=sh -au BufRead,BufNewFile *.galaxy set syn=galaxy -au BufRead,BufNewFile *.glsl set syntax=glsl -au BufRead,BufNewFile *.gnu set syn=gnuplot -au BufRead,BufNewFile *.go set syntax=go -au BufRead,BufNewFile *.hx set syn=haxe -au BufRead,BufNewFile *.java set sw=4 -au BufRead,BufNewFile *.java set ts=4 -au BufRead,BufNewFile *.json set ft=json -au BufRead,BufNewFile *.less set syn=less -au BufRead,BufNewFile *.ll set syn=llvm -au BufRead,BufNewFile *.ly set syn=bn -au BufRead,BufNewFile *.material set syn=ogre3d_material -au BufRead,BufNewFile *.md,*.mkd,*.markdown set ft=markdown -au BufRead,BufNewFile *.mirah set syn=mirah -au BufRead,BufNewFile *.moon set syn=moon -au BufRead,BufNewFile *.rkt set syn=racket -au BufRead,BufNewFile *.rs set syn=rust -au BufRead,BufNewFile *.scala set syn=scala -au BufRead,BufNewFile *.swig set syn=swig -au BufRead,BufNewFile *.td set syn=tablegen -au BufRead,BufNewFile *.thrift set syn=thrift -au BufRead,BufNewFile *.ts set syn=typescript -au BufRead,BufNewFile *.ebnf set syn=ebnf -au BufRead,BufNewFile *.bnf set syn=bnf -au BufRead,BufNewFile *.ts set filetype=typescript -au BufRead,BufNewFile *.x set syn=alex -au BufRead,BufNewFile *.xsl let g:xml_syntax_folding = 1 -au BufRead,BufNewFile *.xsl set foldmethod=syntax -au BufRead,BufNewFile *.xsl set syn=xml -au BufRead,BufNewFile *.y set syn=bnf -au BufRead,BufNewFile *.y.pp set syn=happy -au BufRead,BufNewFile *.yaml set syn=yaml -au BufRead,BufNewFile *.yml set syn=yaml au BufWritePost,FileWritePost ~/.Xdefaults,~/.Xresources silent! !xrdb -load % >/dev/null 2>&1 -au BufRead,BufNewFile /etc/nginx/* set ft=nginx -au BufRead,BufNewFile nginx.conf set ft=nginx -au BufRead,BufNewFile wscript set syn=python -" - -" Commands - -function! PlaySound() -" uncomment to annoy coworkers -" silent! exec '!afplay ~/audio/typewriter_keystroke.wav &' -endfunction -autocmd CursorMovedI * call PlaySound() - -function! RCmd(cmd) - :silent! exe '!echo "cd ' . getcwd() . ' && ' . a:cmd . '" > /tmp/cmds' - :redraw! -endfunction - -function! GRCmd(cmd) - :call RCmd("git --no-pager " . a:cmd) -endfunction - -" Highlight a column in csv text. -" :Csv 1 " highlight first column -" :Csv 12 " highlight twelfth column -" :Csv 0 " switch off highlight -function! CSVH(colnr) - if a:colnr > 1 - let n = a:colnr - 1 - execute 'match Keyword /^\([^,]*,\)\{'.n.'}\zs[^,]*/' - execute 'normal! 0'.n.'f,' - elseif a:colnr == 1 - match Keyword /^[^,]*/ - normal! 0 - else - match - endif -endfunction -command! -nargs=1 Csv :call CSVH(<args>) - -" Wipe buffers with no files -function! s:WipeBuffersWithoutFiles() - let bufs=filter(range(1, bufnr('$')), 'bufexists(v:val) && '. - \'empty(getbufvar(v:val, "&buftype")) && '. - \'!filereadable(bufname(v:val))') - if !empty(bufs) - execute 'bwipeout' join(bufs) - endif -endfunction -command! WipeNoFiles call s:WipeBuffersWithoutFiles() - -" - -runtime! config/*.vim diff --git a/dotfiles/.xmonad/xmonad.hs b/dotfiles/.xmonad/xmonad.hs @@ -26,6 +26,7 @@ import XMonad.Hooks.SetWMName import XMonad.Hooks.UrgencyHook import XMonad.Layout.Gaps import XMonad.Layout.Grid +import XMonad.Util.Scratchpad import XMonad.Layout.LayoutModifier import XMonad.Layout.Maximize import XMonad.Layout.MultiToggle @@ -193,14 +194,17 @@ shouldFloat = do name <- appName return (fs && not (shouldntFloat name)) +scratchHook = scratchpadManageHook (W.RationalRect 0.1 0.1 0.6 0.6) +myManageHook = scratchHook <+> (shouldFloat --> doFullFloat) + myConfig theme = let lout = layout theme cfg = def { - terminal = "urxvtc" + terminal = termName , modMask = mod4Mask , layoutHook = lout , startupHook = myStartupHook (Layout lout) - , manageHook = shouldFloat --> doFullFloat -- doesn't show otherwise + , manageHook = myManageHook , normalBorderColor = "#222" , focusedBorderColor = "#BE5046" } @@ -236,6 +240,9 @@ toggleFull theme = sendMessage (Toggle (TabbedFull theme)) toggleMirror = sendMessage (Toggle MIRROR) toggleCenter = sendMessage (Toggle Center) +termName :: String +termName = "urxvtc" + myKeys theme = [ ("M-p", spawn "dmenu_run -fn \"terminus-12\" -p \"run\"") , ("M-a", focusUrgent) @@ -244,6 +251,7 @@ myKeys theme = [ , ("M-c", toggleCenter) , ("M-b", toggleMirror) , ("M-g", toggleGaps) + , ("M-s", scratchpadSpawnActionTerminal termName) -- , ("M-r", toggleFull) , ("M-v", sendKey shiftMask xK_Insert) ] diff --git a/dotfiles/commands b/dotfiles/commands @@ -1,6 +1,7 @@ bt btc txs fuzz-btc-txs cc compile fuzz-compile cd change directory fuzz-cd-dirname +cdpr cd project root echo cd $(project-root) ce compile error fuzz-compile-error cR compile repeat error fuzz-compile-repeat-error cr compile repeat fuzz-compile-repeat @@ -11,43 +12,51 @@ ed edit default.nix echo edit default.nix eFc edit fuzz command fuzz-edit-command eFl edit fuzz command list fuzz-edit-command-list egc edit git config echo edit ~/.gitconfig -elf edit last files fuzz-last-files edit -em edit mimi echo edit ~/.config/mimi/mime.conf -enc edit neomutt config echo edit ~/.config/neomutt/neomuttrc egm edit gemmarks echo edit ~/dotfiles/gemmarks -es email status echo email-status-once -evc edit nvim config echo edit ~/.config/nvim/init.vim +elf edit last files fuzz-last-files edit +eM edit mimi echo edit ~/.config/mimi/mime.conf +em edit mutt config echo edit ~/.config/neomutt/neomuttrc +vim edit vim config echo edit ~/.config/nvim/init.vim ff create file echo fuzz-create-file -jt jump tag fuzz-jump-tag -G gemini echo gemmark gb git branches echo git bvr +G gemini echo gemmark ghi github issues fuzz-gh-issue-list ghp github prf fuzz-gh-pr-list gpm git mlap echo git mlap h run history fuzz-run-hist +jt jump tag fuzz-jump-tag kp khal personal echo pcal -m make fuzz-make nai notmuch archive inbox fuzz-notmuch-archive-inbox nam notmuch am fuzz-notmuch-am nat notmuch archive fuzz-notmuch-archive Nc new command echo make-script ni notmuch inbox fuzz-notmuch-inbox nt notmuch threads fuzz-notmuch-threads +nT email today echo f nt query:today of open file fuzz-open-file olf open last files fuzz-last-files open pc cat project file fuzz-cat-file pf edit project file fuzz-edit-file ps edit project skeletons fuzz-edit-file --dir ~/dotfiles/skeletons rf recent files fuzz-recent-files -sgh search git head fuzz-edit-diff-line HEAD^- sc show command fuzz-show-script -sgd search git diff fuzz-edit-diff-line -sgs search git staged diff fuzz-edit-diff-line --staged +dsa docs->stripe->api ~/docs/stripe/jumpapi +dsg docs->stripe->go fuzzdoc ~/docs/stripe/go-v72.txt '^type ' +Ssg steamoji service gql fuzzedit schema '^' +Ssm steamoji service mutations fuzzedit mutation '^func ' +Ssq steamoji service queries fuzzedit query '^func ' +Sd edit steamoji doc echo edit /home/jb55/projects/steamoji/doc/$(ls -1pt /home/jb55/projects/steamoji/doc | grep -v / | head -n1) sFc show fuzz command fuzz-show-fuzz-command sf search project file funcs fuzz-funcs +sgd search git diff fuzz-edit-diff-line +sgh search git head fuzz-edit-diff-line HEAD^- +sgs search git staged diff fuzz-edit-diff-line --staged +sgb search git branch fuzz-jump-branchdiff sh show history fuzz-show-hist sp search project fuzz-search-files ss search project file fuzz-search-file -te todos edit echo edit ~/docs/todo/todo.txt -tj tag jump fuzz-tag-jump +ts trello sprint fuzz-trello-sprint +tsi trello sprint inprogress fuzz-trello-sprint "^In Progress " +tsb trello sprint backlog fuzz-trello-sprint "^Backlog " +tst trello sprint todo fuzz-trello-sprint "^Todo " z fz echo fz diff --git a/dotfiles/gemmarks b/dotfiles/gemmarks @@ -3,3 +3,5 @@ capcom gemini://gemini.circumlunar.space/capcom drewdevault gemini://drewdevault.com discovery gemini://discovery.geminiprotocol.com search gemini://geminispace.info/ +marginalia-search gemini://marginalia.nu/search +fedwiki gemini://jb55.com:1966 diff --git a/jb55pkgs/default.nix b/jb55pkgs/default.nix @@ -91,8 +91,8 @@ in rec { snap = fetch { repo = "sharefile-snap"; - rev = "1.3"; - sha256 = "0j8j2588z09v7zz1f9d11zw2n0wq70sxy9lvwrw4l5yz75n3cral"; + rev = "7eacc49f1df577a9faaa33a22664d93347ff362d"; + sha256 = "0x5531qyimpah48ijx2bad0mq1gjbpjacymwl3gm08lm0zl0xr09"; }; bcalc = fetch-jb55 { diff --git a/nix-config/environment/default.nix b/nix-config/environment/default.nix @@ -8,6 +8,7 @@ let jb55pkgs = import <jb55pkgs> { inherit pkgs; }; sha256 = "0xd86s2smjvlc7rlb6rkgx2hj3c3sbcz3gs8rf93x69jqdvwb6rr"; }) {}; myPackages = with jb55pkgs; [ + rsslink bcalc btcs csv-delim @@ -28,7 +29,6 @@ let jb55pkgs = import <jb55pkgs> { inherit pkgs; }; minimal-pkgs = with pkgs; [ git-tools - neovim fzf ripgrep ]; @@ -42,16 +42,17 @@ let jb55pkgs = import <jb55pkgs> { inherit pkgs; }; bat bc binutils + cp437 dateutils direnv du-dust - hashcash file fzf git-tools - gnupg gnumake + gnupg groff + hashcash haskellPackages.una htop imagemagick @@ -62,30 +63,45 @@ let jb55pkgs = import <jb55pkgs> { inherit pkgs; }; linuxPackages.bpftrace linuxPackages.perf lsof + mailutils manpages mdcat minisign neovim + nethack network-tools + nix-direnv nodejs opentimestamps-client par parallel patchelf pv - python + python3 ripgrep rsync + scdoc screen shellcheck + universal-ctags unixtools.xxd unzip - universal-ctags weechat wget + xonsh zip zstd ]; in { environment.systemPackages = if extra.is-minimal then minimal-pkgs else mypkgs; + + nix.extraOptions = '' + keep-outputs = true + keep-derivations = true + ''; + + environment.pathsToLink = [ + "/share/nix-direnv" + ]; + } diff --git a/nix-config/environment/desktop/default.nix b/nix-config/environment/desktop/default.nix @@ -29,26 +29,30 @@ let gtk2rc = pkgs.writeText "gtk2rc" '' enableIntro = false; enableFPS = false; enableDFHack = false; - enableTextMode = true; + enableTextMode = false; + theme = "cla"; }; mypkgs = (with pkgs; [ aerc + bitcoin clipmenu colorpicker + dasht dmenu dragon-drop - dasht dunst dynamic-colors feh - khal - todo-txt-cli getmail # for getmail-gmail-xoauth-tokens gnome3.gnome-calculator gtk-engine-murrine + hwi + khal + lagrange lastpass-cli libnotify + mpv msmtp muchsync neomutt @@ -66,18 +70,18 @@ let gtk2rc = pkgs.writeText "gtk2rc" '' simplescreenrecorder slock spotify + #steam sxiv texlive.combined.scheme-full + todo-txt-cli userConfig - mpv + vdirsyncer w3m wine - #steam wmctrl xautolock xbindkeys xclip - vdirsyncer xdotool xlibs.xev xlibs.xmodmap @@ -111,6 +115,8 @@ in { VK_ICD_FILENAMES = "/run/opengl-driver/share/vulkan/icd.d/radeon_icd.x86_64.json"; # radv }; + programs.steam.enable = true; + environment.systemPackages = if extra.is-minimal then (with pkgs; [ #steam #steam-run @@ -118,4 +124,6 @@ in { lastpass-cli rxvt_unicode-with-plugins ]) else mypkgs; + + programs.slock.enable = true; } diff --git a/nix-config/machines/monad/networking/default.nix b/nix-config/machines/monad/networking/default.nix @@ -29,7 +29,6 @@ let }; ports = { - synergy = 24800; lightning = 9735; lightningt = 9736; lntun = 7878; @@ -67,7 +66,7 @@ in networking.hostId = extra.machine.hostId; #networking.firewall.trustedInterfaces = ["wg0"]; - networking.firewall.allowedTCPPorts = with ports; [ lightning lightningt synergy http ]; + networking.firewall.allowedTCPPorts = with ports; [ lightning lightningt http ]; networking.firewall.allowedUDPPorts = with ports; [ dns wireguard ]; networking.nat.enable = true; diff --git a/nix-config/machines/quiver/default.nix b/nix-config/machines/quiver/default.nix @@ -21,6 +21,40 @@ extra: options thinkpad_acpi enabled=0 ''; + services.teamviewer.enable = false; + + services.synergy.server.enable = true; + services.synergy.server.screenName = "quiver"; + services.synergy.server.autoStart = true; + services.synergy.server.configFile = pkgs.writeText "barrier-cfg" '' + section: screens + monad: + quiver: + mac: + end + section: aliases + monad: + 10.100.0.1 + quiver: + 10.100.0.2 + mac: + 10.100.0.4 + end + section: links + monad: + left = quiver + quiver: + right = monad + left = mac + mac: + right = quiver + end + section: options + keystroke(alt+control+h) = switchInDirection(left) + keystroke(alt+control+l) = switchInDirection(right) + end + ''; + # telepathy is a garbage fire services.telepathy.enable = false; @@ -165,9 +199,17 @@ extra: # https://github.com/nmikhailov/Validity90 # driver not done yet services.fprintd.enable = false; - services.tor.enable = false; - services.tor.client.enable = false; + #services.pleroma.enable = true; + + services.tor.enable = true; + services.tor.client.enable = true; + services.tor.controlPort = 9051; + services.tor.client.socksListenAddress = { + addr = "172.24.0.1"; + port = 9050; + IsolateDestAddr = false; + }; services.autorandr.enable = true; services.acpid.enable = false; diff --git a/nix-config/machines/quiver/networking/default.nix b/nix-config/machines/quiver/networking/default.nix @@ -13,6 +13,21 @@ let ip46tables -A nixos-fw -i ${dev} -p tcp --dport ${toString port} -j nixos-fw-accept ''; + ports = { + synergy = 24800; + wireguard = 51820; + nncp = 5442; + }; + + firewallRules = [ + "nixos-fw -s 10.100.0.1/24 -p tcp --dport ${toString ports.synergy} -j nixos-fw-accept" + "nixos-fw -s 172.24.0.1/24 -p tcp --dport 9050 -j nixos-fw-accept" + ]; + + addRule = rule: "iptables -A ${rule}"; + rmRule = rule: "iptables -D ${rule} || true"; + extraCommands = lib.concatStringsSep "\n" (map addRule firewallRules); + extraStopCommands = lib.concatStringsSep "\n" (map rmRule firewallRules); in { networking.extraHosts = '' @@ -27,6 +42,8 @@ in # Determines the IP address and subnet of the client's end of the tunnel interface. ips = [ "10.100.0.2/28" ]; + listenPort = 51820; + # Path to the private key file. # # Note: The private key can also be included inline via the privateKey option, @@ -41,7 +58,8 @@ in #allowedIPs = [ "0.0.0.0/0" "::/0" ]; allowedIPs = [ "10.100.0.1/32" ]; #endpoint = "127.0.0.1:3333"; - endpoint = "24.84.152.187:51820"; + #endpoint = "24.84.152.187:51820"; + endpoint = "24.84.152.187:53"; persistentKeepalive = 25; } @@ -49,6 +67,7 @@ in publicKey = "BklL4dTL8WK3xnmM899Hr50/UlXaLYhJQWllj2p4ZEg="; allowedIPs = [ "10.100.0.7/32" ]; endpoint = "45.79.91.128:51820"; + persistentKeepalive = 25; } { publicKey = "vIh3IQgP92OhHaC9XBiJVDLlrs3GVcR6hlXaapjTiA0="; @@ -61,6 +80,7 @@ in { publicKey = "Dp8Df75X8Kh9gd33e+CWyyhOvT4mT0X9ToPwBUEBU1k="; # macos allowedIPs = [ "10.100.0.4/32" ]; + endpoint = "192.168.86.24:51820"; # Send keepalives every 25 seconds. Important to keep NAT tables alive. persistentKeepalive = 25; @@ -72,41 +92,9 @@ in networking.wireless.userControlled.enable = false; networking.firewall.enable = true; - networking.firewall.extraCommands = '' - ${lib.concatStringsSep "\n\n" (map openChromecast chromecastIPs)} - - # home network nginx - iptables -A nixos-fw -p tcp -s 192.168.87.0/24 -d 192.168.87.0/24 --dport 80 -j nixos-fw-accept - - # mark tor-related packets - iptables -t mangle -A OUTPUT -m cgroup --cgroup 12 -j MARK --set-mark 12 - - # all tor traffic should never try to route outside our wireguard tunnel to our tor node - iptables -t nat -A POSTROUTING -m cgroup --cgroup 12 -o wg0 -j MASQUERADE - - # create separate routing table - ${ipr} rule add fwmark 12 table 12 - - # add fallback route that blocks traffic, should the VPN go down - ${ipr} route add blackhole default metric 2 table 12 - ''; - - networking.firewall.extraStopCommands = '' - iptables -D nixos-fw -p tcp -s 192.168.87.0/24 -d 192.168.87.0/24 --dport 80 -j nixos-fw-accept || true - - # mark tor-related packets - iptables -t mangle -D OUTPUT -m cgroup --cgroup 12 -j MARK --set-mark 12 || true - - # all tor traffic should never try to route outside our wireguard tunnel to our tor node - iptables -t nat -D POSTROUTING -m cgroup --cgroup 12 -o wg0 -j MASQUERADE || true - - # create separate routing table - ${ipr} rule del fwmark 12 table 12 - - # add fallback route that blocks traffic, should the VPN go down - ${ipr} route del blackhole default metric 2 table 12 - ''; - - #networking.firewall.allowedTCPPorts = [ 8333 ]; + networking.firewall.extraCommands = extraCommands; + networking.firewall.extraStopCommands = extraStopCommands; + networking.firewall.allowedTCPPorts = with ports; [ nncp ]; + networking.firewall.allowedUDPPorts = with ports; [ wireguard ]; } diff --git a/nix-config/machines/quiver/timers/default.nix b/nix-config/machines/quiver/timers/default.nix @@ -3,4 +3,18 @@ extra: { imports = [ ]; + + systemd.user.services.myopia-reminder = { + enable = false; + description = "Myopia Reminder"; + + wantedBy = [ "graphical-session.target" ]; + after = [ "graphical-session.target" ]; + + serviceConfig.ExecStart = extra.util.writeBash "myopia-reminder" '' + ${pkgs.libnotify}/bin/notify-send -u critical "👁" + ''; + + startAt = "*:0/20"; # every 20 minutes + }; } diff --git a/nix-config/misc/imap-notifier/default.nix b/nix-config/misc/imap-notifier/default.nix @@ -70,8 +70,9 @@ with extra; { set -e export HOME=/home/jb55 export DATABASEDIR=$HOME/mail/personal - EVAR=/home/jb55/var/notify - LAST_COUNT=$EVAR/last-email-count + + EVAR=/home/jb55/var/notify + LAST_COUNT=$EVAR/last-email-count notify() { local c=$(notmuch --config /home/jb55/.notmuch-config-personal count 'tag:inbox and not tag:filed and not tag:noise') @@ -81,6 +82,7 @@ with extra; { fi echo "$c" > $LAST_COUNT if [ -f ~/var/notify/home ] && [ $c -ne $lc ]; then + echo "$c" > $EVAR/email-notify ${pkgs.libnotify}/bin/notify-send -i email-new "You Got Mail (inbox $c)" fi } diff --git a/nix-config/nixpkgs/config.nix b/nix-config/nixpkgs/config.nix @@ -17,9 +17,9 @@ in { packageOverrides = super: rec { - #qemu = super.qemu.override { - # smbdSupport = true; - #}; + qemu = super.qemu.override { + smbdSupport = true; + }; # /run/current-system/sw/bin/ls $HOME/.emacs.d/elpa | sed 's/-[[:digit:]].*//g;s/\+$/-plus/g' | sort -u #emacs = super.emacsHead; @@ -63,38 +63,12 @@ in { wine = super.wineWowPackages.staging; - #notmuch = pkgs.lib.overrideDerivation super.notmuch (attrs: { - # src = pkgs.fetchFromGitHub { - # owner = "jb55"; - # repo = "notmuch"; - # rev = "f0f99973ad9d4e932b34cc76a5d7c6629079575a"; - # sha256 = "0n89q4vlq0yhn6dqjjb7sva54cvg62hcj1yxryvs5jai5n5gl493"; - # }; - - # doCheck = false; - #}); - - # wirelesstools = - # let - # patch = super.fetchurl { - # url = "https://jb55.com/s/iwlist-print-scanning-info-allocation-failed.patch"; - # sha256 = "31c97c6abf3f0073666f9f94f233fae2fcb8990aae5e7af1030af980745a8efc"; - # }; - # in - # pkgs.lib.overrideDerivation super.wirelesstools (attrs: { - # prePatch = '' - # patch -p0 < ${patch} - # ''; - # }); - - #dmenu2 = pkgs.lib.overrideDerivation super.dmenu2 (attrs: { - # patchs = - # [ (super.fetchurl - # { url = "https://jb55.com/s/404ad3952cc5ccf3.patch"; - # sha1 = "404ad3952cc5ccf3aa0674f31a70ef0e446a8d49"; - # }) - # ]; - #}); + #phonectl = super.python3Packages.callPackage (import (super.fetchFromGitHub { + # owner = "jb55"; + # repo = "phonectl"; + # sha256 = "0wqpwg32qa1rzpw7881r6q2zklxlq1y4qgyyy742pihfh99rkcmj"; + # rev = "de0f37a20d16a32a73f9267860302357b2df0c20"; + #})) {}; #htop = pkgs.lib.overrideDerivation super.htop (attrs: { # patches = @@ -102,7 +76,6 @@ in { # { url = "https://jb55.com/s/htop-vim.patch"; # sha256 = "3d72aa07d28d7988e91e8e4bc68d66804a4faeb40b93c7a695c97f7d04a55195"; # }) - # (super.fetchurl # { url = "https://jb55.com/s/0001-Improving-Command-display-sort.patch"; # sha256 = "2207dccce7f9de0c3c6f56d846d7e547c96f63c8a4659ef46ef90c3bd9a013d1";