aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncaen <mail@duncano.de>2016-07-09 21:35:07 +0200
committerDuncaen <mail@duncano.de>2016-07-09 21:35:07 +0200
commit41d30a34cb1c97fff431f532b03c32f234fe1ef6 (patch)
tree6e917084e2219cf69360874141a1ef8d3bed65cf
parentda5210ac94f7b0176ee968d4f95c68aa7e26b26d (diff)
downloaddotfiles-41d30a34cb1c97fff431f532b03c32f234fe1ef6.tar.gz
mksrc: update some stuff
-rwxr-xr-xmkshrc.d/00-git.sh25
-rwxr-xr-xmkshrc.d/00-infinality.sh19
-rwxr-xr-xmkshrc.d/00-misc.sh48
-rw-r--r--mkshrc.d/00-nmap.sh3
-rwxr-xr-xmkshrc.d/00-xbps.sh8
-rwxr-xr-xmkshrc.d/01-fzy.sh28
6 files changed, 99 insertions, 32 deletions
diff --git a/mkshrc.d/00-git.sh b/mkshrc.d/00-git.sh
index 22cbb28..34c64b9 100755
--- 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
deleted file mode 100755
index d56e60e..0000000
--- a/mkshrc.d/00-infinality.sh
+++ /dev/null
@@ -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
index ee4c5f2..9227b31 100755
--- 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
new file mode 100644
index 0000000..5e266bb
--- /dev/null
+++ 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
index 3f0b1c2..c80276f 100755
--- 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
new file mode 100755
index 0000000..d773ba1
--- /dev/null
+++ 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"
+}