Skip to content

Instantly share code, notes, and snippets.

@aman-tiwari
aman-tiwari / particle_system.py
Last active May 25, 2017 06:05
A little particle system for your terminal : )
from itertools import chain
from math import sqrt
from random import random
import drawille
def wrap(x, low, high):
if x > high:
return low
@getify
getify / number-prototype-iterator.js
Created January 25, 2017 23:52
Make JavaScript Great Again
Object.defineProperty(Number.prototype,Symbol.iterator,{
*value({ start = 0, step = 1 } = {}) {
var inc = this > 0 ? step : -step;
for (let i = start; Math.abs(i) <= Math.abs(this); i += inc) {
yield i;
}
},
enumerable: false,
writable: true,
configurable: true
@cuppster
cuppster / quantize.py
Created November 2, 2012 23:08
Quantize An Image To A Custom Palette
import sys
import numpy as np
import scipy.ndimage as nd
from scipy.cluster.vq import vq
from scipy.misc import imsave
def crayola_9():
"""
Palette of the first 8 crayola colors + white
"""