Skip to content

Instantly share code, notes, and snippets.

View hellpanderrr's full-sized avatar
🎯
Focusing

hellpanderrr

🎯
Focusing
View GitHub Profile
@asmallteapot
asmallteapot / nginx.conf
Created March 14, 2012 19:00
My default Nginx configuration for serving Django projects.
# file: /etc/nginx/sites-available/example.com
# nginx configuration for example.com
server {
listen 80;
server_name example.com;
access_log /srv/www/example.com/logs/access.log;
error_log /srv/www/example.com/logs/error.log;
# pass root to django
@dwf
dwf / kmeans.pyx
Created March 25, 2012 22:18
Parallelized k-means in Cython.
"""
Parallelized k-means module.
By David Warde-Farley, February 2012. Licensed under the 3-clause BSD.
"""
cimport cython
from cython.parallel import prange
import numpy as np
cimport numpy as np
from numpy.random import normal
@pprett
pprett / grid_search.py
Created October 31, 2012 19:42
Parallel grid search for sklearn Gradient Boosting
"""Parallel grid search for sklearn's GradientBoosting.
This script uses IPython.parallel to run cross-validated
grid search on an IPython cluster. Each cell on the parameter grid
will be evaluated ``K`` times - results are stored in MongoDB.
The procedure tunes the number of trees ``n_estimators`` by averaging
the staged scores of the GBRT model averaged over all K folds.
You need an IPython ipcluster to connect to - for local use simply
@peterk87
peterk87 / hierarchical_clustering_num_clusters_vs_distances_plots.py
Created May 2, 2013 23:35
Python: Hierarchical clustering plot and number of clusters over distances plot
from scipy.spatial.distance import *
from scipy.cluster.hierarchy import *
import pandas as pd
import numpy
import matplotlib as plt
from matplotlib.pylab import figure
import pylab as pl
import pp
def num_clusters(hc, d):
@wting
wting / haskell.md
Last active April 1, 2020 10:50
Installing ghc, haskell-platform, cabal-install on Ubuntu 12.04.

Choices

  1. Install ghc 7.6.3 and Haskell Platform
  2. Install ghc 7.8.4 and Cabal

Option GHC 7.6.3 + Haskell Platform

GHC 7.6.3

Install Ubuntu 12.04 depencies:

@jsok
jsok / phantom.py
Created March 12, 2014 06:42
Use PhantomJS and Python Selenium bindings to take screenshots of websites.
import StringIO
from selenium import webdriver
from PIL import Image
# Install instructions
#
# npm install phantomjs
# sudo apt-get install libjpeg-dev
# pip install selenium pillow
@ahwillia
ahwillia / tensorflow_pca.py
Created October 27, 2016 07:25
PCA in TensorFlow
import numpy as np
import tensorflow as tf
# N, size of matrix. R, rank of data
N = 100
R = 5
# generate data
W_true = np.random.randn(N,R)
C_true = np.random.randn(R,N)
@romelgomez
romelgomez / development.ts
Created December 8, 2016 22:31
Express Server with TypeScript
import * as server from "./server";
new server.App
@rspeare
rspeare / p_values_for_logreg.py
Last active July 15, 2024 07:31
P values for sklearn logistic regression
from sklearn import linear_model
import numpy as np
import scipy.stats as stat
class LogisticReg:
"""
Wrapper Class for Logistic Regression which has the usual sklearn instance
in an attribute self.model, and pvalues, z scores and estimated
errors for each coefficient in
@rubinrot1
rubinrot1 / fl-deutsch.md
Last active January 5, 2024 00:55
fl-deutsch.md