Skip to content

Instantly share code, notes, and snippets.

View PhDP's full-sized avatar
🏠
Working from home

Philippe Desjardins-Proulx PhDP

🏠
Working from home
View GitHub Profile
@PhDP
PhDP / rh_hash_table.hpp
Created April 27, 2017 20:04 — forked from ssylvan/rh_hash_table.hpp
Quick'n'dirty Robin Hood hash table implementation. Note, I have implemented this algorithm before, with tons of tests etc. But *this* code was written specifically for the blog post at http://sebastiansylvan.com/post/robin-hood-hashing-should-be-your-default-hash-table-implementation/, it has not been extensively tested so there may be bugs (an…
#define USE_ROBIN_HOOD_HASH 1
#define USE_SEPARATE_HASH_ARRAY 1
template<class Key, class Value>
class hash_table
{
static const int INITIAL_SIZE = 256;
static const int LOAD_FACTOR_PERCENT = 90;
struct elem
@PhDP
PhDP / bond.fsx
Created February 5, 2016 01:13 — forked from evelinag/bond.fsx
Analysing box office success of James Bond films using HTML type provider
#load "packages/FsLab/FsLab.fsx"
open FSharp.Data
open XPlot.GoogleCharts
let bondUrl = "https://en.wikipedia.org/w/index.php?title=List_of_James_Bond_films&oldid=688916363"
type BondProvider = HtmlProvider<"https://en.wikipedia.org/w/index.php?title=List_of_James_Bond_films&oldid=688916363">
let bondWiki = BondProvider.Load(bondUrl)
(use '[clojure.core.match :only [match]])
(defn evaluate [env [sym x y]]
(match [sym]
['Number] x
['Add] (+ (evaluate env x) (evaluate env y))
['Multiply] (* (evaluate env x) (evaluate env y))
['Variable] (env x)))
(def environment {"a" 3, "b" 4, "c" 5})

This is my recommended path for learning Haskell.

Something to keep in mind: don't sweat the stuff you don't understand immediately. Just keep moving.

Primary course

Installing Haskell

Ubuntu PPA

@PhDP
PhDP / ecology.py
Created January 8, 2014 17:36 — forked from tpoisot/ecology.py
#! /usr/bin/python2
import json
from TwitterAPI import TwitterAPI
c_key = '...'
c_sec = '...'
t_key = '...'
t_sec = '...'
@PhDP
PhDP / scriptoria-scheme.json
Last active December 26, 2015 17:09 — forked from tpoisot/scriptoria-scheme.json
First draft of Scriptoria's JSON schema (has bugs I think).
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Scriptoria object",
"description": "Meta-data about a publication registered in scriptoria",
"type": "object",
"properties": {
"source": {
"description": "URL of the original repository",
"type": "string"
},
@PhDP
PhDP / treat_th.c
Created April 21, 2012 15:21 — forked from isag/treat_th.c
use the treads for pool replicaes
typedef struct
{
unsigned int id;
Params *p;
}
pth;
void treatments(void *param, unsigned long s)
{
//------------//
@PhDP
PhDP / create_pool.c
Created April 12, 2012 10:32 — forked from isag/create_pool.c
A way to create a species pool from assembly process
void create_assembled_pool(Params *p, double **pool, int divpool, double fert)
{
// define and initialize the ecosystem list
//-----------------------------------------
sll ecosys;
sll_init(&ecosys,(void*)free_species);
// create the basal resources
//---------------------------
basal(p,&ecosys,fert);
@PhDP
PhDP / rngint.c
Created March 30, 2012 13:02 — forked from isag/random integer
Generate integers in the semi-closed range with gsl
// clang -O3 -DHAVE_INLINE rngint.c -o rngint -lgsl -lgslcblas
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <gsl/gsl_rng.h>
#include <gsl/gsl_randist.h>
// Get an integer in the [a,b) semi-closed range.