Skip to content

Instantly share code, notes, and snippets.

View cedricpinson's full-sized avatar

Cedric Pinson cedricpinson

View GitHub Profile
@cedricpinson
cedricpinson / stb_resize.h
Last active February 5, 2022 17:28
stb_resize kernel downsampling
/* Mitchel filter is like that:
{ stbir__filter_mitchell, stbir__support_two }
float stbir__support_two(float s)
{
// scale is not used for mitchell
return 2.0;
}
float stbir__filter_mitchell(float x, float s)
{
@cedricpinson
cedricpinson / flamegraph.fish
Created August 2, 2020 18:13
helper to flamegraph a command
# macos fix to run dtrace
# https://apple.stackexchange.com/questions/208762/now-that-el-capitan-is-rootless-is-there-any-way-to-get-dtrace-working
# https://github.com/brendangregg/FlameGraph
# http://www.brendangregg.com/DTrace/DTrace-cheatsheet.pdf
function flamegraph
if test (count $argv) -eq 0
echo usage: flamegraph command [args]
return 1
end
on  HEAD [$?] in dope/build-debug-mt took 18s 126ms ➜ ./test/renderPerformance/renderPerformanceTestMT
date time ( uptime ) [ thread name/id ] file:line v|
2019-06-13 20:03:49.708 ( 0.000s) [main thread ] loguru.cpp:592 INFO| arguments: ./test/renderPerformance/renderPerformanceTestMT
2019-06-13 20:03:49.709 ( 0.000s) [main thread ] loguru.cpp:595 INFO| Current dir: /Users/trigrou/dev/dope/build-debug-mt
2019-06-13 20:03:49.709 ( 0.000s) [main thread ] loguru.cpp:597 INFO| stderr verbosity: 0
2019-06-13 20:03:49.709 ( 0.000s) [main thread ] loguru.cpp:598 INFO| -----------------------------------
2019-06-13 20:03:49.709 ( 0.000s) [main thread ] entry.cpp:82 INFO| [dope] main
2019-06-13 20:03:49.709 ( 0.000s) [main thread ] entry.cpp:84 INFO| [dope] args(0) -> ./test/renderPerformance/renderPerformanceTestMT
@cedricpinson
cedricpinson / HandleList.h
Created March 25, 2019 15:53
Testing Handle List
template <Typename T, int count>
struct HandleList
{
HandleList(void* data)
{
_data = static_cast<T*>(data);
for ( int i = 0 ; i < count; i++ )
_freeSpots[i] = i;
_freeSpotCount = count;
{
"config": [
{
"default": "#64584F",
"material": "paint",
"name": "Paint",
"options": [
{
"color": "#64584F",
"name": "Brown"
@cedricpinson
cedricpinson / parser.py
Created February 13, 2018 13:19
Parse csv data in python
#!/usr/local/bin/python
import json
import sys
import time
material_specular_metalness = 0
material_albedo_diffuse = 0
material_specular_metalness_off = 0
def process_line(line):
@cedricpinson
cedricpinson / parser.md
Last active February 13, 2018 13:30
parsing csv data in different languages
@cedricpinson
cedricpinson / parser.rs
Last active February 12, 2018 20:25
parser csv data in rust
// -*- compile-command: "cargo build ; cargo run ../../sample.csv" -*-
// This is a comment, and will be ignored by the compiler
// You can test this code by clicking the "Run" button over there ->
// or if prefer to use your keyboard, you can use the "Ctrl + Enter" shortcut
// This code is editable, feel free to hack it!
// You can always return to the original code by clicking the "Reset" button ->
use std::env;
use std::thread;
@cedricpinson
cedricpinson / parser.go
Created February 10, 2018 10:46
parse a data.csv in go
// -*- compile-command: "go run *.go sample.csv" -*-
package main
import (
"bufio"
"encoding/json"
"fmt"
"io"
"os"
<link rel="stylesheet" type="text/css" href="http://www.(SITEWEB).com/sketchfab.css">
<div class="holder">
<iframe width="100%" height="100%" src="https://sketchfab.com/models/375ae80dc7e34b229cc9739b1ce92e2b/embed?autostart=1&autospin=0.2&controls=0&transparent=1&ui_watermark=0&stop_button=0&desc_button=0" frameborder="0" allowfullscreen mozallowfullscreen="true" webkitallowfullscreen="true" onmousewheel=""></iframe>
<a class="bouton" href="#blank">
<div class="bar">
<div class="info-bulle">
<p>Powered by <b>Sketchfab</b></p>
</div>
</div>
</a>