Skip to content

Instantly share code, notes, and snippets.

@sjwhitworth
sjwhitworth / gc.go
Created April 14, 2019 19:54
Strings vs. bytes
// main.go
package main
import (
"bytes"
"fmt"
"strings"
)
func main() {
@sjwhitworth
sjwhitworth / iphone6_coventgarden.py
Created October 19, 2014 13:11
iPhone 6 Stock Checker
import requests
import datetime
import time
url = "https://reserve.cdn-apple.com/GB/en_GB/reserve/iPhone/availability.json"
interested_stores = ['R245']
# Exclude iPhone 6
excluded = ['MGA92B/A', 'MGA92B/A', 'MGAJ2B/A', 'MGAE2B/A', 'MGAA2B/A',
'MGAK2B/A', 'MGAF2B/A', 'MGA82B/A', 'MGAH2B/A', 'MGAC2B/A']
@sjwhitworth
sjwhitworth / irisclassification.go
Last active January 2, 2016 07:19
KNN classification of the Iris dataset using github.com/sjwhitworth/golearn
package main
import (
mat "github.com/skelterjohn/go.matrix"
base "golearn/base"
util "golearn/utilities"
knnclass "golearn/knn"
"fmt"
)
<script>
var width = 1500;
var height = 1500;
var color = d3.scale.linear()
.domain([0, 350000])
.range(["white", "#3498db"]);
var div = d3.select("body").append("div")
.attr("class", "tooltip")
.style("opacity", 0.8);