Skip to content

Instantly share code, notes, and snippets.

View yoavram's full-sized avatar

Yoav Ram yoavram

View GitHub Profile
@DrDub
DrDub / selectfile.py
Created January 3, 2016 11:44
A file selection class build for ipywidgets without any extra dependencies.
import os
import ipywidgets as widgets
class FileBrowser(object):
def __init__(self):
self.path = os.getcwd()
self._update_files()
@cheuerde
cheuerde / paper_skeleton.txt
Last active March 26, 2017 13:42
Paper sekelton in Markdown - for use with pandoc. Export to Latex, PDF and Microsoft Word docx
[//]: # (Claas Heuer, November 2015)
[//]: # (Run pandoc like this)
[//]: # (pandoc --filter pandoc-crossref -s -S --bibliography references.bib paper_skeleton.txt -o test.docx)
[//]: # (pandoc --filter pandoc-crossref -s -S --bibliography references.bib paper_skeleton.txt -o test.pdf)
# First Section {#sec:first_section}
This is the first section and we are writing an equation that we want to reference to later in
the document:
@whophil
whophil / ipython-notebook.conf
Last active August 18, 2018 05:15
Upstart file (Ubuntu) for Jupyter / IPython notebook
start on filesystem or runlevel [2345]
stop on shutdown
description "Jupyter / IPython Notebook Upstart script"
script
export HOME="/home/phil/Notebooks"; cd $HOME
echo $$ > /var/run/ipython_start.pid
exec su -s /bin/sh -c 'exec "$0" "$@"' phil -- /home/phil/Enthought/Canopy_64bit/User/bin/jupyter-notebook --config='/home/phil/.jupyter/jupyter_notebook_config.py'
end script

Guidelines for contribution

This document described guidelines for contributions for projects led by members of the [Poisot lab of computational ecology][pl], Université de Montréal. It should be followed by lab members (at all times), as well as people with suggested added features, or willing to contribute enhancement or bug fixes.

Authorship

Any contribution to the code of a software grants authorship on the next paper

@olange
olange / graphviz-build-system-for-sublime.md
Created January 4, 2015 00:21
Graphviz (DOT) Build System for Sublime Text 2 and 3

To transform the currently opened Graphviz source file (in DOT Language) into a PNG:

{
    "cmd": [ "dot", "-Tpng", "-o", "$file_base_name.png", "$file"],
    "selector": "source.dot"
}

Usage

@Zulko
Zulko / bacterial_growth_animation.py
Last active December 15, 2020 17:36
Growing bacteria with population size analysis (Matplotlib/MoviePy)
"""
This script produces a video analysis proving for the first time in history
that bacterial populations grow exponentially. See the result here:
http://i.imgur.com/uoITKiA.gif
We proceed as follows:
- Download a video of bacteria growing under a microscope.
- Cut the video to keep only the first 7 seconds.
- Threshold each frame to find where the bacteria are, and compute the
#!/usr/bin/env python
"""
nbconcat: concatenate notebooks
Usage:
nbconcat nb1.py nb2.py [nb3.py...] > allmynbs.ipynb
requires IPython >= 3.0
"""
@brentp
brentp / betareg.py
Last active September 17, 2024 14:48
beta regression in statsmodels
# -*- coding: utf-8 -*-
u"""
Beta regression for modeling rates and proportions.
References
----------
Grün, Bettina, Ioannis Kosmidis, and Achim Zeileis. Extended beta regression
in R: Shaken, stirred, mixed, and partitioned. No. 2011-22. Working Papers in
Economics and Statistics, 2011.
@mbenford
mbenford / autosize.js
Created December 18, 2013 03:47
Autosize directive for AngularJS. Resizes an input field automatically so its content is always visible. http://plnkr.co/edit/iodg4SqKBXL0V6ZJmRue
app.directive('autosize', function($document) {
return {
require: 'ngModel',
link: function(scope, element, attrs, ctrl) {
var placeholder, span, resize;
placeholder = element.attr('placeholder') || '';
span = angular.element('<span></span>');
span[0].style.cssText = getComputedStyle(element[0]).cssText;
@dan-blanchard
dan-blanchard / .1.miniconda.md
Last active December 11, 2019 22:38
Quicker Travis builds that rely on numpy and scipy using Miniconda

For ETS's SKLL project, we found out the hard way that Travis-CI's support for numpy and scipy is pretty abysmal. There are pre-installed versions of numpy for some versions of Python, but those are seriously out of date, and scipy is not there are at all. The two most popular approaches for working around this are to (1) build everything from scratch, or (2) use apt-get to install more recent (but still out of date) versions of numpy and scipy. Both of these approaches lead to longer build times, and with the second approach, you still don't have the most recent versions of anything. To circumvent these issues, we've switched to using Miniconda (Anaconda's lightweight cousin) to install everything.

A template for installing a simple Python package that relies on numpy and scipy using Miniconda is provided below. Since it's a common s