From: Ian Kelling Date: Sun, 5 Feb 2017 04:04:34 +0000 (-0800) Subject: more convenience functions X-Git-Url: https://iankelling.org/git/?p=distro-setup;a=commitdiff_plain;h=0d9502eeb15ab906d50c0bc9260b3d257a168fd2 more convenience functions --- diff --git a/brc b/brc index a71a7c7..67a113f 100644 --- a/brc +++ b/brc @@ -736,7 +736,8 @@ idea() { ifn() { # insensitive find find -L . -not \( -name .svn -prune -o -name .git -prune \ - -o -name .hg -prune \) -iname "*$**" 2>/dev/null + -o -name .hg -prune -o -name .editor-backups -prune \ + -o -name .undo-tree-history -prune \) -iname "*$**" 2>/dev/null } @@ -812,7 +813,7 @@ lower() { # make first letter of filenames lowercase. k() { # history search - grep -P --binary-files=text "$@" ${HISTFILE:-~/.bash_history} | tail -n 40; + grep -P --binary-files=text "$@" ${HISTFILE:-~/.bash_history} | tail -n 80; } @@ -909,6 +910,13 @@ pwgen() { apg -m 12 -x 16 -t } +pwlong() { + # -M CLN = use Caps, Lowercase, Numbers + # -n 1 = 1 password + # -a 1 = use random instead of pronounceable algorithm + apg -m 50 -x 70 -n 1 -a 1 -M CLN +} + q() { # start / launch a program in the backround and redir output to null "$@" &> /dev/null & @@ -1205,11 +1213,15 @@ psnetns() { m() { printf "%s\n" "$*"; "$@"; } + +vpncmd() { + m s nsenter -t $(pgrep -f "/usr/sbin/openvpn --suppress-timestamps --nobind --config /etc/openvpn/client/client.conf") -n -m "$@" +} +vpnf() { + vpncmd gksudo -u ian firefox &r +} vpnbash() { - m s nsenter -t $(pgrep openvpn) -n -m bash - # note, if we wanted to run a graphical program, - # instead of bash, we could use - # gksudo -u ${SUDO_USER:-$USER} "$@" + vpncmd bash }