}
# a1 = awk {print $1}
-for field in {1..20}; do
- eval a$field"() { awk '{print \$$field}'; }"
+for _field in {1..20}; do
+ eval a$_field"() { awk '{print \$$_field}'; }"
done
+unset _field
# h1 = head -n1
-for num in {1..9}; do
- eval h$num"() { head -n$num || [[ \$? == 141 ]]; }"
+for _num in {1..9}; do
+ eval h$_num"() { head -n$_num || [[ \$? == 141 ]]; }"
done
+unset _num
hexipv4() {
# so I've thrown a bunch of things at the wall to speed it up.
prompt-command() {
local return=$? # this MUST COME FIRST
+ local jobs_char
PS1='\w'
if [[ $SSH_CLIENT ]]; then
if [[ $MAIL_HOST && $MAIL_HOST != "$HOSTNAME" ]]; then
ps_char="@ $ps_char"
fi
- jobs_char=
if [[ $(jobs -p) ]]; then
jobs_char='j\j '
fi
# version 211203 does not have this feature, 230805 does. we can't
# detect this over ssh. We could copy the var over ssh, but I'd
# rather just wait until i'm not running the earlier konsole.
- if [[ $TYPESCRIPT_SHELL != true && $TERM == xterm-256color && $KONSOLE_VERSION && ! $KONSOLE_VERSION == 2[01]* ]]; then
+ if [[ $BASH_COMMAND != set && $TYPESCRIPT_SHELL != true && $TERM == xterm-256color && $KONSOLE_VERSION && ! $KONSOLE_VERSION == 2[01]* ]]; then
# This is from konsole, copied after pressing ctrl-alt-] .
# I figured out what it does from reading
# https://gitlab.freedesktop.org/Per_Bothner/specifications/proposals/semantic-prompts.md
PS2='\[\e]133;A\a\]'"$PS2"'\[\e]133;B\a\]'
fi
fi
-
}
+
PROMPT_COMMAND=(prompt-command)
if [[ $TERM == screen* ]]; then
esac
-export WCDHOME=/a
-
-
case $EUID in
0)
# shellcheck disable=SC2034 # used in brc
export NOT_MAIL_HOST_P=t
fi
-source /a/bin/ds/beet-data
# * functions
# for going in the reverse direction, run
# /b/ds/navidrome-playlist-export
beetsmartplaylists() {
+ source /a/bin/ds/beet-data
install -m 0700 -d /tmp/ianbeetstmp
beet splupdate
# kill off any playlists we deleted. they will still need manual
# Export beets ratings into navidrome
beetrating() {
+ source /a/bin/ds/beet-data
local ssh_prefix
source /p/c/domain-info
if [[ $HOSTNAME != "$d_host" ]]; then
# Do transcoding and hardlinking of audio files for navidrome.
beetconvert() {
+ source /a/bin/ds/beet-data
local tmpf
tmpf="$(mktemp)"
# a bunch of effort to ignore output we dont care about...
beet -c $tmpf convert -y $nav_convert_query > >(grep -vFx 'ignore_this' ||:) 2> >(grep -v '^convert: Skipping' ||:)
rm "$tmpf"
}
+
# This deletes files in the converted directory which should no longer
# be there due to a rename of the unconverted file.
beetconvert-rm-extras() {
+ source /a/bin/ds/beet-data
local l tmpf
local -A paths
tmpf="$(mktemp)"
}
beets-gen-playlists() {
+ source /a/bin/ds/beet-data
local i str
local -a query_array query_str
for i in "${!bpla[@]}"; do
# beet playlist. use beetag with a playlist name
bpl() {
+ source /a/bin/ds/beet-data
local playlist playlist_regex
case $1 in
-h|--help)
# beet modify quietly
beetmq() {
+ source /a/bin/ds/beet-data
local tmpf
tmpf="$(mktemp)"
# a bunch of effort to ignore output we dont care about...
# Must be called from beetag for variables to be setup
beetag-help() {
+ source /a/bin/ds/beet-data
local -i i j col_total row col button_total row_total remainder_cols remainder_term
col_total=4
button_total=${#button_map[@]}
#
# todo: enter should also unpause
beetag() {
+ source /a/bin/ds/beet-data
local last_genre_i fstring tag id char new_item char_i genre tag remove doplay i j random path
local do_rare_genres read_wait line lsout tmp ls_line skip_lookback
local escape_char escaped_input expected_input skip_input_regex right_pad erasable_line seek_sec
# update navidrome music data after doing beets tagging
beet2nav() {
+ source /a/bin/ds/beet-data
m beetpull
m beetconvert
m beetrating
# pull in beets library locally
beetpull() {
+ source /a/bin/ds/beet-data
local sshfs_host sshfs_cmd
sshfs_host=b8.nz
source /p/c/domain-info
# remove all playlists in navidrome, for when I make big
# playlist name changes and just want to scrap everything.
nav-rm-plists() {
+ source /a/bin/ds/beet-data
local tmpf id
tmpf=$(mktemp)
source /p/c/domain-info
# "artist:" it is used as the artist instead of each artist in QUERY.
#
beegenre() {
+ source /a/bin/ds/beet-data
local count artist artregex genre singleartist tmpf tmpf2
local -a artists genres
singleartist=false
cat /sys/class/power_supply/BAT0/capacity
}
-# List of apps to install/update
-# Create from existing manually installed apps by doing
-# fdroidcl update
-# fdroidcl search -i, then manually removing
-# automatically installed/preinstalled apps
-
-#
-# # my attempt at recovering from boot loop:
-# # in that case, boot to recovery (volume up, home button, power, let go of power after samsun logo)
-# # then
-# mount /dev/block/mmcblk0p12 /data
-# cd /data
-# find -iname '*appname*'
-# rm -rf FOUND_DIRS
-# usually good enough to just rm -rf /data/app/APPNAME
-#
-# currently broken:
-# # causes replicant to crash
-# org.quantumbadger.redreader
-# org.kde.kdeconnect_tp
-
-# not broke, but wont work without gps
-#com.zoffcc.applications.zanavi
-# not broke, but not using atm
-#com.nutomic.syncthingandroid
-# # doesn\'t work on replicant
-#net.sourceforge.opencamera
-#
-fdroid_pkgs=(
- net.mullvad.mullvadvpn
- org.schabi.newpipe
- io.github.subhamtyagi.lastlauncher
- io.anuke.mindustry
- com.biglybt.android.client
- de.marmaro.krt.ffupdater
- me.ccrama.redditslide
- org.fedorahosted.freeotp
- at.bitfire.davdroid
- com.alaskalinuxuser.justnotes
- com.artifex.mupdf.viewer.app
- com.danielkim.soundrecorder
- com.fsck.k9
- com.ichi2.anki
- com.jmstudios.redmoon
- com.jmstudios.chibe
- org.kde.kdeconnect_tp
- com.notecryptpro
- com.termux
- cz.martykan.forecastie
- de.danoeh.antennapod
- de.blinkt.openvpn
- de.marmaro.krt.ffupdater
- eu.siacs.conversations
- free.rm.skytube.oss
- im.vector.alpha # riot
- info.papdt.blackblub
- me.tripsit.tripmobile
- net.gaast.giggity
- net.minetest.minetest
- net.osmand.plus
- org.isoron.uhabits
- org.linphone
- org.gnu.icecat
- org.smssecure.smssecure
- org.yaaic
- sh.ftp.rocketninelabs.meditationassistant.opensource
-)
-# 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
+ local -a fdroid_pkgs
+
+ # List of apps to install/update
+ # Create from existing manually installed apps by doing
+ # fdroidcl update
+ # fdroidcl search -i, then manually removing
+ # automatically installed/preinstalled apps
+
+ #
+ # # my attempt at recovering from boot loop:
+ # # in that case, boot to recovery (volume up, home button, power, let go of power after samsun logo)
+ # # then
+ # mount /dev/block/mmcblk0p12 /data
+ # cd /data
+ # find -iname '*appname*'
+ # rm -rf FOUND_DIRS
+ # usually good enough to just rm -rf /data/app/APPNAME
+ #
+ # currently broken:
+ # # causes replicant to crash
+ # org.quantumbadger.redreader
+ # org.kde.kdeconnect_tp
+
+ # not broke, but wont work without gps
+ #com.zoffcc.applications.zanavi
+ # not broke, but not using atm
+ #com.nutomic.syncthingandroid
+ # # doesn\'t work on replicant
+ #net.sourceforge.opencamera
+ #
+ fdroid_pkgs=(
+ net.mullvad.mullvadvpn
+ org.schabi.newpipe
+ io.github.subhamtyagi.lastlauncher
+ io.anuke.mindustry
+ com.biglybt.android.client
+ de.marmaro.krt.ffupdater
+ me.ccrama.redditslide
+ org.fedorahosted.freeotp
+ at.bitfire.davdroid
+ com.alaskalinuxuser.justnotes
+ com.artifex.mupdf.viewer.app
+ com.danielkim.soundrecorder
+ com.fsck.k9
+ com.ichi2.anki
+ com.jmstudios.redmoon
+ com.jmstudios.chibe
+ org.kde.kdeconnect_tp
+ com.notecryptpro
+ com.termux
+ cz.martykan.forecastie
+ de.danoeh.antennapod
+ de.blinkt.openvpn
+ de.marmaro.krt.ffupdater
+ eu.siacs.conversations
+ free.rm.skytube.oss
+ im.vector.alpha # riot
+ info.papdt.blackblub
+ me.tripsit.tripmobile
+ net.gaast.giggity
+ net.minetest.minetest
+ net.osmand.plus
+ org.isoron.uhabits
+ org.linphone
+ org.gnu.icecat
+ org.smssecure.smssecure
+ org.yaaic
+ sh.ftp.rocketninelabs.meditationassistant.opensource
+ )
+ # https://forum.xda-developers.com/android/software-hacking/wip-selinux-capable-superuser-t3216394
+ # for maru,
+ #me.phh.superuser
+
+
# tried putting this in go buildscript cronjob,
# but it failed with undefined: os.UserCacheDir. I expect its due to
# an environment variable missing, but its easier just to stick it here.