Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Jason Hall imjasonh

🏠
Working from home
View GitHub Profile
View sockethttp.go
package sockethttp
import (
"appengine"
"appengine/socket"
"net/http"
)
// NewClient returns a new http.Client that uses the Sockets API to make requests.
@imjasonh
imjasonh / drive.go
Last active Aug 29, 2015
Script to upload a file to Drive, request it be converted to spreadsheet, then export it as CSV
View drive.go
package main
import (
"encoding/json"
"flag"
"io"
"log"
"net/http"
"os"
"strings"
@imjasonh
imjasonh / app.go
Last active Aug 29, 2015
code.google.com web hook -> fetch archive -> upload to GCS
View app.go
package foo
import (
"archive/tar"
"compress/gzip"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
@imjasonh
imjasonh / gist:e1d970122caa5f2e4a6a
Created May 22, 2014
HTTP server that serves a randomly generated-on-the-fly GIF (using https://gist.github.com/ImJasonH/7b309a4af2d4e32a2649)
View gist:e1d970122caa5f2e4a6a
package main
import (
"image"
"image/color"
"image/color/palette"
"log"
"math/rand"
"net/http"
"time"
@imjasonh
imjasonh / writer.go
Last active Aug 29, 2015
Incremental GIF writer (heavily borrowed from standard library's gif.EncodeAll) -- allows frames to be added on demand
View writer.go
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package supergif
import (
"bufio"
"compress/lzw"
"errors"
View gnod.go
package main
import (
"flag"
"fmt"
"io"
"log"
"net/http"
"os"
"path"
@imjasonh
imjasonh / noaa.go
Last active Aug 29, 2015
Go script to parse NOAA data
View noaa.go
// See ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/daily/readme.txt
package main
import (
"archive/tar"
"compress/gzip"
"errors"
"flag"
"fmt"
@imjasonh
imjasonh / README.md
Last active Aug 29, 2015
Tros lets you Sort Go structs using reflection. Get it?
View gist:25f08ceca12fcd4cb586
startup.sh
==========
set -e
set -x
DUMPFILE=$(curl http://metadata/computeMetadata/v1/instance/attributes/dumpfile -H "Metadata-Flavor: Google")
echo dumpfile $DUMPFILE
VMID=$(curl -s http://metadata/computeMetadata/v1/instance/hostname -H "Metadata-Flavor: Google" 2>&1 | cut -d. -f1)
@imjasonh
imjasonh / progress.go
Last active Aug 29, 2015
Playing around with github.com/cheggaaa/pb
View progress.go
package main
import (
"flag"
"io/ioutil"
"log"
"net/http"
"strconv"
"github.com/cheggaaa/pb"