Skip to content

Instantly share code, notes, and snippets.

View cyrildiagne's full-sized avatar

Cyril Diagne cyrildiagne

View GitHub Profile
@atduskgreg
atduskgreg / build_graph.cpp
Created August 9, 2012 06:46
Calculate DAG of vertex connectivity for ofMesh, use that DAG to perform a Laplacian smooth
typedef map<ofIndexType, vector<ofIndexType> > VertexGraph;
// build a DAG representing the connectivity
// between vertices in a mesh
// assumes vertices are inserted as triangles
// i.e. each triplet of vertices is treated as the corners
// of a single triangle
VertexGraph testApp::buildGraph(ofMesh &m){
typedef VertexGraph::iterator I;
@roxlu
roxlu / VideoSurface.cpp
Created January 29, 2013 11:25
Fast texture uploads using pixel buffer objects. Improved upload of a 768x1366 texture from 16-20ms to 1-3ms (we can improve the performance a bit more by using GPU default pixel formats)
#include <shared/VideoSurface.h>
GLuint VideoSurface::prog = 0;
GLint VideoSurface::u_pm = 0;
GLint VideoSurface::u_mm = 0;
GLint VideoSurface::u_tex = 0;
GLfloat VideoSurface::pm[16] = {0};
VideoSurface::VideoSurface()
:width(0)
@zarya
zarya / gist:f6c94d37d861a9079710
Created October 2, 2014 08:37
ESP8266 toggle GPIO pin example
diff --git a/user/at_ipCmd.c b/user/at_ipCmd.c
index 7c3be3c..4ae7fd3 100644
--- a/user/at_ipCmd.c
+++ b/user/at_ipCmd.c
@@ -24,9 +24,11 @@ uint16_t at_tranLen; //now is 256
os_timer_t at_delayChack;
BOOL IPMODE;
-static BOOL at_ipMux = FALSE;
+static BOOL at_ipMux = TRUE;
@montanaflynn
montanaflynn / pget.go
Last active October 21, 2023 06:12
Bounded Parallel Get Requests in Golang
package main
import (
"fmt"
"net/http"
"sort"
"time"
)
// a struct to hold the result from each request including an index
@duhaime
duhaime / example.py
Created September 25, 2018 16:27
lloyd's algorithm
import numpy as np
import umap
# generate some points in 4D
points = np.random.random((2000, 4))
# project the points to 2D to get points proximate to one another
points = umap.UMAP().fit_transform(points)
from lloyd.lloyd import Field
@kylemcdonald
kylemcdonald / auction.py
Created December 24, 2018 10:35
Auction algorithm using numba.
from numba import jit
import numpy as np
index_dtype = np.int32
cost_dtype = np.int32
@jit(nopython=True)
def auction(a, eps=1):
n = len(a)
p = np.zeros(n, dtype=cost_dtype)
@rom1504
rom1504 / distributed_dalle2_laion.md
Last active June 28, 2024 03:18
distributed dalle2 laion