Skip to content

Instantly share code, notes, and snippets.

View flowchartsman's full-sized avatar
🏠
Working from home

Andy Walker flowchartsman

🏠
Working from home
View GitHub Profile
@flowchartsman
flowchartsman / spooler.go
Last active August 29, 2015 14:19 — forked from burke/spooler.go
// package spooler implements a disk-persistent queue.
//
// Spooler uses MDB (LMDB) to implement a queue of byteslices. Its intended usecase
// is to enqueue work items received by a service before later working them off.
// Note that Spooler only flushes to disk up to once every 25ms. As a result,
// if the process or machine crashes unexpectedly, the most recent 25ms of work
// can be lost. This decision effectively increases throughput by 10,000%,
// but makes spooler unsuitable for jobs that absolutely cannot be allowed to fail
// under any circumstances.
package spooler
[Unit]
Description=Internet Routing Registry daemon
After=network.target
[Service]
Type=simple
ExecStart=/usr/sbin/irrd -m
[Install]
WantedBy=multi-user.target
@flowchartsman
flowchartsman / web2png.py
Last active September 1, 2015 23:20 — forked from PierrickKoch/web2png.py
Takes snapshot of full webpages using Webkit and Qt4
#!/usr/bin/env python
"""
Takes snapshot of full webpages using Webkit and Qt4
usage:
python web2png.py URL [FILE]
example:
python web2png.py http://python.org out.png
see:
http://riverbankcomputing.com/static/Docs/PyQt4/html/qwebview.html#load
@flowchartsman
flowchartsman / git_move.sh
Created October 8, 2015 15:11
moves a folder from one git repo into another repo with history intact
#!/usr/bin/env bash
# Usage:
# ./git_move.sh git@repo_site.com:/my_repo.git origin/folder/path/ /destination/repo/path/ new/folder/path/
repo=$1
folder=$2
dest_repo=$3
dest_folder=$4
clone_folder='__git_clone_repo__'
@flowchartsman
flowchartsman / pr.md
Created April 4, 2016 03:22 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

Keybase proof

I hereby claim:

  • I am alaska on github.
  • I am alaska (https://keybase.io/alaska) on keybase.
  • I have a public key ASA6ZY8rNwnzkpJ1KP4zWYQdmPXnNCRrV2dKMLzP3e2b3wo

To claim this, I am signing this object:

@flowchartsman
flowchartsman / dep.md
Created December 7, 2017 20:07 — forked from subfuzion/dep.md
Concise guide to golang/dep

Overview

This gist is based on the information available at golang/dep, only slightly more terse and annotated with a few notes and links primarily for my own personal benefit. It's public in case this information is helpful to anyone else as well.

I initially advocated Glide for my team and then, more recently, vndr. I've also taken the approach of exerting direct control over what goes into vendor/ in my Dockerfiles, and also work from isolated GOPATH environments on my system per project to ensure that dependencies are explicitly found under vendor/.

At the end of the day, vendoring (and committing vendor/) is about being in control of your dependencies and being able to achieve reproducible builds. While you can achieve this manually, things that are nice to have in a vendoring tool include:

package main
import (
"net/http"
"github.com/gorilla/mux"
)
// example of a basic handler
func fooHandler(w http.ResponseWriter, r *http.Request) {
package main
import (
"net/http"
"github.com/gorilla/mux"
)
// example of a basic handler
func fooHandler(w http.ResponseWriter, r *http.Request) {
v, ok := inter.(MyType)
if !ok {
return errors.New ("nope")
}
// becomes
switch v := inter.(type) {
case MyType:
// do MyType stuff with v