Skip to content

Instantly share code, notes, and snippets.

@jungle-boogie
jungle-boogie / gist:34d9eea4002551428b55
Last active August 29, 2015 14:22
csv.vim example for dynamic filter
id,name,account,date,type,state
00,chrisbra,github,06/12/2015,credit card,sale
00,chrisbra,github,06/13/2015,credit card,sale
00,chrisbra,github,06/14/2015,credit card,sale
00,chrisbra,github,06/15/2015,credit card,sale
00,chrisbra,github,06/17/2015,credit card,sale
00,chrisbra,github,06/18/2015,credit card,sale
00,chrisbra,github,06/19/2015,credit card,sale
00,chrisbra,github,06/20/2015,credit card,sale
00,chrisbra,github,06/21/2015,credit card,sale
@jungle-boogie
jungle-boogie / gist:f899acae799359f20711
Created June 15, 2015 01:54
sorting issue with csv.vim
trans_count,trans_amount,portal_fee,sum
70,3.50,16.50,20
291,14.55,5.45,20
583,29.15,0,29.15
694,34.70,0,34.7
67,3.35,16.65,20
4431,132.93,0,132.93
142,7.10,12.90,20
379,18.95,1.05,20
22,1.10,18.90,20
@jungle-boogie
jungle-boogie / gist:8ba3551519f21e04c99c
Created June 25, 2015 18:54
pivot table with csv.vim
Say I have data like this:
Merchant ID,Txn Type
30422,Sale
30430,Sale
30414,Sale
30391,Sale
30412,Sale
30402,Sale
30405,Sale
make
tclsh tools/assemble.tcl sqawk-dev.tcl > sqawk.tcl
tclsh tests.tcl
==== test1 Handle broken pipe, read from stdin FAILED
==== Contents of test case:
with-temp-files filename ch {
puts $ch "line 1\nline 2\nline 3"
% make
make -C dsls put_dsl_parse.o
gcc -o lemon lemon.c
./lemon put_dsl_parse.y
mv put_dsl_parse.c put_dsl_parse.c.tmp
sed -e 's/ParseTrace/put_dsl_ParseTrace/g' -e 's/ParseTokenName/put_dsl_ParseTokenName/g' -e 's/lemon_parser_alloc/put_dsl_lemon_parser_alloc/g' -e 's/lemon_parser_free/put_dsl_lemon_parser_free/g' -e 's/lemon_parser_parse_token/put_dsl_lemon_parser_parse_token/g' -e 's/yy_destructor/put_dsl_yy_destructor/g' put_dsl_parse.c.tmp > put_dsl_parse.c
rm -f put_dsl_parse.c.tmp
gcc -I.. -O3 -c -std=gnu99 put_dsl_parse.c
make -C dsls put_dsl_lexer.o
flex --prefix=put_dsl_lexer_ --outfile=put_dsl_lexer.c --header-file=put_dsl_lexer.h put_dsl_lexer.l
make -C dsls put_dsl_parse.o
gcc -o lemon lemon.c
./lemon put_dsl_parse.y
mv put_dsl_parse.c put_dsl_parse.c.tmp
sed -e 's/ParseTrace/put_dsl_ParseTrace/g' -e 's/ParseTokenName/put_dsl_ParseTokenName/g' -e 's/lemon_parser_alloc/put_dsl_lemon_parser_alloc/g' -e 's/lemon_parser_free/put_dsl_lemon_parser_free/g' -e 's/lemon_parser_parse_token/put_dsl_lemon_parser_parse_token/g' -e 's/yy_destructor/put_dsl_yy_destructor/g' put_dsl_parse.c.tmp > put_dsl_parse.c
rm -f put_dsl_parse.c.tmp
gcc -I.. -O3 -c -std=gnu99 put_dsl_parse.c
make -C dsls put_dsl_lexer.o
flex --prefix=put_dsl_lexer_ --outfile=put_dsl_lexer.c --header-file=put_dsl_lexer.h put_dsl_lexer.l
gcc -I.. -O3 -c -std=gnu99 put_dsl_lexer.c
make -C dsls put_dsl_parse.o
clang -o lemon lemon.c
lemon.c:2277:8: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
static preprocess_input(char *z){
~~~~~~ ^
lemon.c:2327:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
lemon.c:2863:6: warning: use of out-of-scope declaration of 'access'
if (access(buf,004)==0) {
% sh test/run
test/../mlr cat test/input/abixy
test/../mlr cat /dev/null
test/../mlr cut -f a,x test/input/abixy
test/../mlr cut --complement -f a,x test/input/abixy
test/../mlr having-fields --at-least a,b test/input/abixy
test/../mlr having-fields --at-least a,c test/input/abixy
test/../mlr having-fields --at-least a,b,i,x,y test/input/abixy
test/../mlr having-fields --which-are a,b,i,x test/input/abixy
@jungle-boogie
jungle-boogie / makefile_fail.log
Created August 31, 2015 14:46
build failure on Linux debian 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u3 (2015-08-04) x86_64 GNU/Linux
$ make
make -C dsls put_dsl_parse.o
make[1]: Entering directory '/home/jungle/bin/miller/c/dsls'
gcc -o lemon lemon.c
./lemon put_dsl_parse.y
mv put_dsl_parse.c put_dsl_parse.c.tmp
sed \
-e 's/ParseTrace/put_dsl_ParseTrace/g' \
-e 's/ParseTokenName/put_dsl_ParseTokenName/g' \
-e 's/lemon_parser_alloc/put_dsl_lemon_parser_alloc/g' \
% make
tclsh tools/assemble.tcl sqawk-dev.tcl > sqawk.tcl
tclsh tests.tcl
==== test1 Handle broken pipe, read from stdin FAILED
==== Contents of test case:
with-temp-files filename ch {
puts $ch "line 1\nline 2\nline 3"