Skip to content

Instantly share code, notes, and snippets.

@halcwb
halcwb / docker_volumes.sh
Last active June 26, 2016 09:33
Small shell command to list or remove docker volumes
#!/usr/bin/env bash
# Get the current docker version
echo "List or remove docker volumes"
echo "This only works for docker version 1.9 or higher"
echo "Docker version:"
docker -v
# Differentiate remove command for linux and os x
@halcwb
halcwb / pdf2eps.sh
Created June 29, 2016 09:35
Convert a pdf file to eps
#!/bin/sh
# $Id: pdf2eps,v 0.01 2005/10/28 00:55:46 Herbert Voss Exp $
# Convert PDF to encapsulated PostScript.
# usage:
# pdf2eps <page number> <pdf file without ext>
pdfcrop $2.pdf
pdftops -f $1 -l $1 -eps "$2-crop.pdf"
rm "$2-crop.pdf"
mv "$2-crop.eps" $2.eps
@halcwb
halcwb / destructuring.md
Created February 22, 2018 21:08 — forked from yang-wei/destructuring.md
Elm Destructuring (or Pattern Matching) cheatsheet

Should be work with 0.18

Destructuring(or pattern matching) is a way used to extract data from a data structure(tuple, list, record) that mirros the construction. Compare to other languages, Elm support much less destructuring but let's see what it got !

Tuple

myTuple = ("A", "B", "C")
myNestedTuple = ("A", "B", "C", ("X", "Y", "Z"))
@halcwb
halcwb / StringParser.fsx
Created March 16, 2019 16:19
Parsing a data set with strings to required types and restore to cleaned up string data
module StringParser =
open System
type StringParserType =
| IntType
| FloatType
| BoolType
| DateTimeType
@halcwb
halcwb / DragDropPage.fs
Created December 23, 2020 18:23 — forked from JordanMarr/DragDropPage.fs
Fable bindings for "react-dnd" using HTML5 provider
module DragDropPage
open Feliz
open Fable.React
open Fable.React.Props
open ReactDND
type Language = {
Name: string
}
@halcwb
halcwb / ObservationAlgo.fsx
Last active March 22, 2021 08:33
Algorithm to process Signals to Observations
open System
open System.IO
fsi.AddPrinter<DateTime> (fun dt -> dt.ToString("dd-MM-yyyy HH:mm"))
module Types =
@halcwb
halcwb / ThrowAwayDb.fsx
Last active June 23, 2021 14:37
A functional equivalent of Zaid Ajaj's ThrowAwayDb
#r "nuget: Microsoft.Data.SqlClient"
#r "nuget: Informedica.Utils.Lib"
open System
open System.IO
open Microsoft.Data.SqlClient
open Informedica.Utils.Lib
open Informedica.Utils.Lib.BCL
@halcwb
halcwb / OncoSepsis.fsx
Created March 17, 2021 08:45
OncoSepsis
#r "nuget: SqlProvider"
#r "nuget: FSharp.Stats"
#r "nuget: Plotly.NET, 2.0.0-beta5"
#r "nuget: Informedica.Utils.Lib"
open System
open System.Text
open FSharp.Data.Sql
#r "nuget: MathNet.Numerics.FSharp"
#r "nuget: Expecto"
#r "nuget: Expecto.FsCheck"
#time
module BigInteger =
// throw this line first to the fsi
#load "../Scripts/load.fsx"
#time
open Informedica.GenSolver.Lib
open System
open System.IO