Skip to content

Instantly share code, notes, and snippets.

@mattebb
mattebb / TezTok-getSaleStats.ql
Last active June 12, 2023 06:52 — forked from mariuswatz/TezTok-getSaleStats.ql
GraphQL query that will get buy and sell activities for a specified Tezos wallet for a given date range, including sale / buy sum totals and number of events.
# Copy the following GraphQL query into the TezTok API Explorer at
# https://graphiql.teztok.com/
# Fill out the wallet, date1 and date2 parameters with the Tezos address
# and date range you're interested in. The output combines events() and
# events_aggregate() query to give you a quick overview over sales and buys
# over the time period.
#
# Example:
@mattebb
mattebb / sync.js
Last active April 5, 2023 00:53
Waiting for webgl to finish rendering using fenceSync
// assembled from some stackoverflow answers
const start = performance.now();
// Draw the fullscreen quad
twgl.drawBufferInfo(gl, quad_bufferInfo);
let sync = gl.fenceSync(gl.SYNC_GPU_COMMANDS_COMPLETE, 0);
checkSync = () => {
@mattebb
mattebb / wn uniforms.glsl
Created March 9, 2022 01:40
Scene data glsl uniforms in Wandering Nets
struct Light {
float intensity;
vec3 colour;
vec3 pa;
vec3 pb;
float w;
vec3 L;
vec3 nL;
};
#pragma opname fisheyelens
#pragma oplabel "Fisheye Lens"
#pragma hint x hidden
#pragma hint y hidden
#pragma hint Time hidden
#pragma hint dofx hidden
#pragma hint dofy hidden
#pragma hint aspect hidden
#pragma hint P hidden
@mattebb
mattebb / pano.vex.c
Last active August 29, 2015 14:17
Mantra stereo pano camera lens shader (wip)
float theta = -$PI * x;
float phi = $PI * 0.5 * y;
float sin_theta = sin(theta);
float cos_theta = cos(theta);
float sin_phi = sin(phi);
float cos_phi = cos(phi);
i.z = sin_theta * cos_phi;
i.y = sin_phi;
@mattebb
mattebb / weightedrandom.vex
Last active July 18, 2016 13:29
Weighted random VEX
int i, steps = 80;
float sumhist[], sum=0, slice = 1.0/float(steps);
seed += 123456789;
for (i=0;i<steps;i++) {
float pos = (i*slice);
float val = chramp("__rndweight", pos);
sum += val;
push(sumhist, sum);
}
@mattebb
mattebb / houdini_add_attr_vop.py
Last active December 22, 2015 06:48
Handy shortcut to add an Import Attribute or Add Attribute VOP node, guessing the values of input parameters. Intended for binding to a shortcut key.
selpath = hou.hscriptExpression('mousepath()').split('.')[-1]
voppath = '/'.join( selpath.split('/')[:-1] )
node = hou.node(voppath)
retval, aname = hou.ui.readInput("Attribute Name", buttons=('OK',))
if retval != -1:
add = node.createNode('addattrib')
add.setName("add_%s"%aname)
add.parm('attrib').set(aname)
@mattebb
mattebb / houdini_manual_cook.py
Last active December 12, 2022 18:06
Toggle Manual cook in Houdini
if hou.updateModeSetting() == hou.updateMode.Manual:
hou.setUpdateMode(hou.updateMode.AutoUpdate)
elif hou.updateModeSetting() == hou.updateMode.AutoUpdate:
hou.setUpdateMode(hou.updateMode.Manual)
@mattebb
mattebb / gist:4545268
Last active December 11, 2015 04:28
Curl Noise (MEL)
// http://soup-dev.websitetoolbox.com/post/curl-noise-for-maya-5937312
pickWalk -d down;
string $part[] = `ls -sl`;
addAttr -ln "noiseFrequency" -at double3 $part[0];
addAttr -ln "noiseFrequencyX" -at double -p noiseFrequency $part[0];
addAttr -ln "noiseFrequencyY" -at double -p noiseFrequency $part[0];
addAttr -ln "noiseFrequencyZ" -at double -p noiseFrequency $part[0];
setAttr -type double3 ($part[0] + ".noiseFrequency") 0.4 0.4 0.4;
setAttr -e-keyable true ($part[0] + ".noiseFrequency");
@mattebb
mattebb / gist:4450615
Created January 4, 2013 07:17
swig code to get partio attribute data as a tuple
%feature("autodoc");
%feature("docstring","Gets a single flattened tuple, containing attribute data for all particles");
PyObject* getTuple(const ParticleAttribute& attr)
{
unsigned int numparticles = $self->numParticles();
PyObject* tuple=PyTuple_New(numparticles * attr.count);
if(attr.type==Partio::INT){
for(unsigned int i=0;i<numparticles;i++) {