dotfiles

configuration files
git clone https://pi.duncano.de/git/dotfiles.git
Log | Files | Refs | README

commit 41d30a34cb1c97fff431f532b03c32f234fe1ef6
parent da5210ac94f7b0176ee968d4f95c68aa7e26b26d
Author: Duncaen <mail@duncano.de>
Date:   Sat,  9 Jul 2016 21:35:07 +0200

mksrc: update some stuff

Diffstat:
mkshrc.d/00-git.sh | 25++++++++++++++-----------
mkshrc.d/00-infinality.sh | 19-------------------
mkshrc.d/00-misc.sh | 48++++++++++++++++++++++++++++++++++++++++++++++++
mkshrc.d/00-nmap.sh | 3+++
mkshrc.d/00-xbps.sh | 8++++++--
mkshrc.d/01-fzy.sh | 28++++++++++++++++++++++++++++
6 files changed, 99 insertions(+), 32 deletions(-)

diff --git a/mkshrc.d/00-git.sh b/mkshrc.d/00-git.sh @@ -1,11 +1,14 @@ -if [ -x /usr/bin/git ]; then - alias ga='git add' - alias gc='git commit' - alias gca='git commit --amend' - alias gp='git pull' - alias gpr='git pull --rebase' - alias gs='git status -sb' - alias gb='git branch' - alias gd='git diff' - alias gl='git l' -fi +[ -x /usr/bin/git ] || return +alias ga='git add' +alias gc='git commit' +alias gca='git commit --amend' +alias gp='git pull' +alias gpr='git pull --rebase' +alias gs='git status -sb' +alias gb='git branch' +alias gd='git diff' +alias gl='git l' + +fzgl() { + git show $(git log --pretty=oneline -n 20 --abbrev-commit | fzy | awk '{print $1}') +} diff --git a/mkshrc.d/00-infinality.sh b/mkshrc.d/00-infinality.sh @@ -1,19 +0,0 @@ -if [ -n "$DISPLAY" ]; then - export INFINALITY_FT_FILTER_PARAMS='10 35 40 35 10' - export INFINALITY_FT_AUTOHINT_HORIZONTAL_STEM_DARKEN_STRENGTH=0 - export INFINALITY_FT_AUTOHINT_VERTICAL_STEM_DARKEN_STRENGTH=0 - export INFINALITY_FT_AUTOHINT_INCREASE_GLYPH_HEIGHTS=false - export INFINALITY_FT_AUTOHINT_SNAP_STEM_HEIGHT=0 - export INFINALITY_FT_GAMMA_CORRECTION='0 100' - export INFINALITY_FT_BRIGHTNESS=0 - export INFINALITY_FT_CONTRAST=0 - export INFINALITY_FT_CHROMEOS_STYLE_SHARPENING_STRENGTH=5 - export INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH=0 - export INFINALITY_FT_FRINGE_FILTER_STRENGTH=5 - export INFINALITY_FT_GRAYSCALE_FILTER_STRENGTH=10 - export INFINALITY_FT_STEM_ALIGNMENT_STRENGTH=0 - export INFINALITY_FT_STEM_FITTING_STRENGTH=0 - export INFINALITY_FT_STEM_SNAPPING_SLIDING_SCALE=0 - export INFINALITY_FT_USE_KNOWN_SETTINGS_ON_SELECTED_FONTS=true - export INFINALITY_FT_USE_VARIOUS_TWEAKS=true -fi diff --git a/mkshrc.d/00-misc.sh b/mkshrc.d/00-misc.sh @@ -1,5 +1,53 @@ alias wanip='curl ipinfo.io/ip' psgrep() { ps up $(pgrep -f $@) 2>&-; } + psofgrep() { lsof -p $(pgrep -f $@ | tr '\012' ,); } lsofgrep() { lsof $@; } + +function urlencode { + typeset decoded=$1 encoded= rest= c= + typeset rest2= bug='rest2=${rest}' + + if [[ -z ${BASH_VERSION} ]]; then + # bug /usr/bin/sh HP-UX 11.00 + typeset _decoded='xyz%26xyz' + rest="${_decoded#?}" + c="${_decoded%%${rest}}" + if (( ${#c} != 1 )); then + typeset qm='????????????????????????????????????????????????????????????????????????' + typeset bug='(( ${#rest} > 0 )) && typeset -L${#rest} rest2="${qm}" || rest2=${rest}' + fi + fi + + rest="${decoded#?}" + eval ${bug} + c="${decoded%%${rest2}}" + decoded="${rest}" + + while [[ -n ${c} ]]; do + case ${c} in + [-a-zA-z0-9.]) + ;; + ' ') + c='+' + ;; + *) + c=$(printf "%%%02X" "'$c") + ;; + esac + + encoded="${encoded}${c}" + + rest="${decoded#?}" + eval ${bug} + c="${decoded%%${rest2}}" + decoded="${rest}" + done + + if [[ -n ${BASH_VERSION:-} ]]; then + \echo -E "${encoded}" + else + print -r -- "${encoded}" + fi +} diff --git a/mkshrc.d/00-nmap.sh b/mkshrc.d/00-nmap.sh @@ -0,0 +1,3 @@ +if [ -x /usr/bin/nmap ]; then + alias portscan='nmap -Pn' +fi diff --git a/mkshrc.d/00-xbps.sh b/mkshrc.d/00-xbps.sh @@ -1,5 +1,9 @@ if [ -x /usr/bin/xbps-install ]; then - alias xi='doas -- xbps-install' - alias xr='doas -- xbps-remove' + alias xi='doas xbps-install' + alias xr='doas xbps-remove' + alias xlock='doas xbps-pkgdb -m repolock' + alias xunlock='doas xbps-pkgdb -m repounlock' + alias xhold='doas xbps-pkgdb -m hold' + alias xunhold='doas xbps-pkgdb -m unhold' alias xq='xbps-query' fi diff --git a/mkshrc.d/01-fzy.sh b/mkshrc.d/01-fzy.sh @@ -0,0 +1,28 @@ +[ $(command -v fzy) ] || return + +function fzpsgrep { + psgrep "$@" | \ + while read -r l; do + printf '%s\n' "$l" >2 + fzy | awk '{print $2}' + break + done +} + +function fzxq { + echo ${fzy_opts:-"--prompt='xbps-query $@ > '"} + xq "$@" | fzy ${fzy_opts:-"--prompt='xbps-query $@ > '"} | awk '{print $2}' +} + +function fzxi { + local opt q + for opt; do + case $opt in + -*) break; ;; + *) q+=" $opt"; shift 1 ;; + esac + done + q=$(fzxq -Rs "$q") + [ -n "$q" ] || return $? + xi "$@" "$q" +}