Skip to content

Instantly share code, notes, and snippets.

Felipe Tavares felipetavares

Block or report user

Report or block felipetavares

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@felipetavares
felipetavares / paletted_png.c
Created Oct 17, 2019
Detect if a PNG has a palette and load palette+data with libpng
View paletted_png.c
// This examples read a PNG and its palette
#include <png.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
int main() {
png_image img;
@felipetavares
felipetavares / tetrafrac.glsl
Last active Oct 20, 2019
Tetrahedron fractals with raymarching. Camera & ambient occlusion. View with https://github.com/Gargaj/Bonzomatic
View tetrafrac.glsl
#version 450 core
uniform float fGlobalTime; // in seconds
uniform vec2 v2Resolution; // viewport resolution (in pixels)
uniform sampler1D texFFT; // towards 0.0 is bass / lower freq, towards 1.0 is higher / treble freq
uniform sampler1D texFFTSmoothed; // this one has longer falloff and less harsh transients
uniform sampler1D texFFTIntegrated; // this is continually increasing
layout(location = 0) out vec4 out_color; // out_color must be written in order to see anything
@felipetavares
felipetavares / integration.js
Last active Aug 9, 2019
Neurologic Client-Side Integration example
View integration.js
// O nome da função pode ser escolhido arbitrariamente
//
// config: objeto contendo configuração estática relacionada ao fluxo;
//
// callback: função que recebe como argumento um bloco a ser adicionado
// ao chat e termina o estado de loading.
function nldAPI_JornalDoCarro_LeadComplete(config, callback) {
// Extrai os dados usando o objeto global "neurolead"
var leadData = neurolead.getData();
@felipetavares
felipetavares / simple_useful_slow.js
Last active Aug 12, 2019
Simple, Useful and Slow: Assorted Reference Statistics Functions (utf-8)
View simple_useful_slow.js
// Simple, Useful and Slow
// Assorted Reference Statistics Functions
// UTF-8 Edition
// Shorthands
pow = Math.pow
sqrt = Math.sqrt
pi = Math.PI
View weirdasspong.lua
function vec_(x, y)
return { x = x, y = y }
end
function add(a, b)
return vec_(a.x+b.x, a.y+b.y)
end
function sub(a, b)
return vec_(a.x-b.x, a.y-b.y)
@felipetavares
felipetavares / lparser.c
Created Nov 19, 2018
+= extension for Lua 5.3
View lparser.c
static void assignment (LexState *ls, struct LHS_assign *lh, int nvars) {
expdesc e;
check_condition(ls, vkisvar(lh->v.k), "syntax error");
if (testnext(ls, ',')) { /* assignment -> ',' suffixedexp assignment */
struct LHS_assign nv;
nv.prev = lh;
suffixedexp(ls, &nv.v);
if (!vkisindexed(nv.v.k))
check_conflict(ls, lh, &nv.v);
@felipetavares
felipetavares / polygon.js
Created Nov 16, 2018
Polygon Generator: given a set of tile positions create a polygon from its boundary
View polygon.js
function cantor(x, y) {
return (x+y)/2*(x+y+1)+y;
}
function decantor(z) {
let w = Math.floor((Math.sqrt(8*z+1)-1)/2);
let t = (w*w+w)/2;
return {
y: z-t,
@felipetavares
felipetavares / guidelines.md
Last active Nov 10, 2017
Blender Guidelines
View guidelines.md

Blender Guidelines

Projeto PongBoy

1 Escala

São utilizados milímetros e para a melhor visualização, a escala e número de linhas do gid devem ser alteradas como segue.

No menu lateral, escolha Scene. No campo Units selecione Millimeters dos presets.

@felipetavares
felipetavares / userfriendly.sh
Created Aug 3, 2015
Download all the User Friendly comics!
View userfriendly.sh
#!/bin/bash
years="1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015"
months1="01 02 03 04 05 06 07 08 09 10 11 12"
months2="11 12"
n=1
for y in $years
do
if [ $y = "1997" ]; then
View poema.js
// Nenhum(a)/Ambos(as)
var Nenhum=Nenhuma = 0;
var Ambos=Ambas= -1;
// Sim/Não
var Sim = true;
var Não = false;
// Gênero/Número/Grau/Pessoa
var Gênero = {
You can’t perform that action at this time.