Skip to content

Instantly share code, notes, and snippets.

Avatar

Cedric Pinson cedricpinson

View GitHub Profile
@cedricpinson
cedricpinson / stb_resize.h
Last active Feb 5, 2022
stb_resize kernel downsampling
View stb_resize.h
/* 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 Aug 2, 2020
helper to flamegraph a command
View flamegraph.fish
# 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
View gist:c2026e761202d4637b292b562a30bd5a
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 Mar 25, 2019
Testing Handle List
View HandleList.h
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;
View Test configurator
{
"config": [
{
"default": "#64584F",
"material": "paint",
"name": "Paint",
"options": [
{
"color": "#64584F",
"name": "Brown"
@cedricpinson
cedricpinson / parser.py
Created Feb 13, 2018
Parse csv data in python
View parser.py
#!/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 Feb 13, 2018
parsing csv data in different languages
View parser.md
@cedricpinson
cedricpinson / parser.rs
Last active Feb 12, 2018
parser csv data in rust
View parser.rs
// -*- 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 Feb 10, 2018
parse a data.csv in go
View parser.go
// -*- compile-command: "go run *.go sample.csv" -*-
package main
import (
"bufio"
"encoding/json"
"fmt"
"io"
"os"
View index.html
<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>