local h=${1##*@}
local x
ssh-keygen -R $h -f $(readlink -f ~/.ssh/known_hosts)
- if ! x=$(timeout 0.1 ssh -oBatchMode=yes -v $1 |& sed -rn "s/debug1: Connecting to $h \[([^\]*)].*/\1/p"); then
+ x=$(timeout 1 ssh -oBatchMode=yes -v $1 |& sed -rn "s/debug1: Connecting to $h \[([^\]*)].*/\1/p")
+ if [[ ! $x ]]; then
echo "khfix: ssh failed"
return 1
fi
+ echo "khfix: removing key for $x"
ssh-keygen -R $x -f $(readlink -f ~/.ssh/known_hosts)
}
khfix() { # known hosts fix
- _khfix_common "$@"
+ _khfix_common "$@" || return 1
ssh $1 :
}
khcopy() {
fastboot() { /a/opt/androidsdk/platform-tools/fastboot "$@"; }
+
+# List of apps to install/update
+# Create from existing manually installed apps by doing
+# fdroidcl search -i, then manually removing
+# automatically installed/preinstalled apps
+fdroid_pkgs=(
+ at.bitfire.davdroid
+ com.fsck.k9
+ com.ichi2.anki
+ com.notecryptpro
+ com.nutomic.syncthingandroid
+ com.termux
+ de.danoeh.antennapod
+ de.marmaro.krt.ffupdater
+ # riot
+ im.vector.alpha
+ me.ccrama.redditslide
+ net.gaast.giggity
+ net.osmand.plus
+ # caldav tasks thing
+ org.dmfs.tasks
+ org.fdroid.fdroid
+ org.quantumbadger.redreader
+ org.secuso.privacyfriendlyweather
+ org.smssecure.smssecure
+ org.fedorahosted.freeotp
+ com.ghostsq.commander
+)
+fdup() {
+ local -A installed updated
+ local p
+ fdroidcl update
+ for p in $(fdroidcl search -i| grep -o "^\S\+"); do
+ installed[$p]=true
+ done
+ for p in $(fdroidcl search -u| grep -o "^\S\+"); do
+ updated[$p]=false
+ done
+ for p in ${fdroid_pkgs[@]}; do
+ ${installed[$p]:-false} || fdroidcl install $p
+ done
+ for p in ${!installed[@]}; do
+ ${updated[$p]:-true} || fdroidcl upgrade $p
+ done
+}
+
ff() {
if type -P firefox &>/dev/null; then
firefox "$@"
make -qp | awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ {split($1,A,/ /);for(i in A)print A[i]}'
}
+mbenable() {
+ mb=$1
+ dst=/m/4e/$1
+ src=/m/md/$1
+ set -x
+ mv -T $src $dst || { set +x; return 1; }
+ ln -s -T $dst $src
+ set +x
+}
+mbdisable() {
+ mb=$1
+ dst=/m/md/$1
+ src=/m/4e/$1
+ set -x
+ if [[ -L $dst ]]; then rm $dst; fi
+ mv -T $src $dst
+ set +x
+}
+
mkc() {
mkdir "$1"
pubip() { curl -4s https://icanhazip.com; }
whatismyip() { pubip; }
+pumpa() {
+ # fixes the menu bar in xmonad. this won\'t be needed when xmonad
+ # packages catches up on some changes in future (this is written in
+ # 4/2017)
+ #
+ # geekosaur: so you'll want to upgrade to xmonad 0.13 or else use a
+ # locally modified XMonad.Hooks.ManageDocks that doesn't set the
+ # work area; turns out it's impossible to set correctly if you are
+ # not a fully EWMH compliant desktop environment
+ #
+ # geekosaur: chrome shows one failure mode, qt/kde another, other
+ # gtk apps a third, ... I came up with a setting that works for me
+ # locally but apparently doesn't work for others, so we joined the
+ # other tiling window managers in giving up on setting it at all
+ #
+ xprop -root -remove _NET_WORKAREA
+ command pumpa &r
+}
+
pwgen() {
# -m = min length
# that is a pain. Exim debug args are documented here:
# http://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_exim_command_line.html
#
-# http://www.exim.org/exim-html-current/doc/html/spec_html/ch-building_and_installing_exim.html
-# note, for exim daemon, you can turn on debug options by
+ # http://www.exim.org/exim-html-current/doc/html/spec_html/ch-building_and_installing_exim.html
+ # note, for exim daemon, you can turn on debug options by
# adding -d, etc to COMMONOPTIONS in
# /etc/default/exim4
# for testing external mail, you need the to address as final cmdline arg
source $HOME/.rvm/scripts/rvm
fi
+export GOPATH=$HOME/go
+path_add $GOPATH/bin
+
path_add --end ~/.npm-global