Skip to content

Instantly share code, notes, and snippets.

@roban
roban / AI_policy_panel_IAS.md
Last active June 7, 2023 06:31
Notes on "Steering AI for the Public Good: A Dialogue for the Future" panel (2023-06-06 at IAS)

"Steering AI for the Public Good: A Dialogue for the Future"

2023-06-06 at IAS

Youtube Recording

panel flyer

Panel

@jbarratt
jbarratt / nbgrep
Last active April 27, 2023 15:00
'nbgrep', search the code of all your ipython notebooks
#!/bin/bash
# usage: nbgrep 'pattern'
SEARCHPATH=~/work/
# 'jq' technique lifted with gratitude
# from https://gist.github.com/mlgill/5c55253a3bc84a96addf
# Break on newlines instead of any whitespace
@mblondel
mblondel / curve_averaging.py
Last active May 13, 2017 16:47
Variable-length curve averaging
"""Variable-length curve averaging"""
# Author: Mathieu Blondel <mathieu@mblondel.org>
# License: BSD 3 clause
import numpy as np
from scipy.interpolate import interp1d
def curves_mean_std(X, Y, kind="linear"):
['rg_di', 'rg_li'].forEach(function(cl){Array.prototype.slice.call(document.getElementsByClassName(cl)).forEach(function(el){el.style.margin = 0;});})
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@CFPBadmin
CFPBadmin / cfpb-source-code-policy.txt
Created April 9, 2012 13:54
Consumer Financial Protection Bureau Source Code Policy
1. USE OF EXTERNAL OPEN SOURCE SOFTWARE
a) "Open Source Software" (OSS) is software that allows its recipients to modify and redistribute the source code; as such, "open source" is a copyright and distribution framework and makes no implications regarding technical support or indemnification. In almost all cases, OSS meets the definition of "commercial computer software" and shall be given appropriate statutory preference in accordance with 41 USC 264B (reference (b)) (see also FAR 2.101(b), 12_1.html 12.000, 12.101 (reference (c))).
b) Executive agencies, including CFPB, are required to conduct market research when preparing for the procurement of products or services by 41 USC Sec. 253a (reference (e)) (see also FAR 10.001. Market research for software should include OSS.
a. There are several positive aspects of OSS that should compel CFPB to seek out OSS when conducting market research on software for Bureau-wide use:
i. Publicly available source code enables continuous and broad peer review that
from json import loads
from oauth2 import Client, Consumer, Token
from urllib import urlencode
class TumblrError(Exception):
"""Hold information about an error from the Tumblr API.
@param url: The C{str} URL that the API call used.
@param status: The C{int} HTTP status returned in the error.
@roban
roban / makemovie.sh
Created March 27, 2012 14:54
command I use to make a time lapse movie from a list of individual frames using mencoder
# first create a list of frames, perhaps by running:
# ls -tr *.JPG > frames.txt
# Now run mencoder to make the move. I adapted the configuration from
# http://blog.hugochinchilla.net/2011/09/time-lapse-videos-mencoder/
# playback at 15 frames per second
mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell:autoaspect:vqscale=3 -vf scale=1920:1440 -mf type=jpeg:fps=15 mf://@frames.txt -o time_lapse.avi
# playback at 30 frames per second
@agramfort
agramfort / ranking.py
Created March 18, 2012 13:10 — forked from fabianp/ranking.py
Pairwise ranking using scikit-learn LinearSVC
"""
Implementation of pairwise ranking using scikit-learn LinearSVC
Reference: "Large Margin Rank Boundaries for Ordinal Regression", R. Herbrich,
T. Graepel, K. Obermayer.
Authors: Fabian Pedregosa <fabian@fseoane.net>
Alexandre Gramfort <alexandre.gramfort@inria.fr>
"""
@soemarko
soemarko / theme.html
Created November 26, 2011 16:18
embed github gist to tumblr
<!-- Add the following lines to theme's html code right before </head> -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script src="http://static.tumblr.com/fpifyru/VCxlv9xwi/writecapture.js"></script>
<script src="http://static.tumblr.com/fpifyru/AKFlv9zdu/embedgist.js"></script>
<!--
Usage: just add <div class="gist">[gist URL]</div>
Example: <div class="gist">https://gist.github.com/1395926</div>
-->