Skip to content

Instantly share code, notes, and snippets.

View abatkin's full-sized avatar

Adam Batkin abatkin

View GitHub Profile
@abatkin
abatkin / TomcatCustomizer.java
Created July 31, 2015 01:47
Tomcat Access valve for populating User Principal from remote header (from Spring Boot)
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {
return new EmbeddedServletContainerCustomizer() {
public void customize(ConfigurableEmbeddedServletContainer factory) {
if (factory instanceof TomcatEmbeddedServletContainerFactory) {
TomcatEmbeddedServletContainerFactory containerFactory = (TomcatEmbeddedServletContainerFactory) factory;
containerFactory.addContextValves(new ValveBase() {
@Override
public void invoke(Request request, Response response) throws IOException, ServletException {
@abatkin
abatkin / intellitype.txt
Created April 4, 2012 19:27
IntelliType Hacking
In the registry:
[HKEY_CURRENT_USER\Software\Microsoft\IntelliType Pro\ModelSpecific\1016\EventMapping\82]
The ModelSpecific\1016 stuff may be different depending on the keyboard
The 82 is the specific key (in this case, Favorite 5)
Reference here: http://xahlee.org/emacs/ms_keyboard/intellitype_rigistry.html
"Command"=dword:0000019c
@abatkin
abatkin / tabular.vim
Created April 5, 2012 20:03
Table formatting (with Tabular)
function! FormatTableLine(line)
let curr_line = a:line
" Get rid of all leading or trailing spaces
let curr_line = substitute(curr_line, '^[ ]\{1,\}\|[ ]\{1,\}$', '', 'g')
" Replace all tabs with " | "
let curr_line = substitute(curr_line, '\t', ' | ', 'g')
" Possibly insert a leading | (if there isn't already one)
@abatkin
abatkin / vimwiki.vim
Created May 29, 2012 21:19
.vim/after/ftplugin/vimwiki.vim
set wrap
set linebreak
set textwidth=0
set wrapmargin=0
@abatkin
abatkin / .vimrc
Created May 29, 2012 21:18
Work vimrc (on Windows)
call pathogen#infect()
let s:local_vim_dir = expand("~/.vim-local")
if isdirectory(s:local_vim_dir)
call pathogen#infect(s:local_vim_dir)
endif
syntax enable
filetype plugin indent on
@abatkin
abatkin / tabular.vim
Created May 29, 2012 21:20
.vim/after/plugin/tabular.vim
function! FormatTableLine(line)
let curr_line = a:line
" Get rid of all leading or trailing spaces
let curr_line = substitute(curr_line, '^[ ]\{1,\}\|[ ]\{1,\}$', '', 'g')
" Replace all tabs with " | "
let curr_line = substitute(curr_line, '\t', ' | ', 'g')
" Possibly insert a leading | (if there isn't already one)
@abatkin
abatkin / modules.txt
Created May 29, 2012 21:21
Vim modules
ack.vim
ctrlp.vim
tabular
vim-bad-whitespace
vim-buffergator
vim-colors-solarized
vim-powerline
vimwiki
ZoomWin
@abatkin
abatkin / 06-keys.zsh
Created June 21, 2012 03:54
ZSH keybindings
bindkey '^[[B' down-line-or-history
bindkey '^[[A' up-line-or-history
@abatkin
abatkin / .zshrc
Created June 21, 2012 03:52
My oh-my-zsh .zshrc
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="adambatkin"
# Example aliases
@abatkin
abatkin / adambatkin.zsh-theme
Created June 21, 2012 03:53
My oh-my-zsh theme
local return_code='%(?..%{$fg[red]%}%? ↵%{$reset_color%})'
local git_branch='$(git_prompt_status)%{$reset_color%}$(git_prompt_info)$(git_prompt_short_sha)'
ZSH_THEME_GIT_PROMPT_SHA_BEFORE=" %{$fg[red]%}("
ZSH_THEME_GIT_PROMPT_SHA_AFTER=")%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY=""
ZSH_THEME_GIT_PROMPT_CLEAN=""