Skip to content

Instantly share code, notes, and snippets.

View nicolashery's full-sized avatar

Nicolas Hery nicolashery

View GitHub Profile
@nicolashery
nicolashery / pandas-heroku.md
Created September 8, 2012 22:35
Deploy Python app using Pandas on Heroku

Deploy Python app using Pandas on Heroku

2012-09-08

This document explains how to deploy a Python app that uses the Pandas library on Heroku.

Heroku builds Numpy (one of Pandas' requirements) fine. However, when trying to deploy an app with both numpy and pandas in its requirements.txt file (or even just pandas), for some reason it fails

@nicolashery
nicolashery / README.md
Created September 21, 2012 14:48
Python development web server for Windows

Python development web server for Windows

This is a simple Python script to serve static files from any project directory, useful when doing web development.

Usage

Simply put server.py and server.cmd in a directory, for instance C:\Users\YourName\bin and add that directory to your PATH.

Then in the console, cd to your project folder, type server and hit Enter (it will run on port 8000 by default, use server 5000 for example to change port). Use Ctrl+C to stop the server.

@nicolashery
nicolashery / README.md
Created October 18, 2012 20:52
Python setup on Windows

Python setup on Windows

Last updated: Oct 2012

This document is a step-by-step walkthrough on how to set up Python and various tools on a Windows 7 environment.

The primary goal is to have a Python setup that can be used for data analysis, but some more general tools are also installed.

Console2

@nicolashery
nicolashery / choco.txt
Created December 5, 2012 15:18
Chocolatey v0.9.8.20 testing
Windows PowerShell
Copyright (C) 2012 Microsoft Corporation. All rights reserved.
> chocolatey update -pre
The most recent version of chocolatey available from '-Source "http://chocolatey.org/api/v2/" -Source "https://go.microsoft.com/fwlink/?LinkID=230477" ' (if value is empty, using sources in nuget.config file) is 0.9.8.20-beta1. On your machine you have 0.9.8.19 installed.
=====================================================
Chocolatey (0.9.8.19) is installing chocolatey to "C:\Chocolatey\lib". By installing you accept the license for the
package you are installing (please run chocolatey /? for full license acceptance terms).
=====================================================
@nicolashery
nicolashery / mongoose-paginate.js
Last active January 24, 2018 13:02 — forked from craftgear/mongoose_paginate.coffee
Mongoose Paginate plugin
/* Mongoose Paginate plugin
Forked from:
https://gist.github.com/craftgear/1525918
This snippet is inspired by edwardhotchkiss's mongoose-paginate
(https://github.com/edwardhotchkiss/mongoose-paginate)
and works with any methods like where, desc, populate, etc.
The `paginate` method must be called at the end of method chains.
@nicolashery
nicolashery / markdown-cheat-sheet.md
Last active December 18, 2015 07:48
Markdown cheat sheet

Markdown cheat sheet

# Header 1

## Header 2

### Header 3

This is a paragraph.
@nicolashery
nicolashery / environment-variables-jekyll-templates.md
Last active January 22, 2023 15:56
Make environment variables available in Jekyll Liquid templates

Environment variables in Jekyll templates

This is one way to pass some data (API tokens, etc.) to your Jekyll templates without putting it in your _config.yml file (which is likely to be committed in your GitHub repository).

Copy the environment_variables.rb plugin to your _plugins folder, and add any environment variable you wish to have available on the site.config object.

In a Liquid template, that information will be available through the site object. For example, _layouts/default.html could contain:

@nicolashery
nicolashery / solarized-dark.css
Last active March 25, 2022 08:38 — forked from scotu/solarized.css
Solarized theme stylesheets for Jekyll and Pygments
/* Solarized Dark
For use with Jekyll and Pygments
http://ethanschoonover.com/solarized
SOLARIZED HEX ROLE
--------- -------- ------------------------------------------
base03 #002b36 background
base01 #586e75 comments / secondary content
@nicolashery
nicolashery / poisson.js
Created June 28, 2013 14:52
Quick JavaScript implementation of Exponential and Geometric random number generators
/* Quick implementation of Exponential and Geometric random number generators
For example you can use it to simulate when an event is going to happen next, given its average rate:
Buses arrive every 30 minutes on average, so that's an average rate of 2 per hour.
I arrive at the bus station, I can use this to generate the next bus ETA:
randomExponential(2); // => 0.3213031016466269 hours, i.e. 19 minutes
*/
@nicolashery
nicolashery / example.js
Last active April 4, 2023 11:56
Combine a pipe of multiple Node.js streams into one stream
var util = require('util')
, Transform = require('stream').Transform
, StreamCombiner = require('./streamcombiner');
var chunks1 = [];
var stream1 = new Transform();
var soFar = '';
stream1._transform = function(chunk, encoding, done) {
chunks1.push(chunk.toString());
var pieces = (soFar + chunk).split('\n');