Skip to content

Instantly share code, notes, and snippets.

int[][] result;
float t, c;
float ease(float p) {
return 3*p*p - 2*p*p*p;
}
float ease(float p, float g) {
if (p < 0.5)
return 0.5 * pow(2*p, g);
@betatim
betatim / only-every.py
Created August 1, 2019 17:25
A decorator that caches a function's return value for a few seconds
def only_every(_f=None, *, interval=10):
"""Call the wrapped function at most every `interval` seconds.
Useful when `f` is (very) expensive to compute and you are happy
to have results which are possibly a few seconds out of date.
"""
last_time = time.monotonic() - interval - 1
last_result = None
def caller(f):
@wraps(f)
"""Implementation of NEAT.
python neat.py --task {xor, lunar, cartpole}
See the post at https://wellecks.wordpress.com/ for details.
Parts of this implementation are based on Neat-Python.
"""
from itertools import count
import numpy as np
import math
@MAKIO135
MAKIO135 / In_C.rb
Last active February 1, 2025 21:22
SonicPi In C
# Discovered In C a few years ago thanks to Tero Parviainen (@teropa) 's great article: Terry Riley's "In C", A Journey Through a Musical Possibility Space
# http://teropa.info/blog/2017/01/23/terry-rileys-in-c.html
# Here is a Sonic Pi version with 5 synths and 1 sample, based on Jim Bumgardner's Chuck implementation.
# http://electro-music.com/forum/viewtopic.php?t=14237&#038;sid=dbb3ada88a20169e90ee4ce45d79f10
# A generated result can be heard here: https://soundcloud.com/makio135/sonic-pi-in-c
use_debug false
// Processing code by Etienne JACOB
// motion blur template by beesandbombs
// opensimplexnoise code in another tab might be necessary
// --> code here : https://gist.github.com/Bleuje/fce86ef35b66c4a2b6a469b27163591e
// note : I found (visually) that there is a little mistake in this rotation version but I haven't found where in the code
// edit : I think I understood the mistake but it's quite annoying to fix :)
int[][] result;
float t, c;
@btahir
btahir / twitter-pulse-checker.ipynb
Created June 21, 2019 09:13
Twitter-Pulse-Checker.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@MattPD
MattPD / cpp.std.coroutines.draft.md
Last active April 8, 2026 21:31
C++ links: Coroutines (WIP draft)
@kgturner
kgturner / getGBIFdatas.R
Created March 27, 2019 17:08
Get large amounts of GBIF.org occurence data
#Download occurence data from GBIF - for few to many spp.
#3/25/2019 KG Turner with assistance from S. Chamberlain, rOpenSci.org
#Register at gbif.org. You will need to use this email address, user name, and password in the following script.
#NB: DON'T COMMIT YOUR PASSWORDS.
# R version 3.5.3 (2019-03-11)
library(rgbif) #1.2.0