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 / zipstrip.go
Last active October 28, 2021 06:25
Go script to strip files matching a suffix from a ZIP file. I used this to strip .mp3 voicemails from my Google Voice takeout data dump, for example. "go run stripzip.go -file username@gmail.com-20140108T184123Z-Voice.zip -exclude .mp3"
package main
import (
"archive/zip"
"flag"
"io"
"log"
"os"
"strings"
)
@imjasonh
imjasonh / main.go
Created January 13, 2014 18:20
Simple script to list all GoogleCloudPlatform repos on GitHub and check for those which do not define a top-level app.yaml file.
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"strings"
)
@imjasonh
imjasonh / sockethttp.go
Created March 25, 2014 21:40
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 October 28, 2021 06:24
Script to upload a file to Drive, request it be converted to spreadsheet, then export it as CSV
package main
import (
"encoding/json"
"flag"
"io"
"log"
"net/http"
"os"
"strings"
@imjasonh
imjasonh / app.go
Last active October 28, 2021 06:23
code.google.com web hook -> fetch archive -> upload to GCS
package foo
import (
"archive/tar"
"compress/gzip"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
@imjasonh
imjasonh / writer.go
Last active October 28, 2021 06:23
Incremental GIF writer (heavily borrowed from standard library's gif.EncodeAll) -- allows frames to be added on demand
// 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"
@imjasonh
imjasonh / gist:e1d970122caa5f2e4a6a
Created May 22, 2014 00:55
HTTP server that serves a randomly generated-on-the-fly GIF (using https://gist.github.com/ImJasonH/7b309a4af2d4e32a2649)
package main
import (
"image"
"image/color"
"image/color/palette"
"log"
"math/rand"
"net/http"
"time"
package main
import (
"flag"
"fmt"
"io"
"log"
"net/http"
"os"
"path"
@imjasonh
imjasonh / app.go
Last active October 28, 2021 06:22
Script to ingest wiki dumps into CSV, eventually into BigQuery
package app
import (
"context"
"net/http"
"time"
compute "google.golang.org/api/compute/v1"
"google.golang.org/appengine"
"google.golang.org/appengine/urlfetch"
@imjasonh
imjasonh / usps.go
Last active October 28, 2021 06:22
Go script to ping the USPS package tracking API
package main
import (
"encoding/xml"
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"