Skip to content

Instantly share code, notes, and snippets.

View companje's full-sized avatar

Rick Companje companje

View GitHub Profile
@companje
companje / TwoZoomableWindows.pde
Last active October 27, 2023 20:32
Multiple Zoomable Windows in Processing
ZoomWindow win1, win2;
void setup() {
size(100, 100);
win1 = new ZoomWindow(dataPath("saenredam.jpg"), 0, 0, displayWidth/2, displayHeight);
win2 = new ZoomWindow(dataPath("zadelstraat.jpg"), displayWidth/2, 0, displayWidth/2, displayHeight);
}
void draw() {
}
@laundmo
laundmo / lerp.py
Last active September 5, 2024 10:38
lerp, inverse lerp and remap in python
def lerp(a: float, b: float, t: float) -> float:
"""Linear interpolate on the scale given by a to b, using t as the point on that scale.
Examples
--------
50 == lerp(0, 100, 0.5)
4.2 == lerp(1, 5, 0.8)
"""
return (1 - t) * a + t * b
@bueckl
bueckl / wget
Last active October 11, 2023 08:05
Wget examples
#Spider Websites with Wget – 20 Practical Examples
Wget is extremely powerful, but like with most other command line programs, the plethora of options it supports can be intimidating to new users. Thus what we have here are a collection of wget commands that you can use to accomplish common tasks from downloading single files to mirroring entire websites. It will help if you can read through the wget manual but for the busy souls, these commands are ready to execute.
1. Download a single file from the Internet
wget http://example.com/file.iso
2. Download a file but save it locally under a different name
wget ‐‐output-document=filename.html example.com
@shaunlebron
shaunlebron / angleLerp.js
Created February 5, 2014 20:41
The best way to interpolate 2D angles
/*
2D Angle Interpolation (shortest distance)
Parameters:
a0 = start angle
a1 = end angle
t = interpolation factor (0.0=start, 1.0=end)
Benefits:
1. Angles do NOT need to be normalized.