all repos — dotfiles @ b047e3c7d30b251a04bee6dc453f6ad8318e0919

random configuration files

kshrc (raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
indicator()
{
  if [ $(whoami) != root ]; then
    echo "%"
  else echo "#"
  fi
}

export WINIT_X11_SCALE_FACTOR=1
export GTK_THEME=steppenwolf-dark
export GPG_TTY=$(tty)
export VISUAL=micro
export EDITOR=micro
export BROWSER=qutebrowser
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
if [ "$TERM" = "dumb" ]; then
  PS1='$(indicator) '
else
  PS1='\033]0;$(whoami)@$(hostname): ${PWD}\007[ $(hostname): ${PWD} ]\n$(indicator) '
fi
bind -m '^L'='^C'clear'^J'

silence()
{
  "$@" > /dev/null & exit
}

search()
{
  $BROWSER https://duckduckgo.com/?q="$*" > /dev/null & exit
}

acmeInit()
{
  export tabstop=2
  acme -aib -f /mnt/font/SauceCodeProNerdFontComplete-Regular/9a/font &
  exit
}

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
}

siroonian()
{
  case $1 in
    connect)
      sudo openfortivpn;;
    auth)
      kinit dstevens;;
    desktop)
      rdesktop -u dstevens -d siroonian.local -p - -KMz -x m -r sound:local -r clipboard:PRIMARYCLIPBOARD devworkstation3.siroonian.local;;
    *)
      echo "usage: siroonian [connect | auth | desktop]";;
  esac
}

waitfor()
{
  while pgrep $1; do
    sleep $2
  done
}

mergeandtest()
{
  git checkout $1
  git checkout -b $1_$2_test
  git merge $2
}

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
}

defaultsesh(){
  echo $1 > ~/.xsesh
}

reloadkwin(){
  kwin_x11 --replace --no-kactivities &
}

findprinters(){
  sudo lpinfo -l -v | grep ':/' -A 5
}

today(){
  date +%FT00:00:00%:z
}

mode(){
  case $1 in
    desktop)
      ~/src/zenUtils/extdisplay.sh solo
      sed -i -e "s/size: 6.5/size: 9/" ~/.config/alacritty-ryudo.yml
       ;;
    laptop)
      ~/src/zenUtils/extdisplay.sh off
      sed -i -e "s/size: 9/size: 6.5/" ~/.config/alacritty-ryudo.yml
      ;;
  esac
  nitrogen --restore
  killall xclock; xclock -strftime "%Y-%m-%d %H:%M" -geometry -0-0 &
}

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
}

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 --device=all --filesystem=host run us.zoom.Zoom'
alias teams='flatpak --device=all --filesystem=host run com.microsoft.Teams'
alias micro='microCmd'
alias mutt='export PINENTRY_USER_DATA=curses; echo -ne "\033]0;neomutt\007"; neomutt'
alias startx='exec startx'
# 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'

if [ -d ~/bin ]; then
  PATH=~/bin:${PATH}
  for x in ~/bin/*; do
    if [ -d $x ]; then
      PATH=${x}:${PATH}
    fi
  done
fi