Skip to content

Instantly share code, notes, and snippets.

@buritica
buritica / glossy.html
Last active August 29, 2015 14:01
Glossy JSON Spec
<script>
var namespace = 'onswipe';
var message = JSON.stringify({
view_url: '%%VIEW_URL_UNESC%%',
click_url: '%%CLICK_URL_UNESC%%%%DEST_URL%%',
cachebuster: '%%CACHEBUSTER%%',
glossy_id: 'my_id',
type: 'glossy',
pixels: []
});
@paulusm
paulusm / ipython.conf
Created January 19, 2013 21:22
Upstart conf for iPython web
start on runlevel [2345]
stop on runlevel [016]
respawn
setuid <user>
chdir /home/<user>/ipython_notebooks
exec ipython notebook --pylab --profile=nbserver --ipython-dir=/home/<user>/.ipython --log-level=DEBUG
@FrancescAlted
FrancescAlted / simple-key-store.py
Created January 14, 2016 12:54
A demonstration of a simple key-value store using numpy (.npz) and bcolz (ctable)
# Benchmark to compare the times for storing numpy arrays in a key-value.
# The main point is to compare numpy serialization vs a bcolz approach.
from __future__ import print_function
import sys
import os
import os.path
import subprocess
import getopt
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@creationix
creationix / run.js
Last active March 7, 2017 18:36
universal callback/continuable/thunk generator runner
function run(generator) {
// Pass in resume for no-wrap function calls
var iterator = generator(resume);
var data = null, yielded = false;
next();
check();
function next(item) {
var cont = iterator.next(item).value;
# Context manager to generate batches in the background via a process pool
# Usage:
#
# def batch(seed):
# .... # generate minibatch
# return minibatch
#
# with BatchGenCM(batch) as bg:
# minibatch = next(bg)
# .... # do something with minibatch
@d1manson
d1manson / images_in_pandas.md
Last active April 19, 2018 23:10
show images when displaying 2d arrays in iPython and Pandas

As of writing, this is only possible with my fork of pandas, but hopefully it will make its way into the main pandas stable branch.

The purpose of the fork is to let you specify a custom html formatter for individual columns in a data frame.


In this example we create a formatting function which takes a numpy array and returns a string of the form <img src='--base64-encoded-data'/>. This means that the numpy array is displayed as an image.

Below is the code we use to define our custom format function. Note that the function takes a single element from the data frame and returns and html string::

@patricksurry
patricksurry / README.md
Last active November 22, 2019 18:46
Illustrate embedding geojson/topojson geometry into a google maps overlay using d3.geo.projection.

Based on http://bl.ocks.org/mbostock/899711 which uses D3 to draw elements into a google maps overlay layer, but doesn't use d3.geo machinery to draw map geometry. This gist illustrates how to align a D3 mercator projection with google maps so we can do standard d3 mapping stuff on top of the google API.

@bartvm
bartvm / dl-frameworks.rst
Last active December 7, 2020 18:18
A comparison of deep learning frameworks

A comparison of Theano with other deep learning frameworks, highlighting a series of low-level design choices in no particular order.

Overview

Differentiation

Symbolic: Theano, CGT; Automatic: Torch, MXNet

Symbolic and automatic differentiation are often confused or used interchangeably, although their implementations are significantly different.

/*
Swift Programming Language Guide
"A Swift Tour" Solutions
https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/GuidedTour.html#//apple_ref/doc/uid/TP40014097-CH2-XID_1
These are the solutions to all the "experiments" in the pre-release Swift Programming Guide
(released on the same day Apple announced Swift). A couple of things worth noting:
1. Swift syntax, e.g. array declarations, has changed since I releasd these. So this code will
probably cause some errors when you paste it into a playground. Should be easy enough to fix