Skip to content

Instantly share code, notes, and snippets.

@ptrelford
ptrelford / lambdaArt.go
Created September 5, 2015 10:46
Lambda Art
package main
import (
"image"
"image/color"
"image/png"
"math"
"os"
)
@ptrelford
ptrelford / goget.go
Last active August 18, 2022 14:13
Go program to download and unzip the latest specified package from Nuget
package main
import "os"
import "io"
import "fmt"
import "path"
import "net/http"
import "archive/zip"
func downloadPackage(name string) {
@ptrelford
ptrelford / gopkg.go
Created September 2, 2015 20:07
Go program to download the specified package from Nuget
package main
import "os"
import "fmt"
import "net/http"
import "io"
func downloadPackage(name string) {
url := fmt.Sprintf("https://www.nuget.org/api/v2/package/%s",name)
resp, _ := http.Get(url)
@ptrelford
ptrelford / gover.go
Created September 2, 2015 20:06
Go program to list versions of specified Nuget package
package main
import "os"
import "fmt"
import "net/http"
import "io/ioutil"
import "encoding/json"
func getVersions(name string) []string {
url := fmt.Sprintf("https://www.nuget.org/api/v2/package-versions/%s",name)
@ptrelford
ptrelford / MiniGolf.fs
Created August 24, 2015 23:05
MiniGolf with SmallSharp
open Library
GraphicsWindow.BackgroundColor <- Colors.LawnGreen
GraphicsWindow.BrushColor <- Colors.Black
let w,h = float GraphicsWindow.Width, float GraphicsWindow.Height
let holeX, holeY = w/2.0, h/4.0
GraphicsWindow.FillEllipse(holeX-20.,holeY-20.,40.,40.)
let mutable leftPressed,rightPressed,spacePressed = false, false, false
let pressed down =
#load "Fun3D.fsx"
open Fun3D
let main() =
for z in 0..2 do
for i in 0 .. 5 do
Block.block(i, 0, -z, Block.crate)
Block.block(i, -5, -z, Block.crate)
Block.block(0, -i, -z, Block.crate)
Block.block(5, -i, -z, Block.crate)
#load "Fun3D.fsx"
open Fun3D
let head =
Fun.sphere
|> Fun.color Color.yellow
let hat =
Fun.cylinder
|> Fun.color Color.purple
[<ReflectedDefinition>]
module Fun3D
#if INTERACTIVE
#r "FunScript.dll"
#r "FunScript.Interop.dll"
#r "FunScript.TypeScript.Binding.lib.dll"
#r "FunScript.TypeScript.Binding.three.dll"
#endif
@ptrelford
ptrelford / GoLangAST.fs
Created December 8, 2014 12:42
Go Lang AST (early draft)
// AST for GO lang
type packageName = string
type typeName = string
type name = string
type typ = string
type value =
| Bool of bool
| Int of int
| Float64 of double
| String of string
@ptrelford
ptrelford / TwitterDataScience.fsx
Last active August 29, 2015 14:06
FsiBot Data Science Prototype
#r "System.Windows.Forms.DataVisualization.dll"
#r @"..\packages\FSharp.Charting.0.90.7\lib\net40\FSharp.Charting.dll"
#r @"..\packages\FSharp.Data.2.0.14\lib\net40\FSharp.Data.dll"
open FSharp.Data
open FSharp.Charting
let wb = WorldBankData.GetDataContext()
type Indicator = Runtime.WorldBank.Indicator
type Indicators = WorldBankData.ServiceTypes.Indicators