303 lines
6.2 KiB
Bash
303 lines
6.2 KiB
Bash
|
|
indicator()
|
|
{
|
|
if [ $(whoami) != root ]; then
|
|
echo "%"
|
|
else echo "#"
|
|
fi
|
|
}
|
|
|
|
sshmount()
|
|
{
|
|
sshfs $1 $2
|
|
}
|
|
|
|
sshumount()
|
|
{
|
|
fusermount3 -u $1
|
|
}
|
|
|
|
decryptmount()
|
|
{
|
|
cryptsetup luksOpen $1 $2
|
|
mount /dev/mapper/$2 $3
|
|
}
|
|
|
|
encryptumount()
|
|
{
|
|
umount $1
|
|
cryptsetup luksClose $1
|
|
}
|
|
|
|
|
|
# one extra step with a logical volume:
|
|
# open the luks disk, activate the volume group,
|
|
# then finally mount the volume at the desired mount point
|
|
decryptmountlv()
|
|
{
|
|
cryptsetup luksOpen $1 $2
|
|
vgchange -ay
|
|
mount /dev/mapper/$3 $4
|
|
}
|
|
|
|
# unmount the logical volume,
|
|
# close the logical volume,
|
|
# then close the disk
|
|
encryptumountlv()
|
|
{
|
|
umount $1
|
|
cryptsetup luksClose $1
|
|
cryptsetup luksClose $2
|
|
}
|
|
|
|
cuegen()
|
|
{
|
|
if [ ! -z "$2" ]; then
|
|
echo "FILE \"$1\" BINARY" > $2
|
|
echo " TRACK 01 MODE1/2352" >> $2
|
|
echo " INDEX 01 00:00:00" >> $2
|
|
else
|
|
echo "usage: cuegen IMAGE CUEFILE"
|
|
fi
|
|
}
|
|
|
|
mssqldb()
|
|
{
|
|
if [ -z "$1" ]; then
|
|
return
|
|
fi
|
|
|
|
if [ "$1" = "clear" ]; then
|
|
docker volume rm mssql_data mssql_log mssql_secrets
|
|
return
|
|
fi
|
|
|
|
if [ "$1" = "persist" ]; then
|
|
volumes="-v mssql_data:/var/opt/mssql/data -v mssql_log:/var/opt/mssql/log -v mssql_secrets:/var/opt/mssql/secrets"
|
|
shift
|
|
else
|
|
volumes=""
|
|
fi
|
|
|
|
app=$1
|
|
|
|
if [ ! -z $2 ]; then
|
|
docker run -it --rm -e SA_PASSWORD="BadDefaultPassword!" -e MOCK_DATA="$2" -p 1433:1433 ${volumes} ${app}_db
|
|
else
|
|
docker run -it --rm -e SA_PASSWORD="BadDefaultPassword!" -p 1433:1433 ${volumes} ${app}_db
|
|
fi
|
|
}
|
|
|
|
mondev(){
|
|
case $1 in
|
|
db)
|
|
docker run -it --rm -e MONGO_INITDB_ROOT_USERNAME="root" -e MONGO_INITDB_ROOT_PASSWORD="BadDefaultPassword" -e dbUser="mondev" -e dbPwd="mondevpw" -p 27017:27017 mondev_db;;
|
|
acs)
|
|
docker run -it --rm --name acs -e RABBITMQ_ADDRESS="172.17.0.3" -e RABBITMQ_PORT="5672" -e CLIENT_PORT="25252" -p 15673:15673 -p 25252:25252 mondev_acs;;
|
|
mq)
|
|
docker run -it --rm --hostname localhost --name rabbit -p 5672:5672 -p 15672:15672 rabbitmq;;
|
|
*)
|
|
echo "usage: mondev [db | acs | mq]";;
|
|
esac
|
|
}
|
|
|
|
waitfor()
|
|
{
|
|
while pgrep $1; do
|
|
sleep $2
|
|
done
|
|
}
|
|
|
|
9man()
|
|
{
|
|
if [ "${TERM}" != "dumb" ]; then
|
|
man "$@"
|
|
else
|
|
man -c "$@" | ul
|
|
fi
|
|
}
|
|
|
|
microCmd()
|
|
{
|
|
if [ "$TERM" == linux ]; then
|
|
micro -clipboard internal -colorscheme solarwolf_fb "$@"
|
|
else
|
|
echo -ne "\033]0;micro\007"
|
|
micro "$@"
|
|
fi
|
|
}
|
|
|
|
findprinters(){
|
|
sudo lpinfo -l -v | grep ':/' -A 5
|
|
}
|
|
|
|
today(){
|
|
date +%FT00:00:00%:z
|
|
}
|
|
|
|
mode(){
|
|
hasPanel=0
|
|
hasTile=0
|
|
if [ ! -z "$1" ]; then
|
|
if pgrep tint2; then
|
|
hasPanel=1
|
|
killall tint2
|
|
fi
|
|
if pgrep zentile; then
|
|
hasTile=1
|
|
killall zentile
|
|
fi
|
|
case $1 in
|
|
desktop)
|
|
~/src/zenUtils/extdisplay.sh solo
|
|
;;
|
|
laptop)
|
|
~/src/zenUtils/extdisplay.sh off
|
|
xrandr --dpi 96
|
|
;;
|
|
dualleft)
|
|
~/src/zenUtils/extdisplay.sh left-of
|
|
;;
|
|
dualright)
|
|
~/src/zenUtils/extdisplay.sh right-of
|
|
esac
|
|
nitrogen --restore
|
|
if pgrep ryudo; then
|
|
killall xneralie; ~/src/xneralie/launch.sh &
|
|
fi
|
|
if [ ${hasPanel} -eq 1 ]; then
|
|
tint2 &
|
|
fi
|
|
if [ ${hasTile} -eq 1 ]; then
|
|
zentile &
|
|
fi
|
|
fi
|
|
}
|
|
|
|
mkthumb() {
|
|
if [ ! -z "$2" ]; then
|
|
size=$2
|
|
else
|
|
size=500
|
|
fi
|
|
convert $1 -strip -auto-orient -resize ${size} -dither FloydSteinberg -colors 16 $1.thumb.png
|
|
}
|
|
|
|
init-otp() {
|
|
if [ -z "$2" ]; then
|
|
:
|
|
else
|
|
case $1 in
|
|
insert)
|
|
op=insert;;
|
|
append)
|
|
op=append;;
|
|
esac
|
|
fi
|
|
|
|
if [ ! -z "${op}" ]; then
|
|
scrot -s .tmpQR.png
|
|
zbarimg --raw -q .tmpQR.png | pass otp ${op} $2
|
|
shred .tmpQR.png
|
|
rm .tmpQR.png
|
|
else
|
|
echo "usage: init-otp ( insert | append ) STORE"
|
|
fi
|
|
}
|
|
|
|
dreadlock() {
|
|
cmd=$1
|
|
shift
|
|
$cmd "$@" | nobs
|
|
}
|
|
|
|
felt() {
|
|
if [ ! -e ./felt ]; then
|
|
echo "i give to you; my felt"
|
|
return
|
|
fi
|
|
case $1 in
|
|
test)
|
|
./felt 127.0.0.1:8888 mongodb://felt_api:dimensional_core_filings@127.0.0.1:27017/felt
|
|
;;
|
|
*)
|
|
echo "did you mean 'felt test'?"
|
|
esac
|
|
}
|
|
|
|
|
|
export WINIT_X11_SCALE_FACTOR=1
|
|
export LC_ALL=en_US.UTF-8
|
|
export GPG_TTY=$(tty)
|
|
export VISUAL=micro
|
|
export EDITOR=micro
|
|
export BROWSER=netsurf
|
|
export GTK_THEME=steppenwolf-dark
|
|
export MICRO_TRUECOLOR=1
|
|
export GOPATH=~/src/go
|
|
export ZEIT_DB=~/.zeit/db
|
|
export DOTNET_ROOT=${HOME}/bin/dotnet
|
|
export SIGNID=90587A740FA4FFA0971575383B7FBC22144E6398
|
|
export ENCRID=F5672E001CC962BE3B6C8887C65B677280C66DE5
|
|
export MBOX_ROOT=/home/nilix/lib/mail/zoho
|
|
export LIGHTCRYSTAL_SITE_DIR=/home/nilix/src/lightcrystal.systems/site
|
|
export LIGHTCRYSTAL_STATIC_DIR=/home/nilix/src/lightcrystal.systems/static
|
|
export DENO_INSTALL="/home/nilix/.deno"
|
|
export PODLIST_DATA_DIR="/home/nilix/lib/podcasts"
|
|
if [ "$TERM" = "dumb" ]; then
|
|
PS1='$(indicator) '
|
|
export PINENTRY_USER_DATA=tty
|
|
alias node='dreadlock node'
|
|
alias git='dreadlock git'
|
|
export EDITOR=E
|
|
export VISUAL=E
|
|
else
|
|
PS1='\033]0;$(whoami)@$(hostname): ${PWD}\007[ $(hostname): ${PWD} ]\n$(indicator) '
|
|
export PINENTRY_USER_DATA=curses
|
|
# export MBLAZE_PAGER=more
|
|
fi
|
|
bind -m '^L'='^C'clear'^J'
|
|
|
|
|
|
alias alsamixer='alsamixer --no-color'
|
|
alias web='silence $BROWSER'
|
|
alias mail='silence thunderbird'
|
|
alias fs='silence pcmanfm-qt'
|
|
alias office='silence libreoffice'
|
|
alias acme='acmeInit'
|
|
alias man='9man'
|
|
alias gpg='gpg2'
|
|
alias zoom='flatpak --env=XDG_DOCUMENTS_DIR=/home/nilix/lib/doc --filesystem=host run us.zoom.Zoom'
|
|
alias teams='flatpak --device=all --filesystem=host run com.microsoft.Teams'
|
|
alias micro='microCmd'
|
|
alias startx='exec startx'
|
|
# alias mutt='echo -ne "\033]0;neomutt\007"; neomutt'
|
|
# alias mpv='mpv --player-operation-mode=pseudo-gui --term-osd=force --cover-art-files=/home/nilix/lib/img/ux/sound_only.png'
|
|
alias ls='ls -lh --group-directories-first'
|
|
alias nasu='uxnemu ~/src/nasu/bin/nasu.rom'
|
|
alias dexe='uxnemu ~/src/dexe/bin/dexe.rom'
|
|
|
|
if [ "$winid" ]; then
|
|
## ... then patch the `cd` command
|
|
_cd () {
|
|
\cd "$@" && awd
|
|
}
|
|
alias cd=_cd
|
|
fi
|
|
|
|
PATH=${HOME}/bin/crystal/bin:${PATH}
|
|
PATH=${HOME}/.local/bin:${PATH}
|
|
PATH=${HOME}/.dotnet/tools:${PATH}
|
|
PATH=${HOME}/src/go/bin:${PATH}
|
|
PATH=${HOME}/lib/signal-cli-0.10.8/bin:${PATH}
|
|
PATH="$DENO_INSTALL/bin:$PATH"
|
|
if [ -d ~/bin ]; then
|
|
PATH=~/bin:${PATH}
|
|
for x in ~/bin/*; do
|
|
if [ -d $x ]; then
|
|
PATH=${x}:${PATH}
|
|
fi
|
|
done
|
|
fi
|
|
|
|
export PATH
|