Skip to content

Instantly share code, notes, and snippets.

@jboner
jboner / latency.txt
Last active November 19, 2024 11:10
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
@josephwecker
josephwecker / new_bashrc.sh
Created August 11, 2012 04:36
Replace .bashrc, .bash_profile, .profile, etc. with something much more clean, consistent, and meaningful. Now a repo: https://github.com/josephwecker/bashrc_dispatch
#!/bin/bash
# License: Public Domain.
# Author: Joseph Wecker, 2012
#
# -- DEPRICATED --
# This gist is slow and is missing .bashrc_once
# Use the one in the repo instead! https://github.com/josephwecker/bashrc_dispatch
# (Thanks gioele)
#
# Are you tired of trying to remember what .bashrc does vs .bash_profile vs .profile?
@Vesnica
Vesnica / average.lua
Created September 8, 2012 06:54
Embed Lua example
avg, sum = average(10, 20, 30, 40, 50)
print("The average is ", avg)
print("The sum is ", sum)
print("Versioin is ", VERSION)
anonymous
anonymous / gist:7200880
Created October 28, 2013 17:20
Processing motion blur
/* passable motion blur effect using frame blending
* basically move your 'draw()' into 'sample()', time runs from 0 to 1
* by dave
* http://beesandbombs.tumblr.com
*/
int samplesPerFrame = 32; // more is better but slower. 32 is enough probably
int numFrames = 48;
float shutterAngle = 2.0; // this should be between 0 and 1 realistically. exaggerated for effect here
int[][] result;
anonymous
anonymous / gist:8327328
Created January 9, 2014 00:27
gif code!!!!!
int samplesPerFrame = 32;
int numFrames = 42;
float shutterAngle = .8;
int[][] result;
float time;
float d1, d2, th, pp = .7, t, tt;
int N = 10, M = 9;
anonymous
anonymous / gist:10675250
Created April 14, 2014 19:11
Motion Blur + Chromatic Aberration
// by dave @ beesandbombs.tumblr.com >:)
void setup() {
setup_();
result = new int[width*height][3];
result_ = new int[width*height][3];
}
int[][] result, result_;
float time;
@kouk
kouk / tmxsync.sh
Last active April 6, 2023 20:52
tmux synchronize-windows
# tmxsync: bring all windows as panes into one window and activate the "synchronize-panes" option
# tmxunsync: split all panes into different windows and deactivate the "synchronize-panes" option.
# Licence:
# To the extent possible under law I, Konstantinos Koukopoulos, have waived all copyright and related or neighboring rights to tmxsync.sh, as describe by the CC0 document:
# http://creativecommons.org/publicdomain/zero/1.0/
# This work is published from: Greece.
tmxsync () {
export _TMUX_SYNC=1;
@nylki
nylki / char-rnn recipes.md
Last active November 18, 2024 13:19
char-rnn cooking recipes

do androids dream of cooking?

The following recipes are sampled from a trained neural net. You can find the repo to train your own neural net here: https://github.com/karpathy/char-rnn Thanks to Andrej Karpathy for the great code! It's really easy to setup.

The recipes I used for training the char-rnn are from a recipe collection called ffts.com And here is the actual zipped data (uncompressed ~35 MB) I used for training. The ZIP is also archived @ archive.org in case the original links becomes invalid in the future.

@Bekbolatov
Bekbolatov / tmux.md
Last active October 7, 2024 04:03
Clean tmux cheat-sheet

Clean tmux cheat-sheet

By resources

sessions

list-sessions        ls         -- List sessions managed by server
new-session          new        -- Create a new session
@beardicus
beardicus / plotter-pen-adapter.jscad
Last active March 6, 2024 22:23
Plotter Pen Adapter for use with OpenJSCAD
// title : Plotter Pen Adapter
// author : Brian Boucheron <[email protected]>
// license : MIT License
// revision : 0.003
// date : June 9 2022
// file : plotter-pen-adapter.jscad
// gist : https://gist.github.com/beardicus/d668c0f6b96be53d16dc
// A parametric version of the plotter pen adapter found here:
// https://www.printables.com/model/156721-sharpie-fine-point-plotter-adapter