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
@mullr
mullr / core_match.clj
Created August 4, 2015 15:33
simplifier-clojure
(ns clj-automated-reasoning.core-match
(:require [clojure.core.match :as cm]))
(defn simplify1 [e]
(cm/match [e]
[(['+ 0 x] :seq)] x
[(['+ x 0] :seq)] x
[(['* x 1] :seq)] x
[(['* 1 x] :seq)] x
[(['* x 0] :seq)] 0
#include <RcppArmadillo.h>
#include <omp.h>
using namespace Rcpp;
using namespace arma;
// [[Rcpp::depends(RcppArmadillo)]]
// [[Rcpp::plugins(openmp)]]
// [[Rcpp::export]]
void updateImplicitX_p(arma::mat & X, const arma::mat & Y, const arma::mat & P, const arma::mat & C, double lambda, int cores = 1) {
@johnmyleswhite
johnmyleswhite / gist:14dbd928019669faef82
Last active August 29, 2015 14:06
Benchmarking Resources
@bitemyapp
bitemyapp / gist:8739525
Last active May 7, 2021 23:22
Learning Haskell
@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 = '...'
@tpoisot
tpoisot / ecology.py
Created January 8, 2014 17:15
Read random tweets, and tweets mentioning words related to ecology
#! /usr/bin/python2
import json
from TwitterAPI import TwitterAPI
c_key = '...'
c_sec = '...'
t_key = '...'
t_sec = '...'
@PhDP
PhDP / Titles.fs
Last active December 31, 2015 18:49
Get titles from arXiv's Stat.ML
open System.Xml.Linq
open FSharp.Data
/// Use F#'s awesome type provider to access arXiv's API.
type StatML = XmlProvider<"http://export.arxiv.org/api/query?search_query=stat.ML&start=0&max_results=1000">
/// Request Stat.ML articles from 'a' to 'b'.
let APIReq (a: int) (b: int) =
"http://export.arxiv.org/api/query?search_query=stat.ML&start=" + (string a) + "&max_results=" + (string b)
@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"
},
@tpoisot
tpoisot / scriptoria-scheme.json
Created October 27, 2013 17:25
Scheme for scriptoria papers
{
"$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": "URI of the original repository",
"type": "string"
},
@PhDP
PhDP / measure.cc
Last active December 20, 2015 07:29
The measure as defined in the Porter algorithm.
/**
* Computes the measure of an English word as defined for the Porter algorithm.
* The definition of the measure can be found here:
* http://snowball.tartarus.org/algorithms/porter/stemmer.html
*
* ...but it's overtly complicated. Here's my definition:
*
* The *measure* of a word is the number of vowels followed by a consonant.
*
* Examples: