source /a/bin/distro-functions/src/identify-distros
source /a/bin/distro-functions/src/package-manager-abstractions
source /a/bin/log-quiet/logq-function
-source /a/bin/small-misc-bash/psg-function
# for x in /a/bin/bash_unpublished/source-!(.#*); do echo source $x; done
source /a/bin/bash_unpublished/source-semi-priv
source /a/bin/bash_unpublished/source-state
fi
# run latest
install-my-scripts
- btrbk-run "$@" | pee cat "systemd-cat -t btrbk-run"
- $active && ser enable btrbk.timer
+ btrbk-run "$@" |& pee cat "systemd-cat -t btrbk-run"
+ if $active; then
+ ser enable btrbk.timer
+ fi
}
bfg() { java -jar /a/opt/bfg-1.12.14.jar "$@"; }
c /
# run latest
install-my-scripts
- switch-mail-host $1 $HOSTNAME | pee cat "systemd-cat -t switch-mail-host"
+ switch-mail-host pull $1 |& pee cat "systemd-cat -t switch-mail-host"
}
bpush() {
[[ $1 ]] || return 1
c /
# run latest
install-my-scripts
- switch-mail-host $HOSTNAME $1 | pee cat "systemd-cat -t switch-mail-host"
+ switch-mail-host push $1 |& pee cat "systemd-cat -t switch-mail-host"
}
lipush() {
# note, i had --delete-excluded, but that deletes all files in --exclude-from on
p=(/a/bin /a/exe /a/h /a/c /p/c/machine_specific/linode{,.hosts} /a/opt/{emacs,emacs-debianstable,mu})
a="-ahviSAXPH --specials --devices --delete --relative --exclude-from=/p/c/li-rsync-excludes"
ret=0
- m rsync $@ $a ${p[@]} /p/c/machine_specific/l2 root@l2.b8.nz:/ || ret=$?
- m rsync $@ $a ${p[@]} /p/c/machine_specific/li root@li.b8.nz:/ || ret=$?
- m rsync $@ -ahviSAXPH root@iankelling.org:/a/h/proposed-comments/ /a/h/proposed-comments || ret=$?
+ m rsync "$@" $a ${p[@]} /p/c/machine_specific/l2 root@l2.b8.nz:/ || ret=$?
+ m rsync "$@" $a ${p[@]} /p/c/machine_specific/li root@li.b8.nz:/ || ret=$?
+ m rsync "$@" -ahviSAXPH root@iankelling.org:/a/h/proposed-comments/ /a/h/proposed-comments || ret=$?
return $ret
}
lipushnoe() { # noe = noemacs. for running faster.
- rsync $@ --delete-excluded -ahviSAXPH --specials --devices --delete --relative \
+ rsync "$@" --delete-excluded -ahviSAXPH --specials --devices --delete --relative \
--exclude-from=/p/c/li-rsync-excludes /a/bin /a/exe /a/h /a/c /p/c/machine_specific/li root@li:/
}
# do all tee.
# pipe to this, or just type like a shell
+# todo: test this
dat() {
- tee >(ssh frodo.b8.nz bash -l) >(ssh x2 bash -l) >(ssh tp.b8.nz bash -l) >(ssh kw bash -l) >(ssh tp.b8.nz bash -l)
+ tee >(ssh frodo.b8.nz) >(ssh x2) >(ssh tp.b8.nz) >(ssh kw) >(ssh tp.b8.nz)
}
da() { # do all
local host
dup() {
local ran_d
ran_d=false
+ system-status _
case $PS1 in
*DISTRO-BEGIN!*|*DISTRO!*)
+ pushd /
/b/ds/distro-begin || return $?
+ popd
ran_d=true
;;&
*DISTRO-END!*|*DISTRO!*)
+ pushd
/b/ds/distro-end || return $?
+ popd
ran_d=true
;;&
*CONFLINK*)
firefox -P default "$@" >/dev/null 2>&1
}
-
gitian() {
git config user.email ian@iankelling.org
}
-
# at least in flidas, things rely on gpg being gpg1
gpg() {
command gpg2 "$@"
--suppress-cc=self "$@"
}
-
hstatus() {
# do git status on published repos.
c /a/bin/githtml
done
}
-
idea() {
/a/opt/idea-IC-163.7743.44/bin/idea.sh "$@" &r
}
+ilog() {
+ chan=${1:-#fsfsys}
+ # use * instead of -r since that does sorted order
+ ssh root@iankelling.org "cd /var/lib/znc/moddata/log/iank/freenode/$chan && hr && for x in *; do echo \$x; cat \$x; hr; done" | less +G
+}
+
o() {
if type gvfs-open &> /dev/null ; then
gvfs-open "$@"
journalctl -n 10000 -f "$@" | jfilter
}
jr() { journalctl "$@" | jfilter | less ; }
-jrf() { journalctl -f "$@" | jfilter; }
+jrf() { journalctl -n 200 -f "$@" | jfilter; }
kff() { # keyboardio firmware flash
firefox /tmp/mdtest.html
}
-
-
mo() { xset dpms force off; } # monitor off
+myirc() {
+ chan=${1:-fsf-office}
+ # use * instead of -r since that does sorted order
+ ssh root@iankelling.org "cd /var/lib/znc/moddata/log/iank/freenode/#$chan; grep '\<iank.*' *"
+}
+
net-dev-info() {
e "lspci -nnk|gr -iA2 net"
lspci -nnk|gr -iA2 net
e "s lshw -C network"
hr
s lshw -C network
-
}
nk() {
resolvcat() {
local f
+ m s nscd -i hosts
f=/etc/resolv.conf
echo $f:; ccat $f
- hr; echo dnsmasq is $(systemctl is-active dnsmasq)
+ hr; m ser status dnsmasq | cat
+ hr; s ss -lpn 'sport = 53'
+ #hr; echo dnsmasq is $(systemctl is-active dnsmasq)
f=/var/run/dnsmasq/resolv.conf
hr; echo $f:; ccat $f
+ hr; m grr '^ *servers-file *=' /etc/dnsmasq.conf /etc/dnsmasq.d
f=/etc/dnsmasq-servers.conf
hr; echo $f:; ccat $f
}
+rcat() {
+ resolvcat | less
+}
# only run on MAIL_HOST. simpler to keep this on one system.
r2eadd() { # usage: name url
scss-lint -c /a/opt/thoughtbot-guides/style/sass/.scss-lint.yml "$@"
}
+skbrc() {
+ sk -e 2120,245 /b/ds/brc /b/ds/brc2
+}
+
skaraoke() {
local tmp out
out=${2:-${1%.*}.sh}
# By default .bashrc is sourced for ALL ssh commands. This is wonky.
# Normally, this file is not sourced when a script is run, but we can
-# override that by having #!/bin/bash -l. I want the same thing for ssh
+# override that by sourcing ~/.bashrc. I want the same thing for ssh
# commands. when a local script runs an ssh command, bashrc should not be
# sourced, unless we use a modified command.
#
-[1246AaCfGgKkMNnqsTtVvXxYy])
args+=("$1"); shift
;;
- -[bcDEeFIiLlmOopQRSWw])
+ -[bcDEeFIiLlmOopQRSWw]*)
# -oOption etc is valid
if (( ${#1} >= 3 )); then
args+=("$1"); shift
type=${tmp2: -1}
if [[ $type == b ]]; then
info_sec=${tmp::10}
- if (( $(stat -c%Y /b/ds/brc) > info_sec || $(stat -c%Y /b/ds/.bashrc) > info_sec )); then
- dorsync=true
- rm -f $sshinfo
- fi
+ for f in /b/ds/sl/.iank/*; do
+ if (( $(stat -L -c%Y $f) > info_sec )); then
+ dorsync=true
+ rm -f $sshinfo
+ break
+ fi
+ done
fi
else
dorsync=true
# use this weird yes thing to ensure we know ssh succeeded
- tmp=$(command ssh "${args[@]}" "$remote" "if test -e /a/bin/ds/.bashrc -a -L .bashrc; then echo yes; fi") || return
+ if ! tmp=$(command ssh "${args[@]}" "$remote" "if test -e /a/bin/ds/.bashrc -a -L .bashrc; then echo yes; fi"); then
+ echo failed sl test. doing plain ssh -v
+ command ssh -v "${args[@]}" "$remote"
+ fi
if [[ $tmp == yes ]]; then
type=a
else
type=b
fi
fi
+ if [[ $type == b ]] && $dorsync; then
+ if ! RSYNC_RSH="ssh ${args[*]}" rsync -rptL /b/ds/sl/.iank "$remote":; then
+ echo WARNING: rsync failed. remove $sshinfo to try again
+ fi
+ fi
if $dorsync || ! $haveinfo; then
sshinfo=/p/sshinfo/$now$type"$remote"
touch $sshinfo
if [[ -t 0 ]]; then
BRC=t command ssh "${args[@]}" "$remote" ${@@Q}
else
- command ssh "${args[@]}" "$remote" BRC=t bash -l
+ command ssh "${args[@]}" "$remote" BRC=t bash
fi
fi
}
fi
s systemctl stop $vpn_service@$1
}
-
-
+vpnoffc() { # vpn off client
+ ser stop openvpn-nn@client
+}
+vpnc() {
+ ser start openvpn-nn@client
+}
vspicy() { # usage: VIRSH_DOMAIN