Skip to content

Instantly share code, notes, and snippets.

View mjul's full-sized avatar

Martin Jul mjul

View GitHub Profile
@mjul
mjul / Dockerfile
Created August 9, 2016 14:36
Dockerfile for R with extra libraries
FROM r-base
# Install some libraries that we need for the R packages we use
# with git we can use install_github("foo/bar") from R
RUN apt-get update && \
apt-get install -y git libssl-dev libssh2-1-dev libcurl4-openssl-dev
COPY . /usr/local/src/myscripts
WORKDIR /usr/local/src/myscripts
@mjul
mjul / aws_env
Created July 8, 2016 13:32
Get environment variables from AWS profile (for use with docker-machine)
#!/bin/sh
# Set the AWS environment variables for an AWS profile
# Useful for docker-machine
#
# Example:
#
# aws_env profile-for-testing
#
# Further information:
# See the AWS CLI `aws configure`
@mjul
mjul / core.clj
Last active July 5, 2016 09:48
Convert XLS file to CSV (here just the A, B and C columns) (Clojure)
(comment
(defproject importer "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.8.0"]
[org.clojure/data.csv "0.1.3"]
[dk.ative/docjure "1.10.0"]]
@mjul
mjul / Dockerfile
Created June 2, 2016 08:53
Running R scripts in a Docker container
FROM r-base:latest
COPY . /usr/local/src/myscripts
WORKDIR /usr/local/src/myscripts
CMD ["Rscript", "myscript.R"]
@mjul
mjul / elasticsearch.fsx
Last active June 1, 2022 08:15
Elasticsearch in F# example
// paket add nuget NEST
#I "../../packages"
#r "Elasticsearch.Net/lib/net46/Elasticsearch.Net.dll"
#r "NEST/lib/net46/Nest.dll"
open System
//open Elasticsearch.Net
open Nest
@mjul
mjul / quoted.fsx
Created April 15, 2016 10:55
F# Quoted Expressions (writing a compiler)
// F# Quoted Expressions
open Microsoft.FSharp.Quotations
open Microsoft.FSharp.Quotations.Patterns
open Microsoft.FSharp.Quotations.DerivedPatterns
// A typed code quotation.
let expr : Expr<int> = <@ 1 + 1 @>
// An untyped code quotation.
@mjul
mjul / fizzbuzz.fsx
Created April 6, 2016 09:11
FizzBuzz F#
// F# FizzBuzz using Active Patterns
let (|DivisibleBy|_|) by n =
match n%by with
| 0 -> Some DivisibleBy
| _ -> None
let fizzbuzz = function
| DivisibleBy 3 & DivisibleBy 5 -> "FizzBuzz"
| DivisibleBy 3 -> "Fizz"
@mjul
mjul / chironlab.fsx
Created April 5, 2016 15:13
F# Chiron JSON serialization experiments
#I "./packages"
#r "FParsec/lib/net40-client/FParsec.dll"
#r "FParsec/lib/net40-client/FParsecCS.dll"
#r "Aether/lib/net35/Aether.dll"
#r "Chiron/lib/net40/Chiron.dll"
#r "System.Runtime.Serialization"
open Chiron
@mjul
mjul / ReactComponents.md
Last active July 29, 2017 09:01
React components
@mjul
mjul / NordicMarkets.fsx
Created March 1, 2016 10:23
World Bank TypeProvider example to get data on the major Nordic countries
// World Bank data example
// Look up some indicators for the Nordic markets
#r @"..\packages\FSharp.Data.2.2.5\lib\net40\FSharp.Data.dll"
open FSharp.Data
let wb= WorldBankData.GetDataContext()
let countries = [
wb.Countries.Denmark