Skip to content

Instantly share code, notes, and snippets.

View Osse's full-sized avatar

Øystein Walle Osse

View GitHub Profile
@Osse
Osse / .zshrc
Created September 8, 2012 12:42
vcs info hack
function precmd() {
if [[ -z $(git ls-files --others --exclude-standard 2> /dev/null) ]] {
zstyle ':vcs_info:*' formats '%F{72}[%b%c%u%F{72}]%f'
} else {
zstyle ':vcs_info:*' formats '%F{72}[%b%c%u%F{red}•%F{72}]%f'
}
vcs_info
}
@Osse
Osse / stdout
Created September 8, 2012 22:35
Seperate sorting
TODO
A
E
G
X
F
DONE
TODO
1
@Osse
Osse / .tmux.conf
Created September 12, 2012 07:20
tmux remote
if-shell '[ -n "$SSH_CONNECTION" ]' 'set-option -g status-bg yellow; set-option -g status-fg black'
@Osse
Osse / list.vim
Created September 13, 2012 08:25
Unflatten a list
let myList = [ 'a', 'b', 'c', 'd', 'e', 'f' ]
for i in range(0,len(myList)/3 - 1)
let myList[i] = myList[i : i+2]
call remove(myList, i+1,i+2)
endfor
use Term::ANSIColor qw(:constants);
use 5.010;
while (<STDIN>) {
my @words = split(' ');
foreach (@words) {
s/^chr/kr/;
s/c/k/g;
s/ti/sj/;
@Osse
Osse / stdout
Created September 19, 2012 16:02
Grep output error
osse@osse-w760:~/Pr/bash[master•]$ grep '\(get_name_for\|file\|programming\|report\|parser\|fatal\|sys\|internal\|command\)_error' *[ch]
array.c:fatal_error(const char *s, ...)
array.c:programming_error(const char *s, ...)
arrayfunc.c: report_error (_("%s: cannot convert indexed to associative array"), name);
arrayfunc.c: report_error (_("%s: invalid associative array key"), w);
arrayfunc.c: report_error (_("%s: cannot assign to non-numeric index"), w);
arrayfunc.c: report_error (_("%s: %s: must use subscript when assigning associative array"), var->name, w);
bashhist.c: internal_error ("%s", history_value);
bashline.c: internal_error (_("bash_execute_unix_command: cannot find keymap for command"));
braces.c: report_error ("no closing `%c' in %s", '}', text);
@Osse
Osse / indentplix.vim
Created October 4, 2012 16:26
Indent plix
function! IndentPlix()
let line = getline('.')
if line =~ '^\t*$'
return "\<tab>"
else
let length = strdisplaywidth(line)
let spaces = &ts - (length % &ts)
return repeat(' ', spaces)
endif
endfunction
@Osse
Osse / latest.sh
Created October 9, 2012 16:20
Remove oldies
unset -v latestpdf latestcsv
set extglob
for file in *.pdf; do
[[ "$file" -nt "$latestpdf" ]] && latestpdf="$file"
done
for file in *.csv; do
[[ "$file" -nt "$latestcsv" ]] && latestcsv="$file"
done
@Osse
Osse / .zshrc
Created October 9, 2012 18:44
zstyle -L output
zstyle ':vcs_info:*' actionformats '%F{72}[%b%c%u%F{72}]%f YAAY'
zstyle ':vcs_info:*' check-for-changes true
zstyle ':completion:*:sudo:*' command-path /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/X11R6/bin
zstyle ':completion:*' completer _expand _complete _ignored
zstyle ':vcs_info:*' enable git
zstyle ':completion:*' expand prefix suffix
zstyle ':completion:*' file-sort name
zstyle ':completion:*' format '%BCompleting %d%b'
zstyle ':vcs_info:*:' formats '%F{72}[%b%c%u%F{72}]%f'
zstyle ':vcs_info:*:dirty:*' formats '%F{72}[%b%c%u%F{red}•%F{72}]%f'
@Osse
Osse / gist:3900760
Created October 16, 2012 17:35
output
$ cat .vimrc
filetype plugin indent on
syntax enable
colorscheme black_angus
$ ls -R .vim
.vim:
colors
.vim/colors:
black_angus.vim