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
{
"Title": "Flags",
"URL": "http://orange.biolab.si/datasets.psp",
"Variables": ["Landmass", "Zone", "Area", "Population", "Language", "Religion", "Bars", "Stripes", "Colors", "Red"],
"Records name": ["Afghanistan", "Albania", "Algeria", "American-Samoa", "Andorra", "Angola", "Anguilla", "Antigua-Barbuda", "Argentina", "Argentine", "Australia", "Austria", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Botswana", "Brazil", "British-Virgin-Isles", "Brunei", "Bulgaria", "Burkina", "Burma", "Burundi", "Cameroon", "Canada", "Cape-Verde-Islands", "Cayman-Islands", "Central-African-Republic", "Chad", "Chile", "China", "Colombia", "Comorro-Islands", "Congo", "Cook-Islands", "Costa-Rica", "Cuba", "Cyprus", "Czechoslovakia", "Denmark", "Djibouti", "Dominica", "Dominican-Republic", "Ecuador", "Egypt", "El-Salvador", "Equatorial-Guinea", "Ethiopia", "Faeroes", "Falklands-Malvinas", "Fiji", "Finland", "France", "French-Guiana", "French-Polynesia", "Ga
@PhDP
PhDP / flags-15.json
Created December 4, 2013 02:26
flags-15.json
{
"Title": "Flags",
"URL": "http://orange.biolab.si/datasets.psp",
"Variables": ["Landmass", "Zone", "Area", "Population", "Language", "Religion", "Bars", "Stripes", "Colors", "Red", "Green", "Blue", "Gold", "White", "Black"],
"Records name": ["Afghanistan", "Albania", "Algeria", "American-Samoa", "Andorra", "Angola", "Anguilla", "Antigua-Barbuda", "Argentina", "Argentine", "Australia", "Austria", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Botswana", "Brazil", "British-Virgin-Isles", "Brunei", "Bulgaria", "Burkina", "Burma", "Burundi", "Cameroon", "Canada", "Cape-Verde-Islands", "Cayman-Islands", "Central-African-Republic", "Chad", "Chile", "China", "Colombia", "Comorro-Islands", "Congo", "Cook-Islands", "Costa-Rica", "Cuba", "Cyprus", "Czechoslovakia", "Denmark", "Djibouti", "Dominica", "Dominican-Republic", "Ecuador", "Egypt", "El-Salvador", "Equatorial-Guinea", "Ethiopia", "Faeroes", "Falklands-Malvinas", "Fiji", "Finland", "France
@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 / gist:8262610
Created January 5, 2014 00:15
A horrible function to titleize an R string.
titleize = function(title) {
substr(title, 1, 1) = toupper(substr(title, 1, 1))
return(title)
}
@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 / foo.html
Created February 8, 2014 18:00
A simple html file for testing a regex.
<!DOCTYPE html>
<html lang="en" dir="ltr" class="client-nojs">
<body>
<div class="x">
<div id="y">
<p>This is some <b>nice</b> <i>text</i>, right?</p>
<P>This is some nice text, right?</P>
</div>
<P class="Some text" id="xyz">
<u>This</u> is some nice text, right?
@PhDP
PhDP / gist:9012512
Created February 15, 2014 00:35
Text for web requests.
<html>Test</html>
@PhDP
PhDP / gist:11275427
Created April 25, 2014 01:47
For testing...
<html>
<section>
<p>AAA</p>
</section>
<p>BBB</P>
<P id='z'>CCC</p>
<div>
<p>DDD</p>
<div>
<p>EEE</p>

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 / rounding.py
Created May 22, 2014 19:01
Why directional rounding is odd. Try with python2 (rounds ties away from zero, which is bad) and python3 (rounds ties to nearest even number).
from random import randint as rand
max = 10000000
sum = 0
sumR = 0
for i in range(0, max):
x = rand(1, 1000) / 2.0
sum += x
sumR += round(x)
print((sumR - sum) / max)