Skip to content

Instantly share code, notes, and snippets.

View gunnaraasen's full-sized avatar

Gunnar gunnaraasen

View GitHub Profile
@gunnaraasen
gunnaraasen / jsontickscript.go
Last active April 12, 2018 23:44
Marshal a TICKscript into JSON
// This small script will marshal a tickscript into JSON.
// The script can be run using the following commands (Go must be installed):
//
// go get -u github.com/influxdata/chronograf
// go run jsontickscript.go
package main
import (
"fmt"
@gunnaraasen
gunnaraasen / influx-coinbase.go
Last active December 25, 2021 03:23
The following script will capture the prices for BTC-USD orders published via the Coinbase Exchange websocket feed and send the prices as points to a locally running instance of InfluxDB.
package main
import (
"fmt"
"net/url"
websocket "github.com/gorilla/websocket"
influxdb "github.com/influxdb/influxdb/client/v2"
exchange "github.com/preichenberger/go-coinbase-exchange"
)
@gunnaraasen
gunnaraasen / curl-logs
Created July 16, 2015 22:04
InfluxDB 0.9.1 logs for issue
HTTP/1.1 500 Internal Server Error
Request-Id: d269aaa2-2bf9-11e5-8009-000000000000
X-Influxdb-Version: 0.9.1
Date: Thu, 16 Jul 2015 20:32:53 GMT
Content-Length: 8
Content-Type: text/plain; charset=utf-8
timeout
HTTP/1.1 100 Continue
Verifying that +gunnar is my openname (Bitcoin username). https://onename.io/gunnar
/**
* Looks up an address' probable ZIP code using the Google
* geocoder.
*
* @param {string} address An address string.
* @return The ZIP of first matched address.
* @customfunction
*/
function getZip(address) {
if (address == '') {
@gunnaraasen
gunnaraasen / Github_org_bomb
Created September 4, 2014 15:46
Download of an organization's repos and remote branches
# Download all of an organization's repos
curl -s https://api.github.com/orgs/twitter/repos?per_page=200 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'
# Track all remote branches with a local branch, fetch them, and pull to update.
for remote in `git branch -r`; do git branch --track $remote; done
git fetch --all
git pull --all
@gunnaraasen
gunnaraasen / fmt.Println-error.go
Created February 1, 2014 01:47
Error: multiple-value filepath.Abs() in single-value context
fmt.Println("Serving files from" + filepath.Abs(string(directory)))
@gunnaraasen
gunnaraasen / gist:8153965
Created December 27, 2013 23:13
Example program for merging a csv file with a much larger csv file. This program is specifically for merging voter addresses and precinct polling locations.
package main
import (
"encoding/csv"
"fmt"
"io"
"os"
"strings"
)
@gunnaraasen
gunnaraasen / README.md
Created March 20, 2012 17:16 — forked from necolas/README.md
Experimenting with component-based HTML/CSS naming and patterns

Template Components

Used to provide structural templates.

Pattern

t-template-name
t-template-name--modifier-name
t-template-name__subcomponent-name--subcomponent-modifier-name