Skip to content

Instantly share code, notes, and snippets.

@etaque
etaque / CamelApp.scala
Created February 23, 2013 08:24
Consume ActiveMQ messages with akka-camel
package org.example
import akka.actor._
import akka.camel.{ CamelMessage, Consumer, CamelExtension }
import org.apache.activemq.camel.component.ActiveMQComponent
class CdrLogConsumer extends Actor with Consumer {
def endpointUri = "activemq:FOO.BAR"
def receive = {
@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
@CarstenKoenig
CarstenKoenig / Hylo.fs
Last active February 19, 2018 07:08
Factorial using a Hylomorphism in F#
type List<'i,'r> = Nil | Cons of 'i*'r
type FixList<'i> = FixList of List<'i,FixList<'i>>
let rec fmap (f : 'a -> 'b) (l : List<'i,'a>) : List<'i,'b> =
match l with
| Nil -> Nil
| Cons (x, tail) -> Cons (x, f tail)
// you can express hylo directly without using ana and cata (by either following the
@haf
haf / A vision for F#.md
Last active March 27, 2018 00:46
A vision for F#

What should F# as a language contain?

  • A default test framework like Expecto
  • A default HTTP client like HTTP.fs
  • A default web framework like Suave
  • A default JS framework like Fable
  • A default logging framework like Logary
  • A default character parser combinator library like FParsec
  • A default binary parser combinator library like FsAttoparsec
  • A default concurrent programming framework like Hopac
@ninjarobot
ninjarobot / dotnet_sdk2_dev_env.sh
Last active April 11, 2018 03:10
Script to install a .NET Core 2.0 development environment with Mono as needed for Ionide.
# Sets up a development environment for Ubuntu 16.04.
sudo apt-get install -y curl
# Microsoft source
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
@jwmerrill
jwmerrill / gbm.jl
Last active June 29, 2018 04:49
Faster geometric brownian motion
function genS_jl(I)
s0 = 600.0
r = 0.02
sigma = 2.0
T = 1.0
M = 100
dt = T/M
a = (r - 0.5*sigma^2)*dt
b = sigma*sqrt(dt)
@swlaschin
swlaschin / ndcoslo17_fp_track.md
Created July 5, 2017 19:38
Functional Track talks from NDC Oslo 2017

Functional Track talks from NDC Oslo 2017

Also, here is the list of all videos from NDC Oslo 2017:

Wednesday 2017-06-14

@ssut
ssut / benchmark.py
Last active August 24, 2019 08:54
Python decorator endpoint implementation (like Flask blueprint module) - O(1)
#-*- coding: utf-8 -*-
import time
from collections import namedtuple
from test import ep as app
BenchResult = namedtuple('BenchResult', ['str', 'time'])
def benchmark(str, times=100000):
t_start = time.time()
for i in range(times):
@msmorul
msmorul / lync-sample1.py
Created December 10, 2013 23:31
Example python script for authenticating to Lync and creating an application endpoint that lists all of a persons contacts. Python example for what's described here https://ucwa.lync.com/documentation/keytasks-createapplication
import requests
import json
from urlparse import urlparse
sip_domain = "SIP_DOMAIN.COM"
username = "USERNAME@SIP_DOMAIN.COM"
password = "YOUR_LYNC_PASSWORD"
def extractAuthURL(str):
start = str.find('MsRtcOAuth');
@NickTyrer
NickTyrer / fsharp.fsscript
Created September 3, 2017 09:19
fsi.exe inline execution
#r @"C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Management.Automation\v4.0_3.0.0.0__31bf3856ad364e35\System.Management.Automation.dll"
open System.Management.Automation
open System.Management.Automation.Runspaces
open System
let runSpace = RunspaceFactory.CreateRunspace()
runSpace.Open()
let pipeline = runSpace.CreatePipeline()