Skip to content

Instantly share code, notes, and snippets.

View OlivierLi's full-sized avatar
🚀
Making things lean and fast!

Olivier Li OlivierLi

🚀
Making things lean and fast!
View GitHub Profile
###Famille "Modules"
____
####Élements
* Modules
####Relations
* Fait Partie De
* Dépend De
* Est Un
#include <stdio.h>
//This is a simple program that counts from 0 to 63 in a loop without conditional statements or use of modulo
int main(void) {
int i=0;
int cntr=0;
// 0x3f = 0011 1111
#include <stdio.h>
#include <stdlib.h>
#ifdef __APPLE__
#include <OpenCL/opencl.h>
#else
#include <CL/cl.h>
#endif
int main() {
@OlivierLi
OlivierLi / gist:9411916
Last active August 29, 2015 13:57
Connect to local service over ssh.
To use this on a remote server without making it listen to the wild, keep it listening on localhost only and on your computer you could for instance launch this:
ssh -Nf -L 9999:localhost:57575 remote-server
and then you can go to http://localhost:9999/ with ssh taking care the encrypted connection between you and the remote-server.
@OlivierLi
OlivierLi / gist:9555033
Created March 14, 2014 19:31
Deal with X freeze
Another way to deal with X freezing.
Use acpi to set your power button to switch you to console. Just edit your /etc/acpi/power.sh and change it to...
#/bin/sh
/bin/chvt 1
The acpi system is separate from the X/keyboard interface and still works. So this way you can switch to the console even if your keyboard is locked.
Note you can use other keys as well. On my laptop I use my "thinkvantage" key for this. Any key that has an associated acpi event will work.
@OlivierLi
OlivierLi / partio_write_read.cpp
Last active August 29, 2015 13:57
Write with partio
#include <iostream>
#include <fstream>
#include "Partio.h"
#include "cl.hpp"
#include "structures.h"
#include "cereal/archives/binary.hpp"
#include "profile.hpp"
@OlivierLi
OlivierLi / binary_search.cpp
Created April 1, 2014 19:18
binary_search.cpp
#include <iostream>
#include <vector>
int binary_search(std::vector<int> *sorted_data, int value, int start_index, int end_index) {
int mid_index = start_index + ( (end_index - start_index)/2) ;
if( (*sorted_data)[mid_index] == value ) {
return mid_index;
}
@OlivierLi
OlivierLi / hacker_rank.c
Created April 4, 2014 18:22
hackerrank default file
//Online version needs this define. But it gets defined twice on the local machine
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <stdio.h> /* printf, fgets */
#include <stdlib.h> /* atoi */
int main() {
@OlivierLi
OlivierLi / default.json
Created April 14, 2014 22:10
default.json
{
"particles_count" : 64000,
"particle_mass" : 0.0025,
"simulation_time" : 1,
"target_fps" : 60,
"simulation_scale" : 0.01,
"write_all_frames" : false,
"constant_acceleration" : {
"x" : 0, "y" : -9.8, "z" : 0
}
@OlivierLi
OlivierLi / result.txt
Last active August 29, 2015 14:10
Résultats préléminaires
----------------------------------------------------------
Training predictor neural_network_predictor
Result: success
Validating predictor neural_network_predictor
Mean Squared Error: 0.803143 Mean Percent Error: 12.9514%
----------------------------------------------------------
Training predictor knn_predictor
Result: success
Validating predictor knn_predictor
Mean Squared Error: 0.485454 Mean Percent Error: 9.83764%