Skip to content

Instantly share code, notes, and snippets.

View paulochf's full-sized avatar
⌨️

Paulo Haddad paulochf

⌨️
View GitHub Profile
@NorthIsUp
NorthIsUp / spawn.py
Created July 5, 2012 12:46
gevent spawn helpers
"""
realertime.lib.spawn
~~~~~~~~~~~~~~~~~~~~
:author: Adam Hitchcock
:copyright: (c) 2012 DISQUS.
:license: Apache License 2.0, see LICENSE for more details.
"""
from __future__ import absolute_import
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jnothman
jnothman / resample.py
Last active February 22, 2017 23:53
Scikit-learn resampling as CV wrapper
import numpy as np
class Resample(object):
def __init__(self, cv, method='under'):
self.cv = cv
self.method = method
def split(self, X, y, **kwargs):
for train_idx, test_idx in self.cv.split(X, y, **kwargs):
counts = np.bincount(y[train_idx]) # assumes y are from {0, 1..., n_classes-1}
@rozza
rozza / decorator.py
Created October 18, 2010 09:17
A decorator for django management commands that ensures only one process is running at any one time.
"""
A decorator for management commands (or any class method) to ensure that there is
only ever one process running the method at any one time.
Requires lockfile - (pip install lockfile)
Author: Ross Lawley
"""
import time
@davidbalbert
davidbalbert / pyqwt.sh
Last active June 22, 2019 19:59
PyQwt in a virtualenv
brew install qt # should already be done
brew install qwt # should already be done
brew install portaudio # should already be done
brew install wget # makes some downloading easier
# set up your virtualenv (`workon friture` if you've already created it)
mkvirtualenv friture
cd /tmp
@gagnec
gagnec / gist:5542288
Created May 8, 2013 18:05
Pika async consumer example
#!/usr/bin/env python26
import logging
import pika
logging.basicConfig()
class Consumer(object):
"""
A RabbitMQ topic exchange consumer that will call the specified function
@jiffyclub
jiffyclub / assert_frames_equal.ipynb
Last active October 27, 2020 17:02
Example of a function to compare two DataFrames independent of row/column ordering and with handling of null values.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lucasmarqs
lucasmarqs / .gitconfig
Last active December 1, 2020 22:05
My options for ~/.gitconfig
[user]
name = My name
email = my_github_email@example.com
[alias]
a = add
ap = add -p
can = commit -S --amend --no-edit
cm = commit -S -m
co = checkout
@powerlim2
powerlim2 / SKhelper.py
Last active January 11, 2021 18:35
This module is to ease your analysis with Scikit_Learn in Python. It gives a few functionalities that the current Scikit_Learn library does not offer. Please free to download and use it.
# coding=UTF8
#########################################################################
# This class is to help sklearn to handle statistical process #
# Author: Joon Lim from Master of Science in Analytics at Northwestern #
# Date: 04.23.2013 #
#########################################################################
''' this Module is built on top of numpy and sklearn. '''
@fperez
fperez / README.md
Last active July 1, 2021 04:43
Polyglot Data Science with IPython

Polyglot Data Science with IPython & friends

Author: Fernando Pérez.

A demonstration of how to use Python, Julia, Fortran and R cooperatively to analyze data, in the same process.

This is supported by the IPython kernel and a few extensions that take advantage of IPython's magic system to provide low-level integration between Python and other languages.

See the companion notebook for data preparation and setup.