Skip to content

Instantly share code, notes, and snippets.

View davidglassborow's full-sized avatar

David Glassborow davidglassborow

View GitHub Profile
@davidglassborow
davidglassborow / index.md
Created October 27, 2015 18:18 — forked from johan/index.md
osx + java 7 = painfully easy

Step 1

Does your osx terminal speak java 7? Start Terminal.app and try: java -version:

> java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
@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
#r "packages/Twilio/lib/net451/Twilio.dll"
#r "System.Xml.Linq"
open System
open Twilio.TwiML
open Twilio.TwiML.Voice
module Model =
/// Represents what we will tell the Twilio phone system to do
type PhoneCommand =