Skip to content

Instantly share code, notes, and snippets.

Principles of Adult Behavior

  1. Be patient. No matter what.
  2. Don’t badmouth: Assign responsibility, not blame. Say nothing of another you wouldn’t say to him.
  3. Never assume the motives of others are, to them, less noble than yours are to you.
  4. Expand your sense of the possible.
  5. Don’t trouble yourself with matters you truly cannot change.
  6. Expect no more of anyone than you can deliver yourself.
  7. Tolerate ambiguity.
  8. Laugh at yourself frequently.
@GaelVaroquaux
GaelVaroquaux / gist:33e7a7b297425890fefa
Created July 10, 2015 14:07
Notes from reproducible machine learning discussion at ICML 2015 MLOSS workshop

Introductory quote:

"Machine learning people use hugely complex algorithms on trivially simple datasets. Biology does trivially simple algorithms on hugely complex datasets."

Concepts of reproducible science

  • Replicability
@edwardhotchkiss
edwardhotchkiss / Makefile
Created March 5, 2014 23:30
ATtiny85 avr-gcc / avrdude Makefile
DEVICE = attiny85
CLOCK = 8000000
PROGRAMMER = stk500v1
PORT = /dev/tty.usbmodem1421
BAUD = 19200
FILENAME = main
COMPILE = avr-gcc -Wall -Os -DF_CPU=$(CLOCK) -mmcu=$(DEVICE)
all: usb clean build upload
@brianckeegan
brianckeegan / backbone_extractor.py
Last active August 2, 2023 19:26
Given a networkx graph containing weighted edges and a threshold parameter alpha, this code will return another networkx graph with the "backbone" of the graph containing a subset of weighted edges that fall above the threshold following the method in Serrano et al. 2008.
# Serrano, Boguna, Vespigani backbone extractor
# from http://www.pnas.org/content/106/16/6483.abstract
# Thanks to Michael Conover and Qian Zhang at Indiana with help on earlier versions
# Thanks to Clay Davis for pointing out an error
import networkx as nx
import numpy as np
def extract_backbone(g, weight='weight', alpha=.05):
backbone_graph = nx.Graph()
@jexp
jexp / cypher.js
Created January 19, 2014 15:44
Javascript Snippet to simply access transactional Cypher Http endpoint of the Neo4j Server (see http://docs.neo4j.org/chunked/milestone/rest-api-transactional.html)
var r=require("request")
function cypher(query,params,cb) {
r.post({uri:"http://localhost:7474/db/data/transaction/commit",
json:{statements:[{statement:query,parameters:params}]}},
function(err,res) { cb(err,res.body)})
}
var query="MATCH (n:User) RETURN n, labels(n) as l LIMIT {limit}"
var params={limit: 10}
var cb=function(err,data) { console.log(JSON.stringify(data)) }
@panisson
panisson / ncp.py
Last active June 9, 2020 01:44
Nonnegative Tensor Factorization, based on the Matlab source code available at Jingu Kim's home page: https://sites.google.com/site/jingukim/home#ntfcode Requires the installation of Numpy and Scikit-Tensor (https://github.com/mnick/scikit-tensor). For examples, see main() function.
# Copyright (C) 2013 Istituto per l'Interscambio Scientifico I.S.I.
# You can contact us by email (isi@isi.it) or write to:
# ISI Foundation, Via Alassio 11/c, 10126 Torino, Italy.
#
# This work is licensed under a Creative Commons 4.0
# Attribution-NonCommercial-ShareAlike License
# You may obtain a copy of the License at
# http://creativecommons.org/licenses/by-nc-sa/4.0/
#
# This program was written by Andre Panisson <panisson@gmail.com> at
@mblondel
mblondel / matrix_sketch.py
Last active February 13, 2019 09:26
Frequent directions algorithm for matrix sketching.
# (C) Mathieu Blondel, November 2013
# License: BSD 3 clause
import numpy as np
from scipy.linalg import svd
def frequent_directions(A, ell, verbose=False):
"""
Return the sketch of matrix A.
@tdhopper
tdhopper / gist:6356555
Last active December 21, 2015 19:49
Code for unshortening a list of shortened URLs using unshort.me and unshorten.it's APIs.
# Used for unshortening list of urls as wel as checking the HTTP status code of a webpage.
# When called from the command line, requires either a filename or STDIN as input
# Filename or standard input should contain one URL per line
# Output is printed to the standard out and saved to a JSON file using PickleDB.
__author__ = "Tim Hopper"
__email__ = "tdhopper@gmail.com"
import fileinput
import urllib2
@informationsea
informationsea / xgmml_networkx.py
Created December 14, 2012 12:01
XGMML importer and exporter for networkx
__author__ = "Yasunobu OKAMURA"
__copyright__ = "Copyright (c) 2012 Y.Okamura"
__license__ = "GPL v3+"
import xml.parsers.expat
import networkx as nx
class XGMMLParserHelper(object):
"""
"""
@dartar
dartar / scholar.py
Created May 19, 2012 16:49
Modified version of scholar.py (a python Google Scholar parser by Christian Kreibich) exposing direct PDF download URL when available
#! /usr/bin/env python
"""
This module provides classes for querying Google Scholar and parsing
returned results. It currently *only* processes the first results
page. It is not a recursive crawler.
"""
# Version: 1.3 -- $Date: 2012-02-01 16:51:16 -0800 (Wed, 01 Feb 2012) $
#
# ChangeLog
# ---------