Skip to content

Instantly share code, notes, and snippets.

Avatar

Greg Borenstein atduskgreg

View GitHub Profile
View observe_completion_of_p5js.js
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if(mutation.addedNodes.length > 0 && mutation.addedNodes[0].nodeName == "CANVAS"){
// do stuff after the sketch loaded
}
});
});
var config = { attributes: false, childList: true, characterData: false }
target = document.getElementById("myDiv")
View defcon_status.json
{"origin":"DEFCON #defcon number# \\[#Exercise Term#\\] #Description#: #Force# #readiness action# #time modifier# #timeframe#.","defcon number":["1","2","3","4","5","6","7","8","9"],"Exercise Term":["COCKED PISTOL","FAST PACE","ROUND HOUSE","DOUBLE TAKE","FADE OUT","LIMP","FULLY LIMP","ENGORGED","AROUSED","DISINTERESTED","HOT TAKE","KEYNOTE","DRESS","LIMBER UP","STRETCH","WIPE","HARD CUT","SMASH CUT","FADE TO BLACK","PLUG IN","TURN ON","HARD RESET","SOFT RESET","COLD BOOT","COLD OPEN","PREAMBLE","AMBLE","PROLOGUE","EPILOGUE","DEEP CLEAN","SOCIAL ANXIETY","HAND MASSAGE","LIVE SHOW","MINIMUM VIABLE","JONY IVE","MICROSOFT BOB","NEW SHOES","GIL AMELIO","FRIENDS REBOOT","LIQUIDITY EVENT","SNAFU","DOWN ROUND","PREMIERE","ENCORE","PEEP SHOW","CURTAIN CALL","TULIP EFFECT","BLACK SWAN","RED SWAN","WHITE SWAN","APPLE PIPPIN","NEWTON","LISA","COURIER","HALF SHELL","SHORT ROUND","BLACK FACE","WHITE FACE","PILOT SHOW","NIGHTMARE GREEN"],"Description":["Nuclear war is imminent","Next step to nuclear war","Daydreaming of n
View ezra_klein_lead.md

There's also a fascinating, depressing, unhappy kind of long-term issue here. And something worth connecting it back to is that this isn't the first recent story that in some fundamental way had lead as a big part of it. If people remember the death of Freddy Gray in Baltimore which was a really big story in 2015. This was a young guy and he was arrested by police and then put in a police van and appears to have been unrestrained in that van and handcuffed and shackled. They drove the van in such a way that he ended up snapping his spine and dying and it was a really terrible story. But something that was a terrible part of the backstory was that Freddie Gray had had very high levels of lead poisoning as a child. So high in fact that his family had been in lawsuits with — I don't remember if it's the developers or the city — but there were lawsuits around the amount of lead that that family was exposed to. And one thing that high levels of early lead exposure will do, as Matt said, is lead to reduced IQ, high

View gist:e7993249f16629f9e4da
CUT TO: EXT. CALIFORNIA, NEWPORT BEACH - DAY
Toby and Sam are walking along the beach.
TOBY
When they ask you why you're here today, you say,
"Orange County's beachfront is national treasure."
SAM
Who are you, Charlie McCarthy?
View gif_resize.rb
# resize an animated GIF
if ARGV.length < 3
puts "Usage:"
puts "ruby gif_prep.rb full_size.gif <size> small_size.gif"
exit
end
full = ARGV[0]
size = ARGV[1]
@atduskgreg
atduskgreg / interactive_inpainting.pde
Created Dec 3, 2015
Interactive in-painting with OpenCV for Processing
View interactive_inpainting.pde
import gab.opencv.*;
import org.opencv.photo.Photo;
import org.opencv.imgproc.Imgproc;
PImage src;
PGraphics canvas;
OpenCV opencv, mask;
int strokeSize = 30;
View drawGrahic.glsl
uniform sampler2D srcImg;
varying vec4 vertTexCoord;
void main() {
gl_FragColor = texture2D(srcImg, vertTexCoord.st).rgba;
}
View easing_function_demo.pde
float linearTween(float t, float startValue, float deltaT, float duration) {
return deltaT*t/duration + startValue;
}
float cubicEaseInOut(float t, float startValue, float deltaT, float duration) {
t /= duration/2;
if (t < 1) {
return deltaT/2*t*t*t + startValue;
} else {
t -= 2;
@atduskgreg
atduskgreg / PWindow.pde
Last active Sep 21, 2020
Example of creating a Processing sketch with multiple windows (works in Processing 3.0)
View PWindow.pde
class PWindow extends PApplet {
PWindow() {
super();
PApplet.runSketch(new String[] {this.getClass().getSimpleName()}, this);
}
void settings() {
size(500, 200);
}
View multi_window_app_subclass.pde
PGraphics pg;
PSurface surf;
MyWindow win;
void settings() {
size(320, 240);
}
void setup() {
You can’t perform that action at this time.