Skip to content

Commit

Permalink
misc
Browse files Browse the repository at this point in the history
  • Loading branch information
antipasta committed Mar 29, 2021
1 parent 88c62bf commit 1903fac
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
32 changes: 26 additions & 6 deletions bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export PYTHONPATH=~/python/


alias sfreversion='perl-reversion --bump lib/SocialFlow/Web.pm;git add lib/SocialFlow/Web.pm;git commit -m "Bumping sf-web version"'
alias sfcpanm='cpanm --mirror http://cpan-mirror.dev.saturn.sfsrv.net:25123 --mirror-only'
alias sfcpanm='HTTP_PROXY=http://localhost:3128 cpanm --mirror http://cpan-mirror.dev.saturn.sfsrv.net:25123 --mirror-only'
alias bump='perl-reversion --bump '
alias vi='vim -p'
alias lessr='less -R'
Expand Down Expand Up @@ -147,7 +147,25 @@ function vpnotp() {

function vpnconnect() {
echo -n 'Enter keepass pw: ';
KeePassXC.AppImage cli show /mnt/chromeos/GoogleDrive/MyDrive/keepass/keepass2.kdbx $1 -q -t -a UserName -a Password | sed -z "s|[\n\r]||2g" > $HOME/vpn/$1.tblk/Contents/Resources/creds.txt && docker start $1 && sleep 1 && rm $HOME/vpn/$1.tblk/Contents/Resources/creds.txt && echo "connected to $1"
KeePassXC.AppImage cli show /mnt/chromeos/GoogleDrive/MyDrive/keepass/keepass2.kdbx $1 -q -t -a UserName -a Password | sed -z "s|[\n\r]||2g" > $HOME/vpn/$1.tblk/Contents/Resources/creds.txt && docker start $1 && sleep 5 && rm $HOME/vpn/$1.tblk/Contents/Resources/creds.txt && echo "connected to $1"
# KeePassXC.AppImage cli show /mnt/chromeos/GoogleDrive/MyDrive/keepass/keepass2.kdbx $1 -q -t -a UserName -a Password | sed -z "s|[\n\r]||2g" > $HOME/vpn/$1.tblk/Contents/Resources/creds.txt && docker start $1 && docker logs -f $1 && echo "connected to $1"
}

function bwvpnconnect() {
if [[ $BW_SESSION = "" ]]; then
BW_SESSION=$(bw unlock --raw)
fi
echo $(bw get username $1) > $HOME/vpn/$1.tblk/Contents/Resources/creds.txt
VPNPASS=$(bw get password $1)
VPNOTP=$(bw get totp $1)
echo "$VPNPASS$VPNOTP" >> $HOME/vpn/$1.tblk/Contents/Resources/creds.txt
docker start $1 && sleep 1 && rm $HOME/vpn/$1.tblk/Contents/Resources/creds.txt && echo "connected to $1"
}

function sfvpn() {
BW_SESSION=$(bw unlock --raw)
BW_SESSION=$BW_SESSION bwvpnconnect mars
BW_SERSSION=$BW_SESSION bwvpnconnect saturn
}

function vssh() {
Expand All @@ -156,11 +174,11 @@ function vssh() {
else
SF_SSH_ENVIRON=saturn
fi
if [[ $(gpg --card-status) ]]; then
refresh_gpga
else
# if [[ $(gpg --card-status ) ]]; then
# refresh_gpga
# else
ssh-add -q ~/.ssh/*.secret
fi
# fi

if [[ $(docker ps -q --filter name=$SF_SSH_ENVIRON) = "" ]]; then
echo "Must connect to $SF_SSH_ENVIRON..."
Expand All @@ -175,3 +193,5 @@ function vssh() {
sleep 1
done
}

alias sfssh='vssh -A $(sf-deploy.pl -c $(fdfind --type directory "prod|dev" $HOME/release/sf-deploy-application/application | fzf) --print_host)'
8 changes: 6 additions & 2 deletions vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ map ,/ :s/^/\/\//<CR> <Esc>:noh<CR>
map ./ :s/^\/\///<CR> <Esc>:noh<CR>
map ,# :s/^/#/<CR> <Esc>:noh<CR>
map .# :s/^\(\s*\)#\+/\1<CR> <Esc>:noh<CR>
vmap ,, :s/^/'/g<CR> :s/\r$/',/g<CR><Esc>:noh<CR>
" }}}

" }}}
Expand Down Expand Up @@ -206,8 +207,11 @@ map <C-j> :tabprev<CR>
" }}}

"shortcut for quoting and comma separating items
vmap <Leader>, :s/,/,\r/g<CR><Esc>:noh<CR>
nmap <Leader>, :s/\v(\w+)/'\1',/g<CR><Esc>:noh<CR>
"vmap <Leader>, :s/,/,\r/g<CR><Esc>:noh<CR>
"nmap <Leader>, :s/\v(\w+)/'\1',/g<CR><Esc>:noh<CR>
nmap <Leader>, :s/\v(\w+)/'\1',/g<CR><Esc>:noh<CR>$x
vmap <Leader>, :%s/\v(\w+)\n/'\1',/g<CR><Esc>:noh<CR>$x
nmap <Leader>, :%s/\v(\w+)\n/'\1',/g<CR><Esc>:noh<CR>$x
nmap <Leader>= [[V%=
" }}}
Expand Down

0 comments on commit 1903fac

Please sign in to comment.