Skip to content

Instantly share code, notes, and snippets.

View mauriciomassaia's full-sized avatar

Mauricio Massaia mauriciomassaia

View GitHub Profile
@andrhamm
andrhamm / callbacks.js
Last active April 27, 2022 17:01
Paginating Scans & Queries in DynamoDB with Node.js using Callbacks OR Promises
const AWS = require('aws-sdk');
AWS.config.logger = console;
const dynamodb = new AWS.DynamoDB({ apiVersion: '2012-08-10' });
let val = 'some value';
let params = {
TableName: "MyTable",
ExpressionAttributeValues: {
@jancassio
jancassio / averageColor.pde
Last active September 25, 2019 23:02
Get average color of an image
color averageColor(PImage image) {
float r = 0;
float g = 0;
float b = 0;
int count = image.pixels.length;
int[] pixels = image.pixels;
for(int i = 0; i < count; i++) {
r += red(pixels[i]);
@mdkq
mdkq / main.js
Created December 2, 2017 01:22
Curl noise ribbons with three.js
var THREE = require('three')
var SimplexNoise = require('simplex-noise')
document.documentElement.style.width = '100%'
document.documentElement.style.height = '100%'
document.body.style.width = '100%'
document.body.style.height = '100%'
document.body.style.margin = '0'
document.body.style.overflow = 'hidden'
var canvas = document.createElement('canvas')
@aidant
aidant / README.md
Last active July 24, 2023 01:02
Useful find and replace regex

Replace import with require()

Find

import ([A-Za-z_]+|{ ?([a-zA-Z_]+,? ?)+ ?}) from (\'[a-z-_0-9\.\/-]+\');?

Replace

const $1 = require($3)

Replace require() with import

Find

const ([A-Za-z_]+|\{ ?([a-zA-Z_]+,? ?)+ ?\}) = require\(('[a-z-_0-9\.\/-]+')\);?

Replace
@meetkabeershah
meetkabeershah / default nginx configuration file
Last active January 11, 2025 12:19
The default nginx configuration file inside /etc/nginx/sites-available/default
# Author: Zameer Ansari
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
@mattdesl
mattdesl / curl.js
Last active December 2, 2021 09:42
curl noise for ThreeJS; this gist is open source under MIT license.
const SimplexNoise = require('simplex-noise');
const simplex = new SimplexNoise();
module.exports = curlNoise;
function curlNoise (x, y, z, out = new THREE.Vector3()) {
const eps = 1.0;
let n1, n2, a, b;
n1 = simplex.noise3D(x, y + eps, z);
n2 = simplex.noise3D(x, y - eps, z);
@shivendra14
shivendra14 / Illustrator_Scale_Artboard_and_Artwork.jsx
Created September 17, 2017 14:19
Script to scale up Illustrator Assets
#target Illustrator
/*
Revision-1
Author: Shivendra Agarwal
Year: 2017
Title: Script to scale-up artwork and artboard above 15 Mpixel
*/
if ( app.documents.length > 0 )
alert("ERROR: \n Close all documents before running this script." );
@ayamflow
ayamflow / texture-atlas.js
Last active November 21, 2023 01:22
threejs Texture Atlas (TexturePacker spritesheet)
import _ from 'underscore';
export default class TextureAtlas {
constructor(json, image) {
this._textures = {};
let texture = new THREE.Texture(image);
texture.needsUpdate = true;
let frames = json.frames;
_.keys(frames).forEach(function(key, i) {
@ruuda
ruuda / ledwall.glsl
Last active December 19, 2019 00:23
LED wall shader
// Simulates n colored point lights (LEDs) shining at a wall from a distance wd.
// Wall distance; increase for more fuzzy lights,
// decrease for sharper point lights.
float wd = 0.15f;
const int nLights = 4;
const vec3 lights[nLights] = vec3[](
vec3(1.0f, 0.0f, 0.0f),
vec3(0.0f, 1.0f, 0.0f),
@marciopuga
marciopuga / docker-compose.yml for development
Last active May 8, 2017 01:49
Microservices running on Docker reverse proxy using Traefik, Docker Swarm and Docker Compose v3
version: '3'
services:
traefik:
image: marciopuga/traefik:latest
build: ./traefik/.
command: --web --docker --docker.domain=docker.localhost --docker.watch \
--logLevel=DEBUG \
--docker.exposedbydefault=false \
--entryPoints='Name:http Address::80' \
--defaultEntryPoints='http'