Skip to content

Instantly share code, notes, and snippets.

View davidglassborow's full-sized avatar

David Glassborow davidglassborow

View GitHub Profile
@davidglassborow
davidglassborow / tweetwordextractor.fsx
Created November 16, 2015 13:13 — forked from spacedoom/tweetwordextractor.fsx
A simple F# script that extracts words from tweets, given a #tag and a date range. Use this script in order to extract words from tweets, given a #hashtag and a date range. Excellent for creating e.g. word clouds! NB You also have to get a copy of the stopwords.txt file (or create your own). Disclaimer: This is not a finished product. There's ro…
#I @"packages\FSharp.Data.Toolbox.Twitter.0.6\lib\net40"
#I @"packages\FSharp.Data.2.1.1\lib\net40"
#r @".\packages\FSharp.Data.Toolbox.Twitter.0.6\lib\net40\FSharp.Data.Toolbox.Twitter.dll"
#r @".\packages\FSharp.Data.2.1.1\lib\net40\FSharp.Data.dll"
open FSharp.Data.Toolbox.Twitter
// Check out https://apps.twitter.com for more info on getting key & secret!
let key = "" //Insert key here!
@davidglassborow
davidglassborow / type-dependency-graph.fsx
Created December 4, 2015 20:17 — forked from swlaschin/type-dependency-graph.fsx
This script analyzes the dependencies between top level types in a .NET Assembly. It is then used to compare the dependency relationships in some F# projects with those in some C# projects.
(*
This script analyzes the dependencies between top level types in a .NET Assembly.
It is then used to compare the dependency relationships in some F# projects with those in some C# projects.
Note that no attempt has been made to optimize the code yet!
REQUIRES:
* Mono.Cecil for code analysis
From http://www.mono-project.com/Cecil#Download
@davidglassborow
davidglassborow / Topshelf.FSharp.fs
Created December 14, 2015 19:47 — forked from haf/Topshelf.FSharp.fs
Configure TopShelf in F#
namespace Topshelf
[<AutoOpen>]
module Topshelf =
open System
open Topshelf.HostConfigurators
open Topshelf.Runtime
let configureTopShelf f =
type BusyBuilder(blockUi, unblockUi) =
member this.Bind(x, f) = async.Bind(x, f)
member this.Combine(e1, e2) = async.Combine(e1, e2)
member this.Delay(f) =
async {
blockUi ()
let! result = async.Delay f
unblockUi ()
return result
}
@davidglassborow
davidglassborow / parser.fsx
Created January 15, 2016 12:17 — forked from vgaltes/parser.fsx
Final solution
#r "../packages/FSharp.Data.2.2.5/lib/net40/FSharp.Data.dll"
open System
open System.IO
open FSharp.Data
[<Literal>]
let lineBreak = "\r\n"
type CommitInfo = {Hash : string; Author : string; TimeStamp : DateTime; Message : string}
type CommittedFile = {LinesAdded: int option; LinesDeleted: int option; FileName: string}
@davidglassborow
davidglassborow / latency.markdown
Created February 13, 2016 11:52 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@davidglassborow
davidglassborow / GIF-Screencast-OSX.md
Created September 3, 2016 08:46 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@davidglassborow
davidglassborow / 01_folds.fs
Created February 7, 2017 13:59 — forked from cloudRoutine/01_folds.fs
F# Transducers - they work for the most part
open System.Collections.Generic
open Microsoft.FSharp.Collections
[<RequireQualifiedAccess>]
module Folds =
// These are the fast implementations we actually want to use
@davidglassborow
davidglassborow / Rinkeby.md
Created January 16, 2018 11:11 — forked from learner-long-life/Rinkeby.md
How to get on Rinkeby Testnet in less than 10 minutes

How to get on Rinkeby Testnet in less than 10 minutes

Following instructions from the excellent https://www.rinkeby.io/

Synchronizing a Full Node

A full node lets you access all state. There is a light node (state-on-demand) and wallet-only (no state) instructions as well,

@davidglassborow
davidglassborow / Deploy.md
Created February 6, 2018 10:46 — forked from alfonsogarciacaro/Deploy.md
Deploying an F# ASP.NET Core app (Giraffe) to Azure

Deploying an F# ASP.NET Core app to Azure

Last week I spent a lot of time trying to deploy an F# ASP.NET Core app (a Giraffe app, specifically) to Azure because the information to complete all the steps was scattered in several places. So I'm writing this hopefully it will save the pain to others :)

Preparation

The following steps are mostly taken from this guide and it's only necessary to do them once:

  1. Create an account in Azure (or use an existing one)
  2. Create a resource group (or use an existing one)