Skip to content

Instantly share code, notes, and snippets.

View abatkin's full-sized avatar

Adam Batkin abatkin

View GitHub Profile
@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 / 10-env.zsh
Created June 21, 2012 03:55
ZSH environment variables
export EDITOR=vim
export VISUAL=vim
export PAGER=less
# Also setup JAVA_HOME, ANT_HOME, PATH
@abatkin
abatkin / 20-aliases.zsh
Created June 21, 2012 03:55
ZSH aliases
alias ant='ant -logger org.apache.tools.ant.listener.AnsiColorLogger'
alias ll='ls --color=tty -lrt'
alias kde=". ~/kde/env.sh && cd ~/kde/src"
alias vi=vim
@abatkin
abatkin / .vimrc
Created June 21, 2012 03:57
Home vimrc (on linux)
call pathogen#infect()
syntax enable
filetype plugin indent on
set nocompatible
"if filereadable("$VIMRUNTIME/mswin.vim")
:so $VIMRUNTIME/mswin.vim
"endif
:behave mswin
@abatkin
abatkin / id_rsa.pub
Created September 25, 2012 00:07
ssh public key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDw8vdRpf7ZpKf+eA3+Ify8ZMzFbUb0DoOZkRYHT9rQ7Rtjs3sB6bl5GgfKGX4y0cj8EiGmiPpsIylASEWeZKpf28stPDulc+pcr8we+A6XIuXPo1z8D4MLKXwg79XcHpa+Jr7OWef3JtkF5lv0z8Tpfr/nNyM/XcB9Opzawmz7sbtTVbEYnIMzPFvz5PgGFdm4yWO242yTuBMD5eLvldCpfeHQFRmohTkjVKJtDbjybVA2o6Mc8LS2K8E0mWTdo/V/fyR2MM/ekBfBXwLFkRusxQSC+3lpoFyQM++95f3DkID4HUUJTGUuDTEUZOr1u98HLtDTkucrgnLkfbC2Kvj abatkin@alpha.batkin.net
@abatkin
abatkin / School.java
Created February 15, 2013 13:20
School class with hashCode() and equals() From a challenge at http://beust.com/weblog/2013/02/13/coding-challenge-light-edition/
/*
* A few assumptions:
* * School is immutable (otherwise, implementing hashCode/equals doesn't really make sense)
* * The problem is incompletely specified, with respect to how to handle missing values:
* * What do you do when both name and nickname are null?
* * What if one School has a name + nickname and the other has just a name, but the names match?
* My decision (and I think this is reasonable) is: Both must match. If a value is null in one,
* it must be null in the other to be considered equal
*/
class School {
@abatkin
abatkin / listize.vim
Created May 6, 2013 02:42
Map \q to quote each line Map \j to join lines with a comma Map \s to quote and join all lines Works in visual mode only Great for taking a list of things and quoting for use in an SQL query
vnoremap <leader>q :<c-u>call <SID>QuoteLines()<cr>
vnoremap <leader>j :<c-u>call <SID>JoinLines()<cr>
vmap <leader>s <leader>qgv<leader>j
function! s:JoinLines()
silent! execute "normal! gv:\<c-u>'<,'>-1s/\\v$/,/g\<cr>gvJ"
endfunction
function! s:QuoteLines()
silent! execute "normal! gv:s/\\v(^\\s*)([^[:space:]].{-})(\\s*$)/\\1'\\2'\\3/\<CR>"
@abatkin
abatkin / basic-system.md
Last active March 23, 2019 15:12
Make Gnome 3.0 Usable (Fedora 20)

Basic System

This set of documents explains how I make a "usable" developer system using Fedora under various desktop environments. This was all tested with Fedora 20.

  • Update all packages
  • Fix dumb GTK+ 3 Scrollbar behavior:
# http://askubuntu.com/questions/295988/how-to-fix-gtk3-scrollbar-behavior
# https://bugzilla.gnome.org/show_bug.cgi?id=683885
# Add to .config/gtk-3.0/settings.ini:
@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 / README.md
Last active April 27, 2016 04:47
XFCE on Fedora 23

Introduction

This is my description of what I did to customize a base install of the Fedora 23 XFCE spin to my needs.

Installation

Apparently there is some sort of bug the the Nouveau driver with dual monitors (at least on the GTX 750). So step 1 was to unplug one of my monitors. I didn't really customize anything, but as soon as it was done installing, I installed the propriatary NVidia drivers. I'm a big Free Software fan, but sometimes I need to Get Things Done and the fact is that the Nouveau drivers kinda suck (also they don't work in my setup).