Skip to content

Instantly share code, notes, and snippets.

View simgt's full-sized avatar

Simon simgt

  • Réunion, France
View GitHub Profile
@simgt
simgt / host_device_transfer_bug.cpp
Last active December 18, 2015 16:39
Host-buffers to device transfer and mapping failure with an AMD GCN device
#include <CL/cl.h>
#include <iostream>
#include <vector>
#include <cassert>
#include <cstdlib>
#include <cstring>
#define STRINGIFY(s) #s
@simgt
simgt / spirit_enums.cpp
Last active September 7, 2017 07:17
Simple example of how to enumerate an enum's values (preprocessor + boost.spirit)
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix_core.hpp>
#include <boost/spirit/include/phoenix_operator.hpp>
#include <boost/spirit/include/phoenix_stl.hpp>
#include <iostream>
#include <vector>
#include <string>
std::vector<std::string> parse_enum(const std::string enum_str) {
namespace spirit = boost::spirit;
@simgt
simgt / ndarray
Last active August 29, 2015 13:58
N-dimensional preprocessor helpers for C and templated type for C++
The C implementation is rather more complex than the C++ version.
" Night Garden
" Author: Simon Guillot <[first name].[last name]@epita.fr>
" Note: Based on the Tomorrow-Night-Eighties theme
hi clear
set background=dark
if version > 580
" no guarantees for version 5.8 and below, but this makes it stop
" complaining
@simgt
simgt / Makefile
Last active August 29, 2015 14:19
Vietnamese Maze
maze : maze.o
gcc $^ -o $@
%.o : %.c
gcc -std=c99 -Wall -Werror $^ -c -o $@
@simgt
simgt / message.hpp
Created April 14, 2016 14:11
Flatbuffers, Boost.Asio, TCP
#pragma once
#include <cstdint>
#include <cassert>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
namespace net {
local torch =require 'torch'
local nn =require 'nn'
local rnn =require 'rnn'
local gnuplot = require 'gnuplot'
torch.setnumthreads(4)
print('number of threads: ' .. torch.getnumthreads())
batchSize = 16
rho = 16 -- sequence length
@simgt
simgt / split.py
Created October 10, 2017 08:48
A python script to split an image dataset
#! /usr/bin/env python3
import argparse
from pathlib import Path
from random import shuffle
import shutil
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="""
Split a dataset in two given a ratio.

Keybase proof

I hereby claim:

  • I am notsimon on github.
  • I am notsimon (https://keybase.io/notsimon) on keybase.
  • I have a public key ASDPurj1nGIr-lE381-_3Wk3Z6n2z9YbKjx2OK2_hYNImgo

To claim this, I am signing this object:

@simgt
simgt / app.py
Last active June 15, 2018 07:51
A simple and pythonic video streaming server with OpenCV and Flask
import threading
import time
import flask
import cv2
class CameraThread(threading.Thread):
def __init__(self):
super().__init__()