Skip to content

Instantly share code, notes, and snippets.

View mattjj's full-sized avatar

Matthew Johnson mattjj

View GitHub Profile
@timvieira
timvieira / make-wrapper.bash
Created November 19, 2016 19:38
Make wrapper - Guesses what I meant when there was no Makefile in the current directory.
function yellow { echo -e "\e[33m$@\e[0m"; }
# Wrapper around make, which covers building different project types, when an
# actual Makefile isn't present.
function make {
if [[ -e Makefile ]]; then
yellow "[make] found Makefile"
/usr/bin/make $@
else
yellow "[make] No Makefile found"
@mikelove
mikelove / tsne.R
Last active April 6, 2024 01:11
Exploring behavior of t-SNE on linear data
n <- 200
m <- 40
set.seed(1)
x <- runif(n, -1, 1)
library(rafalib)
bigpar(2,2,mar=c(3,3,3,1))
library(RColorBrewer)
cols <- brewer.pal(11, "Spectral")[as.integer(cut(x, 11))]
plot(x, rep(0,n), ylim=c(-1,1), yaxt="n", xlab="", ylab="",
col=cols, pch=20, main="underlying data")
@duvenaud
duvenaud / gist:ed9467186db9ce67333badde9613e330
Created April 27, 2016 20:06
Nice transparent densities overlaid
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap
from scipy.stats import norm
def plot_transparent_hexbin(ax, x, y, c, color):
cdict = {'red': ((0., color[0], color[0]), (1., color[0], color[0])),
'green': ((0., color[1], color[1]), (1., color[1], color[1])),
'blue': ((0., color[2], color[2]), (1., color[2], color[2])),
'alpha': ((0., 0., 0.), (1., 1., 1.))}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@adamnew123456
adamnew123456 / pyc.py
Last active June 10, 2024 07:12
Using Inline C Code In Python Programs
"""
Inserts C code directly into Python files, which can then be dynamically linked
in and called via ctypes.
"""
import atexit
import ctypes
import os
import shlex
import sys
import tempfile
@johnmyleswhite
johnmyleswhite / gist:14dbd928019669faef82
Last active August 29, 2015 14:06
Benchmarking Resources
@bitemyapp
bitemyapp / gist:8739525
Last active May 7, 2021 23:22
Learning Haskell
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active July 17, 2024 14:20
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@jboner
jboner / latency.txt
Last active July 23, 2024 14:12
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD