Skip to content

Instantly share code, notes, and snippets.

View imjasonh's full-sized avatar
🏠
Working from home

Jason Hall imjasonh

🏠
Working from home
View GitHub Profile
@imjasonh
imjasonh / stats.html
Last active December 17, 2015 02:28
WIP d3.js-based version of Flywheel stats visualization
<html>
<head>
<style>
body {
font-family: Arial, sans-serif;
padding: 0;
margin: 0;
}
@imjasonh
imjasonh / cp.go
Created May 13, 2013 14:20
Examples for image copying and GIF exploding in Go
package main
import (
"flag"
"io"
"log"
"os"
)
var (
@imjasonh
imjasonh / airports.go
Created May 15, 2013 18:09
Go script to get the distance between two airports. I may someday make this an App Engine app w/ API, or accumulate multiple trips together. Sometimes I get curious how far I've flown so far this year.
package main
import (
"encoding/json"
"flag"
"fmt"
"log"
"math"
"net/http"
)
@imjasonh
imjasonh / flywheel.go
Created July 12, 2013 20:48
Beginnings of an App Engine app to ingest Flywheel spreadsheets and produce JSON which can be played with using D3 (see https://gist.github.com/ImJasonH/5535583)
package flywheel
import (
"archive/zip"
"encoding/json"
"fmt"
"log"
"strconv"
"time"
@imjasonh
imjasonh / links.go
Created November 20, 2013 01:56
Script to scrape links (or imgs, scripts, etc.) from a web page -- could be incorporated into a simple crawler or mass downloader
@imjasonh
imjasonh / README.md
Last active October 28, 2021 06:26
Simple reusable Set minilibrary for Go. Doesn't have any type checking (lolgenerics), just using interface{}. Something like this has come in handy enough times in the past, even without generics/typing, that I think it's worth jotting down.

GoDoc

@imjasonh
imjasonh / resize.go
Created December 13, 2013 20:14
Resize a PNG image, optionally delineating individual pixels
package main
import (
"flag"
"image"
"image/color"
"image/png"
"log"
"os"
)
@imjasonh
imjasonh / cursor.html
Created December 22, 2013 23:05
Make the cursor move a little more naturally
<html><head><body>
<script type="text/javascript">
var _CURSOR_ID = '___cursorDiv';
var _CURSOR_IMG_WIDTH = '13px';
var _CURSOR_IMG_HEIGHT = '21px';
var _CURSOR_URL = "url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAVCAYAAACdbmSKAAAOPWlDQ1BJQ0MgUHJvZmlsZQAAeAGtl3k0lV37x/cZHfOYMRzKkHkeMs8ZM5Yp8xiO4xhCSBEyKzMhJEM9MkUDKVPmqQwRMkXKGJHwu+V517N+fzzr/efda+17f/a+r33d676/+5zvugCgdLPH4z3hAAAvnB/BWEsVa25hiSUaBQgAB0SAAQB7R1+8iqGhHhTyL21nBMCObw0LHuf6l6B/W6YgQA8EACYABdC5nrDyMTucsOkxX/PD+0Exbsfs6GbvBHEIxAIEU2M1iEshpnA94YZjdjjhd8cc4Oh6vHcMADQNzskdBwDRN4gVnZx9HaHbx891cvJ19II4GeIwLy9vKD8lFcS8jngCtJdSBmLB4+8CjVCzhPKKV0B5kv5ZC4By1cUAwO3zzxoXFEO/BMBDrn/Wtoz/fCsYfb+vi7jYn3QwMlUAUFNHR1vcUM67ABykHB3tFx4dHRQBgJgEoNnT0Z8Q8CcWehFYLwD/bX7yzn/vQEDiQALDrOBbyEDUGpE7Zo7EmXSW/DLFMJUxdRetBt1r+vMMdUz8zAWnmViT2THYUI61M45n33Nr8lSfw/Il8O8I2gm1iQiIJoqtSRhIlknDZaxkn8oh5c0UihXXleVUIlQ71Mk0DDQTtLq10ToqukF6T/UXLjIZ6hkFG5ebjJkhL4lctjK/ZVFmOWC1c4XFRsHW3u6m/QOHZscpp30XRldxNwN3t6s3PNI9n3i9xY16r+APCJS+7H7C/ooButfMA52CcMGB18NDYkKTwlJvZIXn3sy7VRDxI
@imjasonh
imjasonh / README.md
Last active October 28, 2021 06:25
Utility script to generate random strings of a user-defined length from a user-provided alphabet

GoDoc

@imjasonh
imjasonh / analytics.go
Created January 7, 2014 17:49
Simple client for the Google Analytics Measurement Protocol (https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters), to report events to Google Analytics. Also a half-baked example of using reflection and struct tags to generate URL query parameters.
// See https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters
//
// Usage:
// req, _ := analytics.Request{
// HitType: analytics.PageView,
// TrackingID: "UA-XXXX-Y",
// ClientID: "35009a79-1a05-49d7-b876-2b884d0f825b",
// // ...
// }.Request()
// resp, _ := req.Do()