Skip to content

Instantly share code, notes, and snippets.

View escherba's full-sized avatar

Eugene Scherba escherba

View GitHub Profile
"""
This tests issue https://github.com/scikit-learn/scikit-learn/issues/3835
"""
import time
import itertools
import joblib
from math import ceil
from multiprocessing import Pool, cpu_count
from functools import partial
@escherba
escherba / cities.json
Created May 15, 2019 21:34 — forked from joshgeller/cities.json
1000 Largest US Cities By Population With Geographic Coordinates and Timezone, in JSON
[
{
"city": "New York",
"growth_from_2000_to_2013": "4.80%",
"latitude": 40.7127837,
"longitude": -74.0059413,
"population": 8405837,
"rank": 1,
"state": "New York",
"timezone": "America/New_York"
@escherba
escherba / install.sh
Created December 24, 2016 21:14 — forked from wdullaer/install.sh
Install Latest Docker and Docker-compose on Ubuntu
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
# sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
### Keybase proof
I hereby claim:
* I am escherba on github.
* I am etangent (https://keybase.io/etangent) on keybase.
* I have a public key whose fingerprint is 4191 7845 CFC0 8A8C D122 5D1F 3C87 6168 7E41 8426
To claim this, I am signing this object:
@escherba
escherba / letor_metrics.py
Created June 1, 2016 19:13 — forked from mblondel/letor_metrics.py
Learning to rank metrics.
# (C) Mathieu Blondel, November 2013
# License: BSD 3 clause
import numpy as np
def ranking_precision_score(y_true, y_score, k=10):
"""Precision at rank k
Parameters
@escherba
escherba / rank_metrics.py
Created May 31, 2016 22:34 — forked from bwhite/rank_metrics.py
Ranking Metrics
"""Information Retrieval metrics
Useful Resources:
http://www.cs.utexas.edu/~mooney/ir-course/slides/Evaluation.ppt
http://www.nii.ac.jp/TechReports/05-014E.pdf
http://www.stanford.edu/class/cs276/handouts/EvaluationNew-handout-6-per.pdf
http://hal.archives-ouvertes.fr/docs/00/72/67/60/PDF/07-busa-fekete.pdf
Learning to Rank for Information Retrieval (Tie-Yan Liu)
"""
import numpy as np
@escherba
escherba / hellinger.py
Last active March 31, 2016 21:29 — forked from larsmans/hellinger.py
Hellinger distance for discrete probability distributions in Python
"""
Three ways of computing the Hellinger distance between two discrete
probability distributions using NumPy and SciPy.
"""
import numpy as np
from scipy.linalg import norm
from scipy.spatial.distance import euclidean
@escherba
escherba / freeglut_mavericks
Last active August 29, 2015 14:02
allow compilation of freeglut on mavericks
diff -ur org/freeglut-2.8.1/progs/demos/smooth_opengl3/smooth_opengl3.c freeglut-2.8.1/progs/demos/smooth_opengl3/smooth_opengl3.c
--- org/freeglut-2.8.1/progs/demos/smooth_opengl3/smooth_opengl3.c 2014-06-01 21:27:45.000000000 -0700
+++ freeglut-2.8.1/progs/demos/smooth_opengl3/smooth_opengl3.c 2014-06-01 21:28:00.000000000 -0700
@@ -102,12 +102,9 @@
typedef void (APIENTRY *PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays);
typedef void (APIENTRY *PFNGLBINDVERTEXARRAYPROC) (GLuint array);
#endif
-#ifndef GL_VERSION_1_5
typedef void (APIENTRY *PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
typedef void (APIENTRY *PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
@escherba
escherba / freeglut_mac
Created June 2, 2014 04:23
freeglut (existing patch for compilation on Mac OS X using Homebrew)
diff -ur org/freeglut-2.8.1/include/GL/freeglut_std.h freeglut-2.8.1/include/GL/freeglut_std.h
--- org/freeglut-2.8.1/include/GL/freeglut_std.h
+++ freeglut-2.8.1/include/GL/freeglut_std.h
@@ -122,7 +122,7 @@
* Always include OpenGL and GLU headers
*/
#if __APPLE__
-# include <OpenGL/gl.h>
+# include <OpenGL/gl3.h>
# include <OpenGL/glu.h>
@escherba
escherba / zbar_jpeg
Created March 6, 2014 21:43
Fix JPEG handling using patch from http://sourceforge.net/p/zbar/discussion/664596/thread/58b8d79b#8f67 (already applied upstream but not present in the 0.10 release)
diff --git a/zbar/jpeg.c b/zbar/jpeg.c
index fb566f4..d1c1fb2 100644
--- a/zbar/jpeg.c
+++ b/zbar/jpeg.c
@@ -79,8 +79,15 @@ int fill_input_buffer (j_decompress_ptr cinfo)
void skip_input_data (j_decompress_ptr cinfo,
long num_bytes)
{
- cinfo->src->next_input_byte = NULL;
- cinfo->src->bytes_in_buffer = 0;