Trims fat and renames files

This commit is contained in:
William Carroll 2016-08-15 11:14:37 -04:00
parent 6021ad3194
commit 4563550969
40 changed files with 233 additions and 352 deletions

View file

@ -1,17 +0,0 @@
# bash profile settings for William Carroll
# welcome message
echo "Hello, welcome back, William"
# change bash prompt
PS1='$ '
# input mode to Vi
set -o vi
# shortcuts
alias h="history"
alias vi="vim"
alias c="clear"
export EDITOR=/usr/bin/vim

View file

@ -1,38 +0,0 @@
#!/usr/bin/python
"""
Forward and Backward lookups for Bash escape sequences
"""
import sys, re
literal_to_bash = {
'ESC': '^[',
'UP-ARROW': '^[OA',
'RIGHT-ARROW': '^[OC',
'DOWN-ARROW': '^[OB',
'LEFT-ARROW': '^[OD',
'F1': '^[OP',
'F2': '^[OQ',
'F3': '^[OR',
'F4': '^[OS',
'F5': '^[15~',
'F6': '^[17~',
'F7': '^[18~',
'F8': '^[19~',
'F9': '^[20~',
'F10': '^[21~',
'F11': None,
'F12': '^[24~'
}
bash_to_literal = {
v: k for k, v in literal_to_bash.items()
}
el = sys.argv[1]
print '{0}: "{1}"'.format(el, literal_to_bash[el])

View file

@ -1,56 +0,0 @@
#!/usr/bin/python
"""
Forward and Backward lookups for URL escape sequences
"""
import sys, re
literal_to_esccode = {
' ': '%20',
'<': '%3C',
'>': '%3E',
'#': '%23',
'%': '%25',
'{': '%7B',
'}': '%7D',
'|': '%7C',
'\\': '%5C',
'^': '%5E',
'~': '%7E',
'[': '%5B',
']': '%5D',
'`': '%60',
';': '%3B',
'/': '%2F',
'?': '%3F',
':': '%3A',
'@': '%40',
'=': '%3D',
'&': '%26',
'$': '%24',
}
esccode_to_literal = {
v: k for k, v in literal_to_esccode.items()
}
def is_esccode(string):
p = re.compile(r'^%\w\w$')
m = p.match(string)
return bool(p.match(string))
try:
el = sys.argv[1]
except:
el = None
if not el:
print literal_to_esccode
else:
msg = esccode_to_literal[el] if is_esccode(el) else literal_to_esccode[el]
print '"{0}": "{1}"'.format(el, msg)

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.vim

7
.vimrc
View file

@ -1,7 +0,0 @@
syntax on
set number
set tabstop=2
set expandtab
set shiftwidth=2
colorscheme murphy

7
configs/.tmux.conf Normal file
View file

@ -0,0 +1,7 @@
set -g default-terminal "screen-256color"
bind-key -r -T prefix k select-pane -U
bind-key -r -T prefix j select-pane -D
bind-key -r -T prefix h select-pane -L
bind-key -r -T prefix l select-pane -R

View file

@ -1,4 +1,7 @@
export PATH=$HOME/bin:/opt/local/bin:/opt/local/sbin:$PATH
export PATH=$HOME/bin:/opt/local/bin:/opt/local/sbin:/usr/local/go/bin:$PATH
# make vim the default editor for commit messages etc
export EDITOR=$(which vim)
echo "Welcome back, $USER"
@ -6,10 +9,15 @@ echo "Welcome back, $USER"
set -o vi
# aliases
source $HOME/pc_settings/.w_aliases.sh
source $HOME/pc_settings/aliases.sh
# functions
source $HOME/pc_settings/.w_functions.sh
source $HOME/pc_settings/functions/index.sh
# setup keybindings for history functions
source $HOME/pc_settings/scripts/setup_keybindings.sh
# BEGIN: bindkeys
bindkey "^R" history-incremental-search-backward

View file

