# automatically installed/preinstalled apps
fdroid_pkgs=(
at.bitfire.davdroid
+ com.alaskalinuxuser.justnotes
+ com.artifex.mupdfdemo
com.fsck.k9
com.ichi2.anki
+ com.jmstudios.redmoon
com.notecryptpro
com.nutomic.syncthingandroid
com.termux
+ com.zoffcc.applications.zanavi
+ cz.martykan.forecastie
de.danoeh.antennapod
de.marmaro.krt.ffupdater
im.vector.alpha # riot
+ info.papdt.blackblub
me.ccrama.redditslide
+ me.tripsit.tripmobile
net.gaast.giggity
net.osmand.plus
+ net.sourceforge.opencamera
org.dmfs.tasks # caldav tasks thing
org.fdroid.fdroid
+ org.isoron.uhabits
+ org.kde.kdeconnect_tp
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
)
+# https://forum.xda-developers.com/android/software-hacking/wip-selinux-capable-superuser-t3216394
+# for maru,
+#me.phh.superuser
+
fdup() {
local -A installed updated
local p
done
}
+firefox-default-profile() {
+ key=Default value=1 section=$1
+ file=/p/c/subdir_files/.mozilla/firefox/profiles.ini
+ sed -ri "/^ *$key/d" "$file"
+ sed -ri "/ *\[$section\]/,/^ *\[[^]]+\]/{/^\s*$key[[:space:]=]/d};/ *\[$section\]/a $key=$value" "$file"
+}
+fdhome() { #firefox default home profile
+ firefox-default-profile Profile0
+}
+
+fdwork() {
+ firefox-default-profile Profile4
+}
+
ff() {
if type -P firefox &>/dev/null; then
firefox "$@"
grep -P --binary-files=text "$@" ${HISTFILE:-~/.bash_history} | tail -n 80;
}
+ks() { # history search
+ grep -P --binary-files=text "$@" ${HISTFILE:-~/.bash_history} | uniq;
+}
+
make-targets() {
# show make targets, via http://stackoverflow.com/questions/3063507/list-goals-targets-in-gnu-make
c "$1"
}
+mkt() { # mkdir and touch file
+ local path="$1"
+ mkdir -p "$(dirname "$path")"
+ touch "$path"
+}
+
mkdir() { command mkdir -p "$@"; }
+otp() {
+ echo "oathtool --totp -b"
+ oathtool --totp -b "$@"
+}
+
pithos() {
cd /
export PYTHONPATH=/a/opt/Pithosfly
done
}
+ping8() { ping 8.8.8.8; }
+
pub() {
rld /a/h/_site/ li:/var/www/iankelling.org/html
}
# 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
+ # symlink to the config doesn't work, so I copied it to /p/c
+ # and then use cli option to specify explicit path.
+ # Only option changed from default config is to set
+ # force-from = True
+ #
+ # or else for a few feeds, the from address is set by the feed, and
+ # if I fail delivery, then I send a bounce message to that from
+ # address, which makes me be a spammer.
+
r2e add $1 "$2" $1@r2e.iankelling.org
# get up to date and don't send old entries now:
r2e run --no-send $1
fi
}
+rmstrips() {
+ ssh fencepost head -n 300 /gd/gnuorg/EventAndTravelInfo/rms-current-trips.txt
+}
+
s() {
# background
# I use a function because otherwise we can't use in a script,
shellcheck -e 2086,2046,2068,2006,2119 "$@"
}
+skaraoke() {
+ local tmp out
+ in="$1"
+ out=${2:-${1%.*}.sh}
+ tmp=$(mktemp -d)
+ script -t -c "mpv --no-config --no-resume-playback --no-terminal --no-audio-display '$1'" $tmp/typescript 2>$tmp/timing
+ # todo, the current sleep seems pretty good, but it
+ # would be nice to have an empirical measurement, or
+ # some better wait to sync up.
+ #
+ # note: --loop-file=no prevents it from hanging if you have that
+ # set to inf the mpv config.
+ # --loop=no prevents it from exit code 3 due to stdin if you
+ # had it set to inf in mpv config.
+ #
+ # args go to mpv, for example --volume=80, 50%
+ cat >$out <<EOFOUTER
+#!/bin/bash
+trap "trap - TERM && kill 0" INT TERM ERR; set -e
+( sleep .2; scriptreplay <( cat <<'EOF'
+$(cat $tmp/timing)
+EOF
+) <( cat <<'EOF'
+$(cat $tmp/typescript)
+EOF
+))&
+base64 -d - <<'EOF'| mpv --loop=no --loop-file=no --no-terminal --no-audio-display "\$@" -
+$(base64 "$1")
+EOF
+kill 0
+EOFOUTER
+ rm -r $tmp
+ chmod +x $out
+}
slog() {
# log with script. timing is $1.t and script is $1.s
scriptreplay "$1.t" "$1.s"
}
+spend() {
+ s systemctl suspend
+}
+
sr() {
# sudo redo. be aware, this command may not work right on strange distros or earlier software
if [[ $# == 0 ]]; then
fi
done
[[ ! ${args[@]} ]] || trash-put "${args[@]}"
- else
- rm -rf "$@"
- fi
+ else
+ rm -rf "$@"
+fi
}
# MSG_ID is in /var/log/exim4/mainlog, looks like 1ccdnD-0001nh-EN
}
-# use -eW to actually modify mailbox
+# to test sieve, use below command. make modifications, then copy to live file, use -eW to actually modify mailbox
+# cp /p/c/subdir_files/sieve/personal{test,}.sieve; testsievelist -eW INBOX
+#
+# Another option is to use sieve-test SCRIPT MAIL_FILE. note,
+# sieve-test doesn't know about envelopes, I'm not sure if sieve-filter does.
+
+# sieve with output filter. arg is mailbox, like INBOX.
+# This depends on dovecot conf, notably mail_location in /etc/dovecot/conf.d/10-mail.conf
+#
testsievelist() {
- sieve-filter ~/sieve/main.sieve "$@" >/a/tmp/slog 2> >(tail) && sed -rn '/^Performed actions:/{n;n;p}' /a/tmp/slog | sort -u
+ sieve-filter ~/sieve/maintest.sieve "$@" >/tmp/testsieve.log 2> >(tail) && sed -rn '/^Performed actions:/{n;n;p}' /tmp/testsieve.log | sort -u
}
+# plain sieve
testsieve() {
sieve-filter ~/sieve/main.sieve "$@"
}
}
tx() { # toggle set -x, and the prompt so it doesn't spam
- if [[ $- == *x* ]]; then
- set +x
- PROMPT_COMMAND=prompt_command
- else
- unset PROMPT_COMMAND
- PS1="\w \$ "
- set -x
- fi
+ if [[ $- == *x* ]]; then
+ set +x
+ PROMPT_COMMAND=prompt_command
+ else
+ unset PROMPT_COMMAND
+ PS1="\w \$ "
+ set -x
+ fi
}
psnetns() {
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
+ vpncmd gksudo -u ian "firefox -no-remote -P firefox-main-profile" &r
}
vpnbash() {
vpncmd bash
vm-set-listen $1 127.0.0.1
}
+
vpn() {
- s systemctl start openvpn@client&
- journalctl --unit=openvpn@client -f -n0
+ [[ $1 ]] || { echo need arg; return 1; }
+ journalctl --unit=openvpn-client@$1 -f -n0 &
+ s systemctl start openvpn-client@$1
}
-
vpnoff() {
- s systemctl stop openvpn@client
+ [[ $1 ]] || { echo need arg; return 1; }
+ s systemctl stop openvpn-client@$1
}
}
-whatismyip() { curl ipecho.net/plain ; echo; }
+wtr() { curl wttr.in/boston; }
+xl() {
+ # this succeeds even if gnome-screensaver isn't running.
+ gnome-screensaver-command --exit &>/dev/null
+ if ! pidof xscreensaver; then
+ xscreensaver &
+ # 1 was not long enough
+ sleep 3
+ fi
+ xscreensaver-command -lock
+}
#############################
######### misc stuff ########
#############################
+# from curl cheat.sh/:bash_completion
+_cheatsh_complete_curl()
+{
+ local cur prev opts
+ _get_comp_words_by_ref -n : cur
+
+ COMPREPLY=()
+ #cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ opts="$(curl -s cheat.sh/:list | sed s@^@cheat.sh/@)"
+
+ if [[ ${cur} == cheat.sh/* ]] ; then
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ __ltrim_colon_completions "$cur"
+ return 0
+ fi
+}
+complete -F _cheatsh_complete_curl curl
+
+
if [[ $- == *i* ]]; then
# commands to run when bash exits normally
trap "hl" EXIT