Skip to content

Instantly share code, notes, and snippets.

View wolfeidau's full-sized avatar
🐺
Building data science projects

Mark Wolfe wolfeidau

🐺
Building data science projects
View GitHub Profile
@wolfeidau
wolfeidau / main.go
Last active August 29, 2015 14:01
Overcoming the comodo certificate issue with golang see http://bridge.grumpy-troll.org/2014/05/golang-tls-comodo/
package main
// note the addition of sha512 to overcome it not being in the available algorythms.
import (
_ "crypto/sha512"
"crypto/tls"
"fmt"
"log"
"net/http"
)
@wolfeidau
wolfeidau / build.sh
Last active August 29, 2015 14:03
build.sh for golang
#!/usr/bin/env bash
set -e
#
# So https://github.com/wolfeidau/somproject
#
OWNER=wolfeidau
BIN_NAME=somproject
PROJECT_NAME=somproject
@wolfeidau
wolfeidau / ansible-vaulter
Created July 18, 2014 02:12
Ansible Vault 1pass helper script
#!/bin/bash
if [ "$3" = "" ]
then
echo "Usage: $0 <action> <1pass login> <file path>"
exit 1
fi
PASS=$(1pass $2)
if [ $PASS = "" ]
@wolfeidau
wolfeidau / main.go
Created July 30, 2014 04:18
Lifx sniffer hack
package main
import (
"log"
"net"
)
const (
broadcastPort = 56700
peerPort = 56750
@wolfeidau
wolfeidau / main.go
Last active August 29, 2015 14:05
golang ssl output from test server
openssl s_client -host localhost -port 8443 -tls1
CONNECTED(00000003)
depth=0 /O=Acme Co
verify error:num=20:unable to get local issuer certificate
verify return:1
depth=0 /O=Acme Co
verify error:num=21:unable to verify the first certificate
verify return:1
---
Certificate chain
@wolfeidau
wolfeidau / events.go
Created August 31, 2014 03:57
kako types
type Event struct {
UserID string // GUID of the user who owns this series
Key string // name of the series, otherwise known as key
Measurement *Measurement // measurement
LogEntry *LogEntry // log event
Timestamp time.Time // when measurement was taken
}
func (e *Event) ToRowMap() map[string]bigquery.JsonValue {
@wolfeidau
wolfeidau / gist:5d55f356003d883f1a76
Last active August 29, 2015 14:07
Adding security updates to your block, this applies to Beagle Bone Whites ONLY

Update the /etc/apt/sources.list by adding the following lines.

deb http://ports.ubuntu.com/ubuntu-ports/ precise-security main universe multiverse
deb-src http://ports.ubuntu.com/ubuntu-ports/ precise-security main universe multiverse

Then to update the cache run.

@wolfeidau
wolfeidau / gist:a9536aebb27d0843da19
Created November 3, 2014 04:20
Output of hg diff for godoc.
diff -r a76f677e1aa9 godoc/server.go
--- a/godoc/server.go Sat Oct 18 14:39:02 2014 +0400
+++ b/godoc/server.go Mon Nov 03 15:20:00 2014 +1100
@@ -542,16 +542,15 @@
fmt.Fprintf(&buf, "<span style='color: grey'>[%s]</span><br/>", htmlpkg.EscapeString(status))
}
- buf.WriteString("<pre>")
+ buf.WriteString("<table class='highlighttable'><tr>")
formatGoSource(&buf, src, fi.Links, h, s)
@wolfeidau
wolfeidau / shards.json
Created November 21, 2014 03:54
Influxdb configuration and sample data
{
"spaces": [
{
"name": "everything_2d",
"retentionPolicy": "2d",
"shardDuration": "2d",
"regex": "/^[0-9]+.*/",
"replicationFactor": 1,
"split": 1
},
@wolfeidau
wolfeidau / login.go
Created December 29, 2014 06:05
hacking on auth with gh and JWT
func (gp *GithubProvider) HandleLogin(w http.ResponseWriter, r *http.Request) {
// var user models.User
// s := sessions.GetSession(r)
// if val := s.Get("user"); val != nil {
// v := val.([]byte)
// json.Unmarshal(v, &user)