Skip to content

Instantly share code, notes, and snippets.

View aaronpenne's full-sized avatar
👋

Aaron Penne aaronpenne

👋
View GitHub Profile
@santi-grau
santi-grau / EffectComposerGolfed.js
Created March 2, 2022 23:45
Golfed version of EffectComposer
class EC{constructor(r){this.r=r;let s=r.getSize(new THREE.Vector2());this.p=r.getPixelRatio();this.w=s.width;this.h=s.height;let t=new THREE.WebGLRenderTarget(this.w*this.p,this.h*this.p,{minFilter:1006,magFilter:1006,format:1023});this.u=t;this.v=t.clone();this.b=this.u;this.readBuffer=this.v;this.renderToScreen=1;this.t=[];this.c=new THREE.Clock();}sb(){let tmp=this.readBuffer;this.readBuffer=this.b;this.b=tmp;}addPass(p){this.t.push(p);p.setSize(this.w*this.p,this.h*this.p);}lp(p){for(let i=p+1;i<this.t.length;i++)if(this.t[i].enabled)return 0;return 1;}render(){let d=this.c.getDelta(),c=this.r.getRenderTarget();this.t.forEach(p=>{p.renderToScreen=this.renderToScreen&&this.lp(i);p.render(this.r,this.b,this.readBuffer,d,0);if(p.needsSwap)this.sb();});this.r.setRenderTarget(c);};setSize(w,h){this.w=w;this.h=h;let x=this.w*this.p,y=this.h*this.p;this.u.setSize(x,y);this.v.setSize(x,y);this.t.forEach(p=>p.setSize(x,y)); }};
@tangert
tangert / SVG.sol
Last active October 26, 2025 02:09
SVG Solidity Library
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "./Utils.sol";
// Core SVG utilitiy library which helps us construct
// onchain SVG's with a simple, web-like API.
library svg {
/* MAIN ELEMENTS */
function g(string memory _props, string memory _children)
internal

NFT Thoughts, Essays, Writings

I'm collecting here a few essays on the net about tokenization in the art world. This list is likely biased and by no means exhaustive.

@mattdesl
mattdesl / palette-btoa.js
Last active December 14, 2023 21:49
palette compression
// Polyfill so we can run this in Node.js as well
if (typeof atob !== 'function') {
var atob = a => Buffer.from(a, 'base64').toString('binary')
var btoa = b => Buffer.from(b).toString('base64');
}
// 511 bytes after minify
var a=[
["#1b6f3f", "#10c5b4", "#ade4cd", "#29ec19"],
["#96bde8", "#246a85", "#3483e4", "#b168f6"],
From: http://www.labnol.org/software/wget-command-examples/28750/
How do I download an entire website for offline viewing? How do I save all the MP3s from a website to a folder on my computer? How do I download files that are behind a login page? How do I build a mini-version of Google?
Wget is a free utility – available for Mac, Windows and Linux (included) – that can help you accomplish all this and more. What makes it different from most download managers is that wget can follow the HTML links on a web page and recursively download the files. It is the same tool that a soldier had used to download thousands of secret documents from the US army’s Intranet that were later published on the Wikileaks website.
You mirror an entire website with wget
Mirror an entire website with wget
Spider Websites with Wget – 20 Practical Examples
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);
@companje
companje / map.glsl
Created January 23, 2018 22:46
map() function for GLSL known from Processing & openFrameworks
float map(float value, float min1, float max1, float min2, float max2) {
return min2 + (value - min1) * (max2 - min2) / (max1 - min1);
}
@dusenberrymw
dusenberrymw / tmux_tips_and_tricks.md
Last active October 23, 2025 02:12
Tmux Tips & Tricks

Quick cheat sheet of helpful tmux commands

  1. tmux new - Create and attach to a new session.
  2. tmux new -s NAME_HERE - Create and attach to a new session named NAME_HERE.
  3. CTRL-b, d - Detach (i.e. exit) from the currently-opened tmux session (alternatively, tmux detach). Note, this means press and hold CTRL, press b, release both, press d.
  4. tmux ls - Show list of tmux sessions.
  5. tmux a - Attach to the previously-opened tmux session.
  6. tmux a -t NAME_HERE - Attach to the tmux session named NAME_HERE.
  7. CTRL-d - Delete (i.e. kill) currently-opened tmux session (alternatively tmux kill-session).
  8. CTRL-b, [ - Enter copy mode, and enable scrolling in currently-opened tmux session. Press q to exit.
  9. CTRL-b, " - Split window horizontally (i.e. split and add a pane below).
@bgusach
bgusach / multireplace.py
Last active December 10, 2024 03:51
Python string multireplacement
def multireplace(string, replacements, ignore_case=False):
"""
Given a string and a replacement map, it returns the replaced string.
:param str string: string to execute replacements on
:param dict replacements: replacement dictionary {value to find: value to replace}
:param bool ignore_case: whether the match should be case insensitive
:rtype: str
"""
@squarism
squarism / iterm2.md
Last active December 9, 2025 19:43
An iTerm2 Cheatsheet

In the below keyboard shortcuts, I use the capital letters for reading clarity but this does not imply shift, if shift is needed, I will say shift. So + D does not mean hold shift. + Shift + D does of course.

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key