Skip to content

Instantly share code, notes, and snippets.

function! Comment()
silent s/^/\=escape(b:comment_leader,'\/')
nohlsearch
endfunction
function! Freqs2(list)
let freqs = {}
call map(copy(a:list), 'extend(freqs, { v:val : 0 })')
" for line in getline(1, '$')
" call map(freqs, 'v:val + ( line =~ ''\<'' . v:key . ''\>'' )')
" endfor
call map(getline(1, '$'), 'map(freqs, "v:val + (''" . v:val . "'' =~ ''\\<'' . v:key . ''\\>'' )")')
return freqs
endfunction
usage(){
printf '%s\n\n' \
"Usage: `basename $0` [env] [logger] [level]" \
"[env] : ${envList[@]}" \
"[logger] : ${loggerList[@]}" \
"[level] : ${levelList[@]}"
return
}
@Osse
Osse / open.sh
Last active January 3, 2016 14:19
partial='confirm/sample_request_'
# Put all matches into array
files=("$partial"*.json)
# Strip the leading stuff
tmp=("${files[@]#$partial}")
# Strip the trailing stuff
keys=("${tmp[@]%.json}")
@Osse
Osse / gist:7099481
Created October 22, 2013 12:10 — forked from mhinz/gist:7098910
function! s:set_cursor() abort
let s:oldline = exists('s:newline') ? s:newline : 5
let s:newline = line('.')
let headoff = s:headoff + 2 + s:secoff
" going BOTH WAYS !!!!
let direction = 2 * (s:newline > s:oldline) - 1
while index(s:section_header_lines, s:newline) != -1
let s:newline += direction
endwhile
@Osse
Osse / gist:5280101
Last active December 15, 2015 15:09 — forked from anonymous/gist:5280097
command=( /sbin/iptables -A allowed-connection -i wlan0 -m limit -j LOG --log-prefix "Bad packet from wlan0:" )
"${command[@]}"
@Osse
Osse / gist:4037147
Created November 8, 2012 06:10 — forked from dahu/gist:3986511
Vim Motions
Large Object Motions:
( ) { }
[[ [] ][ ]]
[m [M ]m ]M
[( ]) [{ ]}
Word Motions:
w W e E
b B ge gE
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 / vimrc
Created July 3, 2012 04:58
Easier to read than the original
if neocomplcache#sources#snippets_complete#jumpable()
imap <expr><C-j> "\<Plug>(neocomplcache_snippets_jump)"
imap <expr><C-k> "\<Plug>(neocomplcache_snippets_jump)"
endif