@ -49,6 +49,15 @@ function wgcheckout {
}
# opens the current ticket-branch in web browser
function wgjira {
base_url="https://jira.hugeinc.com/browse"
ticket=$(wgtix)
open "${base_url}/${ticket}"
}
# wgcheckout combined with a fuzzy search
function wgfcheckout {
branchname=$(trim $(git branch | fzf))
@ -57,26 +66,13 @@ function wgfcheckout {
}
# combine fetch and rebase (git frebase)
function wgfreebase {
if [ -z $1 ]; then
branchname="$(git symbolic-ref HEAD 2> /dev/null | cut -f3 -d'/')"
else
branchname="$1"
fi
# View an author's work within a specified date range.
function wgviewcommits {
author=$([ -z "$1" ] && echo "William Carroll" || echo "$1")
todays_date=$(date +'%Y-%m-%d')
date=$([ -z "$2" ] && echo "${todays_date}" || echo "$2")
git fetch origin "$branchname" && git rebase origin/"$branchname"
}
# push to current branch
function wgpush {
if [ -z $1 ]; then
branchname="$(git symbolic-ref HEAD 2> /dev/null | cut -f3 -d'/')"
else
branchname="$1"
fi
git push origin $branchname
git log --all --author="${author}" --after="${date} 00:00" \
--before="${date} 23:59"
}

View file

@ -0,0 +1,29 @@
#!/usr/bin/env bash
HISTFILE=~/.zsh_history
function wh_two_back {
command=$(history | tail -n 2 | head -n 1 | cut -c 8-)
echo -n $command
}
function wh_three_back {
command=$(history | tail -n 3 | head -n 1 | cut -c 8-)
echo -n "$command"
}
function wh_four_back {
command=$(history | tail -n 4 | head -n 1 | cut -c 8-)
echo -n "$command"
}
function wh_five_back {
command=$(history | tail -n 5 | head -n 1 | cut -c 8-)
echo -n "$command"
}

View file

@ -3,14 +3,22 @@ functon npms() {
npm start;
}
# custom js functions
source $HOME/pc_settings/.js_to_bash.sh
source $HOME/pc_settings/functions/js_to_bash.sh
# custom git functions
source $HOME/pc_settings/.git_functions.sh
source $HOME/pc_settings/functions/git_functions.sh
# custom bash helpers functions
source $HOME/pc_settings/.misc_functions.sh
source $HOME/pc_settings/functions/misc_functions.sh
# custom history functions for zle bindkey
source $HOME/pc_settings/functions/history_functions.sh
# custom functions to work with vim
source $HOME/pc_settings/functions/vim_functions.sh
# generates placeholder content for FE work
function lorem {

View file

@ -33,3 +33,8 @@ function trim {
echo "${input//[[:blank:]]/}"
}
function wgreviewers {
echo "BJ Warshaw\nDaniel Wasilewski\nSean Sullivan\nCharles Morrissey\nRyan Balch\nZach Goldstein\nWilliam Anderson"
}

View file

@ -0,0 +1,29 @@
#!/usr/bin/env bash
# Easily search for strings within the files within the current directory.
# Specify file extensions and directories to exclude to improve accuracy.
# The file selected from fzf will be opened in vim.
function vfzopen() {
echo -n "Search Term: "
read search_query
echo -n "Filename: "
read filetype
echo -n "Exclude Directory: "
read exclude_dir
if [ ! -z "$exclude_dirs" ]; then
filename=$(find . -type f -name "$filetype" | \
xargs grep -l "$search_query" | fzf)
else
filename=$(find . -type f -name "$filetype" -not -path "./${exclude_dir}/*" \
| xargs grep -l "$search_query" | fzf)
fi
if [ ! -z "$filename" ]; then
vim "$filename"
return 0
else
return 1
fi
}

View file

@ -0,0 +1,13 @@
#!/usr/bin/env bash
if [ -d /Volumes/usb_vim ] && \ # usb has mounted
[ ! -L "$HOME/.vimrc" ] && \ # .vimrc is a symlink
[ ! -L "$HOME/.vim" ]; then # .vim dir is a symlink
. "/Volumes/usb_vim/vim/vim_point_to_usb.sh"
. "$HOME/pc_settings/launchd_scripts/notice.sh"
else
. "$HOME/pc_settings/launchd_scripts/notice_2.sh"
fi

34
launchd_scripts/bootstrap.sh Executable file
View file

@ -0,0 +1,34 @@
#!/usr/bin/env bash
# Unload scripts in case there have been changes since it was last loaded.
echo -n "Unloading personal *.plist files... " &&
launchctl unload ~/Library/LaunchAgents/watch_volumes.plist &&
echo "Done." || echo "Error."
# Remove *.plist symlinks created last time.
echo -n "Removing *.plist symlinks... " &&
rm ~/Library/LaunchAgents/watch_volumes.plist &&
echo "Done." || echo "Error."
# Process the *.tpl files, replacing global identifiers with the values
# from vars.json.
echo -n "Processing *.tpl files... " &&
. ./process_files.sh &&
echo "Done." || echo "Error."
# Recreate those symlinks.
echo -n "Recreating *.plist symlinks to ~/Library/LaunchAgents ... " &&
ln -s ~/pc_settings/launchd_scripts/watch_volumes.plist \
~/Library/LaunchAgents/watch_volumes.plist &&
echo "Done." || echo "Error."
# Reload scripts in case there have been changes since it was last loaded.
echo -n "Reloading personal *.plist files... " &&
launchctl load ~/Library/LaunchAgents/watch_volumes.plist &&
echo "Done." || echo "Error."

5
launchd_scripts/notice.sh Executable file
View file

@ -0,0 +1,5 @@
#!/usr/bin/env bash
osascript -e "tell Application \"System Events\" to display alert\
\"New volume mounted.\""

5
launchd_scripts/notice_2.sh Executable file
View file

@ -0,0 +1,5 @@
#!/usr/bin/env bash
osascript -e "tell Application \"System Events\" to display alert\
\"Not going to switch!\""

View file

@ -0,0 +1,15 @@
#!/usr/bin/env bash
# This script processes certain files and replaces
# {{<IDENTIFIER>}} with the entries in vars.json
output_path="./watch_volumes.plist"
template_file="watch_volumes.plist.tpl"
usb_drive_path=$(jq < ./vars.json '.USB_DRIVE_PATH' | \
sed 's/\//\\\//g' | sed 's/"//g')
cat "$template_file" | perl -p -e 's/(\{\{[^}]+\}\})/'$usb_drive_path'/g' \
>"$output_path"
echo "Done."

View file

@ -0,0 +1,3 @@
{
"USB_DRIVE_PATH": "/Volumes/usb_vim/"
}

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>WatchVolumes</string>
<key>ProgramArguments</key>
<array>
<string>/Users/wcarroll/pc_settings/launchd_scripts/attempt_vim_switch.sh</string>
</array>
<key>WatchPaths</key>
<array>
<string>/Volumes/usb_vim/</string>
</array>
</dict>
</plist>

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>WatchVolumes</string>
<key>ProgramArguments</key>
<array>
<string>/Users/wcarroll/pc_settings/launchd_scripts/attempt_vim_switch.sh</string>
</array>
<key>WatchPaths</key>
<array>
<string>{{USB_DRIVE_PATH}}</string>
</array>
</dict>
</plist>

BIN
scripts/.swp Normal file

Binary file not shown.

View file

@ -0,0 +1,11 @@
#!/usr/bin/env bash
# This file is run after history_functions.sh have been sourced.
# It converts the defined functions into zsh widgets that are
# thereafter bound to keys for expedience.
zle -N wh_two_back_widget wh_two_back &&
bindkey '^@' wh_two_back_widget

Binary file not shown.

View file

@ -1,5 +0,0 @@
let g:netrw_dirhistmax =10
let g:netrw_dirhist_cnt =3
let g:netrw_dirhist_1='/Volumes/usb_vim/.Spotlight-V100'
let g:netrw_dirhist_2='/Users/wcarroll'
let g:netrw_dirhist_3='/Users/wcarroll/pc_settings/usbify/vim'

@ -1 +0,0 @@
Subproject commit c822b05ee0886f9a9703227dc85a6d47612c4bf1

@ -1 +0,0 @@
Subproject commit 4984767509e3d05ca051e253c8a8b37de784be45

@ -1 +0,0 @@
Subproject commit 354c429dad34f7d163663943c948f819588b53d3

@ -1 +0,0 @@
Subproject commit b9fa920b4abbb54799927a3bc57869fdd556321a

@ -1 +0,0 @@
Subproject commit 2e2b649232d6ae4d02d74793e5da0ee08480ad8d

@ -1 +0,0 @@
Subproject commit a78607c9f63f270137e472126ee1b2c3ae52a845

@ -1 +0,0 @@
Subproject commit d400a570bf64b0c216aa7c8e1795820b911a7404

@ -1 +0,0 @@
Subproject commit 6014bdc57f161f5ae5140e4247b144ae149bf894

@ -1 +0,0 @@
Subproject commit c00ebd75ac23f4080c0d0bf9453b16304a3fb316

@ -1 +0,0 @@
Subproject commit e5d4bfb5dab8c4f122b97fe9c3ed2f2d1e8b3bdc

@ -1 +0,0 @@
Subproject commit 5cb4b369cac5b29dd7f2e688b23a2b57263972ab

View file

@ -1 +0,0 @@
au BufRead,BufNewFile *.soy set filetype=soy

View file

@ -1,46 +0,0 @@
"============================================================================
"File: gjslint.vim
"Description: Javascript syntax checker - using gjslint
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists('g:loaded_syntastic_javascript_gjslint_checker')
finish
endif
let g:loaded_syntastic_javascript_gjslint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_javascript_gjslint_GetLocList() dict
call syntastic#log#deprecationWarn('javascript_gjslint_conf', 'javascript_gjslint_args')
let makeprg = self.makeprgBuild({
\ 'args': '--nodebug_indentation',
\ 'args_after': '--check_html --nosummary --unix_mode --nobeep' })
let errorformat =
\ "%f:%l:(New Error -%\\?\%n) %m," .
\ "%f:%l:(-%\\?%n) %m," .
\ "%-G1 files checked," .
\ " no errors found.," .
\ "%-G%.%#"
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'javascript',
\ 'name': 'gjslint'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

View file

@ -1,145 +0,0 @@
" Google Closure templates syntax file.
" Language: Soy
" Maintainer: Dugan Chen (https://github.com/duganchen)
"
if exists("b:current_syntax")
finish
endif
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
syntax clear
syntax case match
syntax keyword soyConstant contained null
syntax keyword soyConstant contained false
syntax keyword soyConstant contained true
syntax keyword soyFunction contained isFirst
syntax keyword soyFunction contained isLast
syntax keyword soyFunction contained index
syntax keyword soyFunction contained hasData
syntax keyword soyFunction contained length
syntax keyword soyFunction contained round
syntax keyword soyFunction contained floor
syntax keyword soyFunction contained ceiling
syntax keyword soyFunction contained min
syntax keyword soyFunction contained max
syntax keyword soyFunction contained randomInt
syntax keyword soyFunction contained bidiGlobalDir
syntax keyword soyFunction contained bidiDirAttr
syntax keyword soyFunction contained bidiMark
syntax keyword soyFunction contained bidiMarkAfter
syntax keyword soyFunction contained bidiStartEdge
syntax keyword soyFunction contained bidiEndEdge
syntax keyword soyFunction contained bidiTextDir
syntax keyword soyStatement contained namespace
syntax keyword soyStatement contained template
syntax keyword soyStatement contained delpackage
syntax keyword soyStatement contained deltemplate
syntax keyword soyKeyword contained literal
syntax keyword soyKeyword contained print
syntax keyword soyKeyword contained msg
syntax keyword soyKeyword contained call
syntax keyword soyKeyword contained delcall
syntax keyword soyKeyword contained param
syntax keyword soyKeyword contained let
syntax keyword soyKeyword contained css
syntax keyword soyConditional contained if
syntax keyword soyConditional contained elseif
syntax keyword soyConditional contained else
syntax keyword soyConditional contained switch
syntax keyword soyConditional contained case
syntax keyword soyConditional contained default
syntax keyword soyConditional contained ifempty
syntax keyword soyRepeat contained foreach
syntax keyword soyRepeat contained for
syntax keyword soyRepeat contained in
syntax keyword soyRepeat contained range
syntax keyword soyCharacter contained sp
syntax keyword soyCharacter contained nil
syntax keyword soyCharacter contained r
syntax keyword soyCharacter contained n
syntax keyword soyCharacter contained t
syntax keyword soyCharacter contained lb
syntax keyword soyCharacter contained rb
syntax keyword soyDirective contained private
syntax keyword soyDirective contained autoescape
syntax keyword soyDirective contained noAutoescape
syntax keyword soyDirective contained id
syntax keyword soyDirective contained escapeCssString
syntax keyword soyDirective contained escapeHtml
syntax keyword soyDirective contained escapeHtmlRcdata
syntax keyword soyDirective contained escapeHtmlAttribute
syntax keyword soyDirective contained escapeHtmlAttributeNospace
syntax keyword soyDirective contained escapeUri
syntax keyword soyDirective contained escapeJs
syntax keyword soyDirective contained escapeJsRegex
syntax keyword soyDirective contained escapeJsString
syntax keyword soyDirective contained escapeJsValue
syntax keyword soyDirective contained truncate
syntax keyword soyDirective contained insertWordBreaks
syntax keyword soyDirective contained changeNewlineToBr
syntax keyword soyDirective contained desc
syntax keyword soyDirective contained meaning
syntax keyword soyDirective contained data
syntax keyword soyDirective contained kind
syntax keyword soyDirective contained variant
syntax keyword soyDirective contained bidiSpanWrap
syntax keyword soyDirective contained bidiUnicodeWrap
syntax match soySpecialComment /@param?\?/ contained
syntax region soyCommand start="{" end="}" contains=soyKeyword, soyDirective, soyIdentifier, soyString, soyTemplate, soyConstant, soyInteger, soyCharacter, soyFloat, soySci, soyOperator, soyFunction, soyRepeat, soyConditional, soyStatement, soyLabel
syntax region soyString contained start="\'" end="\'"
syntax region soyString contained start="\"" end="\""
syntax match soyIdentifier /\$[a-zA-Z0-9._]*\>/ contained
syntax region soyComment start=/\/\*/ end='\\*\/' contains=soySpecialComment
syntax match soyComment /\/\/.*$/
syntax match soyTemplate /\s\+\.\w\+\>/ contained
syntax match soyInteger /\-\?\(0x\)\?[A-F0-9]\+\>/ contained
syntax match soyNumber /\-\?\d\+\(e\-\?\d\+\)\?\>/ contained
syntax match soyFloat /\-\?\d\+\.\d\+\>/ contained
syntax match soySci /\-\?\d\+e\-\?\d\+\>/ contained
syntax match soyOperator /\<\(not\|and\|or\)\>/ contained
syntax match soyLabel /\<\w\+:/ contained
" Yes, this causes the - in -1 to show as an operator. This is a bug.
syntax match soyOperator /[-*/%+<>=!?:]/ contained
highlight def link soyOperator Operator
highlight def link soyKeyword Statement
highlight def link soyDirective Type
highlight def link soyIdentifier Identifier
highlight def link soyString String
highlight def link soyComment Comment
highlight def link soyTemplate Identifier
highlight def link soyInteger Number
highlight def link soyFloat Float
highlight def link soySci Float
highlight def link soyConstant Constant
highlight def link soyCharacter Character
highlight def link soyFunction Function
highlight def link soyRepeat Repeat
highlight def link soyConditional Conditional
highlight def link soyStatement Statement
highlight def link soySpecialComment SpecialComment
highlight def link soyLabel Identifier