Skip to content

Instantly share code, notes, and snippets.

View iborko's full-sized avatar

Ivan Borko iborko

View GitHub Profile
@iborko
iborko / escape_json.c
Last active January 16, 2020 14:05
uWSGI plugin that creates custom json-escaped logging variables
/*
uWSGI plugin that creates custom json-escaped logging variables.
build plugin with `uwsgi --build-plugin <filename.c>`
and use it with `uwsgi --plugin <filename_plugin.so> ...`
*/
#include <uwsgi.h>
static ssize_t uwsgi_lf_json_uri(struct wsgi_request *wsgi_req, char **buf) {
@iborko
iborko / zca
Created July 5, 2015 15:56
ZCA implementation in python/numpy
def zca_whiten(X):
"""
Applies ZCA whitening to the data (X)
http://xcorr.net/2011/05/27/whiten-a-matrix-matlab-code/
X: numpy 2d array
input data, rows are data points, columns are features
Returns: ZCA whitened 2d array
"""