Skip to content

Instantly share code, notes, and snippets.

View gerrich's full-sized avatar

Georgy Ivanov gerrich

View GitHub Profile
@gerrich
gerrich / gist:07935114dcf41590dcc3
Created July 16, 2015 21:48
R data.frame factor oneHot encoding
X = sparse.model.matrix(
as.formula(
paste("Hazard~", paste(colnames(ts.train), sep = "_", collapse=" +"))
), data = ts.train)
# performance monitor
nvidia-smi -q -g 0 -d UTILIZATION -l
@gerrich
gerrich / gist:3b6c847e82763cfff9ec
Created July 14, 2015 14:08
yum package files
yum install yum-utils
repoquery --list packagename
@gerrich
gerrich / gist:16263a9ab4f2af3d17e4
Created July 10, 2015 20:31
Python profile tools
#from http://thirld.com/blog/2014/11/30/visualizing-the-results-of-profiling-python-code/
pip install pyprof2calltree
#Profile your program as usual:
python -m cProfile -o prof.out mycode.py
#Then visualize the results in KCacheGrind:
pyprof2calltree -i prof.out -k
@gerrich
gerrich / splitline.js
Last active December 15, 2015 10:18 — forked from touv/splitline.js
#!/usr/bin/env node
process.stdin.resume();
process.stdin.setEncoding('utf8');
function line_reader(stream, call_back) {
var remainder = '';
stream.on('data', function (chunk) {
var lines = chunk.toString().split('\n');
lines.unshift(remainder + lines.shift());
@gerrich
gerrich / gist:5169404
Last active December 14, 2015 23:59
Use vim as lister for something not in system encoding
$ locale
LANG=en_US.UTF-8
$ cat file_in_cp1251 | vim --cmd ':set enc=cp1251' --cmd ':set tenc=utf8' -