Skip to content

Instantly share code, notes, and snippets.

View montanaflynn's full-sized avatar

Montana Flynn montanaflynn

View GitHub Profile
@montanaflynn
montanaflynn / keybase.md
Created June 21, 2018 05:18
My keybase proof

Keybase proof

I hereby claim:

  • I am montanaflynn on github.
  • I am anonfunction (https://keybase.io/anonfunction) on keybase.
  • I have a public key ASDJ7jbNBlgbTot_HP-YBGppD9JHv0Mt0yV7jxoTTUE3Zwo

To claim this, I am signing this object:

@montanaflynn
montanaflynn / json-array-append.go
Last active June 15, 2020 00:21
An example of reading a json array from a file and appending a new object to it
package main
import (
"encoding/json"
"io/ioutil"
"os"
)
type User struct {
Username string `json:"username"`
@montanaflynn
montanaflynn / json-array-append.go
Created June 19, 2018 17:49
An example of reading a json array from a file and appending a new object to it
package main
import (
"encoding/json"
"io/ioutil"
"os"
)
type User struct {
Username string `json:"username"`
@montanaflynn
montanaflynn / clone.sh
Created June 4, 2018 06:13
Clone all my github repos
curl "https://api.github.com/users/montanaflynn/repos?page=1&per_page=100" |
grep -e 'git_url*' |
cut -d \" -f 4 |
xargs -L1 git clone
@montanaflynn
montanaflynn / 1.cypher
Last active April 28, 2018 09:01
Neo4j Ethereum Token Visualization
LOAD CSV WITH HEADERS FROM "https://gist.githubusercontent.com/montanaflynn/3a0da14d17d8ec19b3363551118a96c6/raw/81518288f40d342499dc862ceb94b193c81c1f8c/addresses-sample.csv" AS csvLine
CREATE (a:Address { address: csvLine.address, amount: 0});
LOAD CSV WITH HEADERS FROM "https://gist.githubusercontent.com/montanaflynn/3a0da14d17d8ec19b3363551118a96c6/raw/81518288f40d342499dc862ceb94b193c81c1f8c/transactions-sample.csv" AS csvLine
CREATE (t:Transaction { transaction: csvLine.transaction, from: csvLine.from, to: csvLine.to, amount: toInteger(csvLine.amount)});
CREATE INDEX ON :Transaction(from);
CREATE INDEX ON :Transaction(to);
MATCH (a1:Address), (a2:Address), (t:Transaction)
@montanaflynn
montanaflynn / md5.go
Created April 25, 2018 16:22
Bounded parallelism with errgroup
package main
import (
"crypto/md5"
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
@montanaflynn
montanaflynn / remainder.js
Created April 18, 2018 19:12
Division of integers while keeping the remainder
var a = 100
var b = 3
function divideWithRemainder(a, b){
return {
quotient: ~~(a / b),
remainder: a % b
};
}
@montanaflynn
montanaflynn / Dockerfile
Created March 7, 2018 03:43
Multiple stage go / javascript build
FROM golang:1.10 as builder
WORKDIR /workplace/
COPY src .
RUN go get gopkg.in/redis.v3
RUN CGO_ENABLED=0 GOOS=linux go build -o ./server
FROM node:6-alpine as minifier
WORKDIR /workplace/
COPY assets .
RUN npm install -g minifier
@montanaflynn
montanaflynn / main.go
Last active February 27, 2018 18:48
Write the current time to an image from a google cloud function in Go
package main
import (
"flag"
"net/http"
"time"
"github.com/fogleman/gg"
"github.com/golang/freetype/truetype"
"golang.org/x/image/font/gofont/goregular"
package main
import (
"crypto/sha256"
"fmt"
"strings"
"time"
)
type block struct {