Skip to content

Commit

Permalink
Update 1/9/2020
Browse files Browse the repository at this point in the history
  • Loading branch information
Evan Thomas committed Jan 9, 2021
1 parent 34910ec commit c604d41
Show file tree
Hide file tree
Showing 10 changed files with 97 additions and 24 deletions.
3 changes: 3 additions & 0 deletions .ackrc
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,6 @@
--ignore-dir=match:.aws-sam
--ignore-dir=match:.tempocom
--ignore-file=match:yarn.lock

# Terraform
--ignore-dir=.terraform
7 changes: 6 additions & 1 deletion .bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[ -f ~/.marksrc ] && source ~/.marksrc
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
[ -f ~/.dotfiles/secrets ] && source ~/.dotfiles/secrets
[ -f ~/.temporc ] && source ~/.temporc

# brew bash completion stuff (bat, ag, pandoc). Idk if this even does anything
[ -d /usr/local/etc/bash_completion. ] && source /usr/local/etc/bash_completion.d/*
Expand Down Expand Up @@ -61,6 +62,7 @@ alias nv='nvim'
alias py36='~/.pyenv/versions/3.6.1/bin/python'
alias svenv='source venv/bin/activate'
alias tf='tfwrapper'
alias gs='git s'


# ================================= FZF =================================
Expand Down Expand Up @@ -114,7 +116,7 @@ export HISTFILESIZE=10000 # big big history


# ================================= OTHER =================================
if [ -z "$TMUX" ]; then
if [ -z "$TMUX" ] && [ -t 1 ]; then
tmux
fi

Expand Down Expand Up @@ -146,3 +148,6 @@ eval "$(pipenv --completion)"


[[ -s "/home/evan/.gvm/scripts/gvm" ]] && source "/home/evan/.gvm/scripts/gvm"

LINES=$(cat /home/evan/file | wc -l)
echo $LINES >> /home/evan/file
13 changes: 9 additions & 4 deletions .vim/.vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -424,10 +424,10 @@ command! -nargs=0 Tasks :tabnew /home/evan/github.com/tempoautomation/digital-fa

command! -nargs=0 NT :NERDTree expand('%:p:h')

nnoremap <leader>gn :g/./norm<space>
xnoremap <leader>gn :g/./norm<space>
nnoremap <leader>gvn :v/./norm<space>
xnoremap <leader>gvn :v/./norm<space>
" nnoremap <leader>gn :g/./norm<space>
" xnoremap <leader>gn :g/./norm<space>
" nnoremap <leader>gvn :v/./norm<space>
" xnoremap <leader>gvn :v/./norm<space>

command! -nargs=0 FoldPython :%g/^\s*def/norm f)jzfii

Expand All @@ -437,3 +437,8 @@ command! -nargs=* Jq :%!jq <args>
command! -nargs=1 Ft :set ft=<args>

command! -nargs=0 Ws :w !sudo tee %

command! -nargs=0 PyD2J :%!python -c 'import sys, json; print(json.dumps(eval(sys.stdin.read().strip())))'

command! -nargs=0 BgLight :set background=light
command! -nargs=0 BgDark :set background=dark
23 changes: 17 additions & 6 deletions .vim/plugin/mystuff/black.vim
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ function! Black()
let l:out = system("black -q - ", l:bufContent)
if v:shell_error != 0
echo "black error"
let l:err = system("black -q - 1>/dev/null", l:bufContent)
echo l:err
return
endif
:%delete _
Expand All @@ -14,9 +16,18 @@ function! Black()
endfunction
command! -nargs=0 Black call Black()

if exists("g:black_autosave")
augroup myBlackGroup
autocmd!
autocmd BufWritePre *py call Black()
augroup END
endif
function! BlackErr()
let l:winview = winsaveview()
let l:bufContent = getbufline(bufnr('%'), 1, line("$"))
" on lower vim versions you might need to '\n'.join(bufContent) before
" feeding into system
let l:out = system("black -q - 1>/dev/null", l:bufContent)
if v:shell_error != 0
echo l:out
return
endif
:%delete _
call setline(1, split(l:out, "\n"))
call winrestview(l:winview)
endfunction
command! -nargs=0 BlackErr call BlackErr()
38 changes: 38 additions & 0 deletions .vim/plugin/mystuff/header.vim
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,41 @@ function! MakeHeader()
endfunction

command! -nargs=0 Header call MakeHeader()



function! MakeHeader2()
let l:text = trim(getline('.'))
let l:textlen = strlen(l:text)
let l:headerlen = 79
let l:row2BeginLen = (l:headerlen - l:textlen - 2 + 1) / 2
let l:row2EndLen = (l:headerlen - l:textlen - 2) / 2
let l:row2 = repeat(join(['#'], ''), l:row2BeginLen) .
\ ' ' . l:text . ' ' .
\ repeat(join(['#'], ''), l:row2EndLen)

call append(line('.'), l:row2)
" for some reason internet says not to use normal in vimscript
normal! dd
endfunction
command! -nargs=0 Header2 call MakeHeader2()



function! MakeHeaderSql()
let l:text = trim(getline('.'))
let l:textlen = strlen(l:text)
let l:headerlen = 79
let l:row2BeginLen = (l:headerlen - l:textlen - 2 + 1) / 2
let l:row2EndLen = (l:headerlen - l:textlen - 2) / 2
let l:row2 = '/' .
\ repeat(join(['*'], ''), l:row2BeginLen - 1) .
\ ' ' . l:text . ' ' .
\ repeat(join(['*'], ''), l:row2EndLen - 1) .
\ '/'

call append(line('.'), l:row2)
" for some reason internet says not to use normal in vimscript
normal! dd
endfunction
command! -nargs=0 HeaderSql call MakeHeaderSql()
14 changes: 11 additions & 3 deletions scripts/bootstrap-python
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
#!/bin/bash
set -euxo pipefail

[ -d venv ] || /home/evan/.pyenv/versions/3.9.0/bin/python -m venv venv

if [ ! -f .envrc ] || [ -z `grep "source venv/bin/activate" .envrc` ]; then
echo "source venv/bin/activate" >> .envrc
direnv allow
fi

/home/evan/.pyenv/shims/python3.8 -m venv venv
echo "source venv/bin/activate" >> .envrc
source venv/bin/activate
pip install flake8
pip install mypy
pip install black
pip install jedi

cat <<EOF >> pyproject.toml
if [ ! -f pyproject.toml ] || [ -z `grep tool.black pyproject.toml` ]; then
cat <<EOF >> pyproject.toml
[tool.black]
line-length = 79
EOF
fi
2 changes: 1 addition & 1 deletion scripts/git-scripts/git-backup
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -eo pipefail

CUR_BRANCH=`git rev-parse --abbrev-ref HEAD`
NEW_BRANCH="${CUR_BRANCH}_backup-$(date +%Y.%m.%d-%H.%M)"
NEW_BRANCH="${CUR_BRANCH}_backup-$(date +%Y.%m.%d-%H.%M.%S)"

if [ "$1" == "--create" ] || [ "$1" = "-c" ]; then
git branch "$NEW_BRANCH"
Expand Down
2 changes: 2 additions & 0 deletions scripts/now
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
date +%Y%m%d.%H:%M:%S
18 changes: 9 additions & 9 deletions scripts/pihole
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,24 @@
# IPv6="${IPv6:-$IPv6_LOOKUP}" # use $IPv6, if set, otherwise IP_LOOKUP
# DOCKER_CONFIGS="$(pwd)" # Default of directory you run this from, update to where ever.

ServerIP=$(curl api.ipify)
WEBPASSWORD=muttley1
set -euxo pipefail

ServerIP=$(curl https://api.ipify.org)
WEBPASSWORD=password
DOCKER_CONFIGS=$(pwd)

echo "### Make sure your IPs are correct, hard code ServerIP ENV VARs if necessary\nIP: ${IP}\nIPv6: ${IPv6}"
docker run -d \
echo "### Make sure your IPs are correct, hard code ServerIP ENV VARs if necessary\nIP: ${ServerIP}"
docker run --rm \
--name pihole \
-p 53:53/tcp -p 53:53/udp \
-p 67:67/udp \
-p 80:80 \
-p 443:443 \
-v "${DOCKER_CONFIGS}/pihole/:/etc/pihole/" \
-v "${DOCKER_CONFIGS}/dnsmasq.d/:/etc/dnsmasq.d/" \
-e ServerIP="${IP}" \
# -e ServerIPv6="${IPv6}" \
--restart=unless-stopped \
-e ServerIP=$ServerIP \
--cap-add=NET_ADMIN \
diginc/pi-hole:latest

echo -n "Your password for https://${IP}/admin/ is "
docker logs pihole 2> /dev/null | grep 'password:'
# echo -n "Your password for https://${IP}/admin/ is "
# docker logs pihole 2> /dev/null | grep 'password:'
1 change: 1 addition & 0 deletions scripts/today
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#!/bin/bash
date +%Y%m%d

0 comments on commit c604d41

Please sign in to comment.