Skip to content

Instantly share code, notes, and snippets.

View recamshak's full-sized avatar

Joël Billaud recamshak

View GitHub Profile
@recamshak
recamshak / gist:4124194
Created November 21, 2012 10:35
Install graphite in a virtualenv (for my webfaction server)
# this script will install whisper, carbon and graphite-web on the current directory
sudo apt-get python-dev
mkvirtualenv --system-site-packages graphite
pip install twisted
pip install django
pip install django-tagging
pip install gunicorn
@recamshak
recamshak / gist:8701280
Last active August 29, 2015 13:55
A Django filter to walk the file system tree. Convenient to include all your angular templates !
import os
import fnmatch
from django import template
register = template.Library()
@register.filter(is_safe=False)
def walk(top_path, glob='*'):
"""
Generate a list of filepath that match the `glob` pattern by walking
@recamshak
recamshak / sparse_memmap_dbscan.py
Last active August 2, 2022 17:21
sklearn DBSCAN with O(n) memory budget
from sklearn.datasets import make_blobs
from sklearn.cluster import dbscan
from sklearn.cluster._dbscan_inner import dbscan_inner
from sklearn.metrics import pairwise_distances_chunked
from scipy.sparse import csr_matrix
import numpy as np
# dataset
n = 50000
ds, _ = make_blobs(n, 100, 50)
use futures::{
channel::mpsc::{unbounded, UnboundedSender},
future, pin_mut, SinkExt, StreamExt,
};
use std::cell::RefCell;
use std::rc::Rc;
use std::{collections::HashMap, env, io::Error as IoError, net::SocketAddr};
use tokio::net::{TcpListener, TcpStream};
use tokio::task;
use tungstenite::error::Error;