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 April 22, 2024 23:32
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);
}
@bgusach
bgusach / multireplace.py
Last active July 10, 2024 14:14
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 November 19, 2024 15:14
An iTerm2 Cheatsheet

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
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)
@mrgloom
mrgloom / dnn_compare_optims.py
Last active February 9, 2018 18:04 — forked from syhw/dnn_compare_optims.py
comparing SGD vs SAG vs Adadelta vs Adagrad
"""
A deep neural network with or w/o dropout in one file.
"""
import numpy
import theano
import sys
import math
from theano import tensor as T
from theano import shared