Skip to content

Instantly share code, notes, and snippets.

@brendano
brendano / autolog.py
Created October 10, 2008 23:00
python decorators to log all method calls, show call graphs in realtime too
# Written by Brendan O'Connor, brenocon@gmail.com, www.anyall.org
# * Originally written Aug. 2005
# * Posted to gist.github.com/16173 on Oct. 2008
# Copyright (c) 2003-2006 Open Source Applications Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
@endolith
endolith / kernel_density.py
Last active May 1, 2018 03:53
Multidimensional Kernel Density Estimation in SciPy
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 19 20:32:51 2011
@author: endolith@gmail.com
"""
import numpy as np
import scipy.stats as stats
from matplotlib.pyplot import imshow, scatter
@tjb0607
tjb0607 / visualizer.py
Last active December 26, 2021 19:24
a 2D audio visualizer script for Blender 2.5+ (v0.3)
# To use this script, you must first change a few things.
# First, you'll want to change the filepath for the sound file.
# This is on line 76. Second, you might want to change the materials or the settings.
# To render this, you'll need to set the background color, enable Only Render on the display window, and render it with OpenGL (it's much faster and most optimal for 2D renders.)
# LICENSE = wtfpl
# VERSION = 0.3
import bpy
def makeMaterial(name, diffuse, alpha):
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@jboner
jboner / latency.txt
Last active June 8, 2024 14:56
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
@mbostock
mbostock / .block
Last active August 5, 2023 12:53
Margin Convention
license: gpl-3.0
redirect: https://observablehq.com/@d3/margin-convention
@admsyn
admsyn / Output
Created August 24, 2012 16:49
Testing vDSP's FFT vs FFTW's
N = 1024 Accel: 0.05265 FFTW: 0.026213
N = 2048 Accel: 0.042565 FFTW: 0.049334
N = 4096 Accel: 0.049206 FFTW: 0.082782
N = 8192 Accel: 0.118918 FFTW: 0.173506
N = 16384 Accel: 0.200201 FFTW: 0.371488
N = 32768 Accel: 0.356826 FFTW: 1.01589
N = 65536 Accel: 0.844955 FFTW: 1.79316
N = 131072 Accel: 1.95759 FFTW: 3.99565
N = 262144 Accel: 4.34179 FFTW: 9.87287
N = 524288 Accel: 9.31858 FFTW: 19.6675
@datapixie
datapixie / README.md
Last active September 25, 2017 14:51
An animated normalized stacked barchart.

This is an animated variation of mbostock's normalized stacked barchart. When you click on a block, that block is sent to the bottom of the stack and the bars are reordered by decreasing height of that block. This allows you to compare any value in the stacks with a common baseline, eliminating a common criticism of stacked barcharts.

@jfreels
jfreels / README.md
Created September 27, 2013 19:33
d3js: Create an HTML table using d3.js and JSON

d3js: Create an HTML table using d3.js and JSON

@makomweb
makomweb / pub_sub_cpp.cpp
Last active August 24, 2023 08:13
Fun with C++: implementing a pub/sub scenario using std::bind and other standard facilities. The approach is pretty similar to the well known .NET event mechanism.
#include <iostream>
#include <map>
#include <algorithm>
#include <functional>
#include <memory>
using namespace std;
class EventArgs {
public: