dotfiles

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.margiolis.net/dotfiles.git
Log | Files | Refs | README | LICENSE

commit 3618a9c7a8345e30bb250a35b26ba65e305f628c
parent 6d49fe2bd6a66726138b414d6e33363b4ab00885
Author: Christos Margiolis <christos@margiolis.net>
Date:   Wed,  5 Jan 2022 00:13:55 +0200

new scripts mostly

Diffstat:
Ampv/.config/mpv/mpv.conf | 1+
Mnvim/.config/nvim/init.vim | 4++++
Mscripts/.local/bin/ausplit | 10+++++-----
Ascripts/.local/bin/autocomp | 4++++
Dscripts/.local/bin/bmr | 9---------
Dscripts/.local/bin/dash2undscr | 5-----
Ascripts/.local/bin/doccomp | 27+++++++++++++++++++++++++++
Ascripts/.local/bin/docprev | 14++++++++++++++
Dscripts/.local/bin/mdpdf | 3---
Ascripts/.local/bin/namefmt | 6++++++
Ascripts/.local/bin/passget | 4++++
Ascripts/.local/bin/rssread | 4++++
Dscripts/.local/bin/texpdf | 18------------------
Ascripts/.local/bin/vmstart | 46++++++++++++++++++++++++++++++++++++++++++++++
Ascripts/.local/bin/vmstop | 24++++++++++++++++++++++++
Msh/.profile | 9++++++---
16 files changed, 145 insertions(+), 43 deletions(-)

diff --git a/mpv/.config/mpv/mpv.conf b/mpv/.config/mpv/mpv.conf @@ -0,0 +1 @@ +script-opts=ytdl_hook-ytdl_path=/usr/local/bin/yt-dlp diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim @@ -1,5 +1,6 @@ syntax on set number! +set mouse=a set tabstop=8 shiftwidth=8 noexpandtab set softtabstop=8 set noautoindent @@ -15,6 +16,9 @@ vmap ++ <plug>NERDCommenterToggle nmap ++ <plug>NERDCommenterToggle noremap <Space><Space> <Esc>/<++><CR><Esc>ca> +map <leader>c :w! \| !doccomp %<CR> +map <leader>p :!docprev %<CR><CR> + "HTML autocmd FileType html noremap ;h1 i<h1></h1><Enter><Enter><++><Esc>2ka autocmd FileType html noremap ;h2 i<h2></h2><Enter><Enter><++><Esc>2ka diff --git a/scripts/.local/bin/ausplit b/scripts/.local/bin/ausplit @@ -6,16 +6,16 @@ main() test ${#} -ne 2 && usage auin="${1}" - tfile="${2}" + local tfile="${2}" total="$(wc -l < "${tfile}")" # The extension must exist in `tag`. ext="${1#*.}" - xread "Album/book title: " altitle + xread "Album/book title: " album xread "Artist/author: " author xread "Publication year: " year - namefmt="$(fmt_name "${altitle}")" + namefmt="$(fmt_name "${album}")" mkdir -p "${namefmt}" || exit 1 while read -r line; do @@ -25,7 +25,7 @@ main() titlefmt="$(fmt_name "${title}")" track="$((track+1))" start="${end}" - done < "${2}" + done < "${tfile}" # The last track must be done outside the loop. split_file @@ -63,7 +63,7 @@ split_file() echo "Tagging \"${title}\"..." && tag \ -a "${author}" \ - -A "${altitle}" \ + -A "${album}" \ -t "${title}" \ -n "${track}" \ -N "${total}" \ diff --git a/scripts/.local/bin/autocomp b/scripts/.local/bin/autocomp @@ -0,0 +1,4 @@ +#!/bin/sh + +pkill -f "entr -n doccomp" +echo "${1}" | entr -n doccomp "${1}" diff --git a/scripts/.local/bin/bmr b/scripts/.local/bin/bmr @@ -1,9 +0,0 @@ -#!/bin/sh - -# TODO: edit, delete, add -foo="${HOME}/shit/bmr" -while [ -d ${foo} ]; do - cd ${foo} - foo=$(ls | dmenu -l 30) -done -cat ${foo} | expand -t8 | dmenu -l 30 | awk '{print $NF}' | xargs ${BROWSER} diff --git a/scripts/.local/bin/dash2undscr b/scripts/.local/bin/dash2undscr @@ -1,5 +0,0 @@ -#!/bin/sh - -for file in $(find .); do - mv ${file} $(echo ${file} | tr '-' '_') -done diff --git a/scripts/.local/bin/doccomp b/scripts/.local/bin/doccomp @@ -0,0 +1,27 @@ +#!/bin/sh + +usage() +{ + echo "usage: ${0##*/} file" 1>&2 && exit 1 +} + +file_exists() +{ + test ! -f "${file}" && echo "${0##*/}: ${file}: file not found" 1>&2 && exit 1 +} + +test ${#} -eq 0 && usage + +file="$(readlink -f "${1}")" +dir="${file%/*}" +base="${file%.*}" +ext="${file##*.}" + +file_exists +cd "${dir}" || exit 1 + +case "${ext}" in + md) pandoc ${file} --pdf-engine=xelatex -V mainfont=Arial -o "${base}.pdf" ;; + # TODO: handle biber + tex) pdflatex ${file} && rm -f *.aux *.log *.out ;; +esac diff --git a/scripts/.local/bin/docprev b/scripts/.local/bin/docprev @@ -0,0 +1,14 @@ +#!/bin/sh + +usage() +{ + echo "usage: ${0##*/} file" 1>&2 && exit 1 +} + +test ${#} -eq 0 && usage +base="${1%.*}" + +case "${1}" in + *.html) setsid -f "${BROWSER}" "${base}.html" ;; + *.tex) setsid -f xdg-open "${base}.pdf" ;; +esac diff --git a/scripts/.local/bin/mdpdf b/scripts/.local/bin/mdpdf @@ -1,3 +0,0 @@ -#!/bin/sh - -pandoc $1.md --pdf-engine=xelatex -V mainfont=Arial -o $1.pdf diff --git a/scripts/.local/bin/namefmt b/scripts/.local/bin/namefmt @@ -0,0 +1,6 @@ +#!/bin/sh + +# FIXME: give path/s from command line +for file in $(find .); do + mv ${file} $(echo ${file} | tr '-' '_') +done diff --git a/scripts/.local/bin/passget b/scripts/.local/bin/passget @@ -0,0 +1,4 @@ +#!/bin/sh + +pass "$(pass | sed 1d | awk '{print $2}' | dmenu -l 30)" | +xargs echo -n | xclip -sel clip diff --git a/scripts/.local/bin/rssread b/scripts/.local/bin/rssread @@ -0,0 +1,4 @@ +#!/bin/sh + +sfeed_update +sfeed_curses ${HOME}/.sfeed/feeds/* diff --git a/scripts/.local/bin/texpdf b/scripts/.local/bin/texpdf @@ -1,18 +0,0 @@ -#!/bin/sh - -usage() { - echo "usage: ${0##*/} [-b] file" 1>&2 && exit 1 -} - -file_exists() { - test ! -f "${1}.tex" && echo "${1}.tex: file not found" && exit 1 -} - -test ${#} -eq 0 && usage -if [ ${1} = "-b" ]; then - file_exists "${2}" - pdflatex ${2}.tex && biber ${2} && pdflatex ${2}.tex -o ${2}.pdf -else - file_exists "${1}" - pdflatex ${1}.tex -fi diff --git a/scripts/.local/bin/vmstart b/scripts/.local/bin/vmstart @@ -0,0 +1,46 @@ +#!/bin/sh + +usage() +{ + echo "usage: ${0##*/} [-u] [-c cpu] [-C com] [-d disk] [-i img] [-m mem] [-t tap] name" 1>&2 + exit 1 +} + +cpu="2" +mem="2G" +disk="disk.img" +tap="tap0" + +# TODO: opt: disname, lpc, xhci +while getopts c:C:d:i:m:t:u arg; do +case "${arg}" in + c) cpu="${OPTARG}" ;; + C) com="${OPTARG}" ;; + d) disksiz="${OPTARG}" ;; + i) img="${OPTARG}" ;; + m) mem="${OPTARG}" ;; + t) tap="${OPTARG}" ;; + u) uefi="-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd" ;; + *) usage ;; +esac +done +shift $((OPTIND - 1)) + +name="${1}" +test -z "${name}" && usage + +test -n "${disksiz}" && truncate -s "${disksiz}" ${disk} +ifconfig "${tap}" up + +bhyve -c ${cpu} -m ${mem} -wH \ + -s 0,hostbridge \ + `test -n "${img}" && echo "-s 3,ahci-cd,${img}"` \ + -s 4,ahci-hd,${disk} \ + -s 5,virtio-net,${tap} \ + -s 29,fbuf,tcp=0.0.0.0:5900,w=800,h=600,wait \ + -s 30,xhci,tablet \ + -s 31,lpc \ + `test -n "${com}" && echo "-l com1,${com}"` \ + `test -n "${uefi}" && echo ${uefi}` \ + ${name} + diff --git a/scripts/.local/bin/vmstop b/scripts/.local/bin/vmstop @@ -0,0 +1,24 @@ +#!/bin/sh + +usage() +{ + echo "usage: ${0##*/} [-t tap] name" 1>&2 + exit 1 +} + +tap="tap0" + +while getopts t: arg; do +case "${arg}" in + t) tap="${OPTARG}" ;; + *) usage ;; +esac +done +shift $((OPTIND - 1)) + +name="${1}" +test -z "${name}" && usage + +ifconfig ${tap} down +bhyvectl --force-poweroff --vm=${name} +bhyvectl --destroy --vm=${name} diff --git a/sh/.profile b/sh/.profile @@ -9,7 +9,7 @@ # if wanted. # PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:$HOME/bin; export PATH # BLOCKSIZE=K; export BLOCKSIZE -export PATH="$PATH:$(du "$HOME/.local/bin/" | cut -f2 | tr '\n' ':' | sed 's/:*$//')" +export PATH="${PATH}:$(du "${HOME}/.local/bin/" | cut -f2 | tr '\n' ':' | sed 's/:*$//')" # Setting TERM is normally done through /etc/ttys. Do only override # if you're sure that you'll never log in via telnet or xterm or a @@ -20,12 +20,15 @@ export TERMINAL="st" export BROWSER="firefox" export READER="zathura" export FILE="sfm" -export PAGER="less" +export PAGER="less -R" +export SFEED_YANKER="xargs echo -n | xclip -sel clip" +export SFEED_URL_FILE="${HOME}/.sfeed/urls" +[ -f "${SFEED_URL_FILE}" ] || touch "${SFEED_URL_FILE}" export FZF_DEFAULT_OPTS="--layout=reverse --height 40%" # set ENV to a file invoked each time sh is started for interactive use. -export ENV="$HOME/.shrc" +export ENV="${HOME}/.shrc" # Query terminal size; useful for serial lines. if [ -x /usr/bin/resizewin ] ; then /usr/bin/resizewin -z ; fi