Skip to content

Instantly share code, notes, and snippets.

View alexoliveira's full-sized avatar

Alexandre alexoliveira

  • Mountain View, California
View GitHub Profile
# from http://nbviewer.jupyter.org/github/ipython/ipython/blob/master/examples/IPython%20Kernel/Importing%20Notebooks.ipynb
import io, os, sys, types
import nbformat
from IPython import get_ipython
from IPython.core.interactiveshell import InteractiveShell
def find_notebook(fullname, path=None):
@alexoliveira
alexoliveira / 0_reuse_code.js
Created February 18, 2014 20:49
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@alexoliveira
alexoliveira / probability_repeated_combo.py
Created July 19, 2012 21:49
Probability of repeating same combination
choices = float(10**8)
p = 1
for i in range (1000):
p = p * (choices - i) / choices
from trees.models import Tree, Post, Member
from datetime import datetime, timedelta
def percentRetained():
'''Iterate over periods of 2 weeks, filter out all users who didn't add a post during that 2-weeks-period.
Start with particular group of two weeks, see who used it for that 2-week period.
For every period of two weeks, filter out people who are not'''
today = datetime.today()
experiment_duration = 7 * 4 * 3
retained_members = None