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() {
date "+%A, %B %d, %r" "$@"
}
-dus() {
+dus() { # du, sorted, default arg of
du -sh ${@:-*} | sort -h
}
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
+ im.vector.alpha # riot
+ me.ccrama.redditslide
+ net.gaast.giggity
+ net.osmand.plus
+ org.dmfs.tasks # caldav tasks thing
+ org.fdroid.fdroid
+ org.quantumbadger.redreader
+ org.secuso.privacyfriendlyweather
+ org.smssecure.smssecure
+ org.fedorahosted.freeotp
+ com.ghostsq.commander
+ me.tripsit.tripmobile
+ # https://forum.xda-developers.com/android/software-hacking/wip-selinux-capable-superuser-t3216394
+ me.phh.superuser
+)
+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"
done
}
-postconfin() {
- local MAPFILE
- mapfile -t
- local s
- [[ $EUID == 0 ]] || s=s
- $s postconf -ev "${MAPFILE[@]}"
-}
-
pub() {
rld /a/h/_site/ li:/var/www/iankelling.org/html
}
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
s rsync -rlpchviog --relative "${opts[@]}" "$path" "root@$host:/";
}
+r2eadd() { # usage: name url
+ # initial setup of rss2email:
+ # r2e new r2e@iankelling.org
+ # that initializes files, and sets default email.
+ # Would have been simpler to just leave it off since i\'m not
+ # using the default email. Symlinks won\'t work, so we use binds.
+ # mkdir /p/c/binds/.config/
+ # mv ~/.config/rss2email.cfg /p/c/binds/.config/
+ # mkdir /p/c/binds/.local/share/
+ # mv ~/.local/share/rss2email.json /p/c/binds/.local/share/
+ # conflink
+ r2e add $1 "$2" $1@r2e.iankelling.org
+ # get up to date and don't send old entries now:
+ r2e run --no-send $1
+}
+r2e() { command r2e -d /p/c/rss2email.json -c /p/c/rss2email.cfg "$@"; }
rspicy() { # usage: HOST DOMAIN
# connect to spice vm remote host. use vspicy for local host
# 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
# based on warning from rvmsudo
export rvmsudo_secure_path=1
-# for other script I wrote
-#export ACME_TINY_PATH=/a/opt/acme-tiny
-export ACME_TINY_WRAPPER_CERT_DIR=/p/c/machine_specific/$HOSTNAME/webservercerts
-
if [[ -s "/usr/local/rvm/scripts/rvm" ]]; then
source "/usr/local/rvm/scripts/rvm"
elif [[ -s $HOME/.rvm/scripts/rvm ]]; then
source $HOME/.rvm/scripts/rvm
fi
+export GOPATH=$HOME/go
+path_add $GOPATH/bin
+
path_add --end ~/.npm-global