To start godoc at log in time (so it always there on port 6060 when you need it):
- copy smarticus.godoc.plist to in ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/smarticus.godoc.plist
- visit http://localhost:6060
// in this case we inject the database as argument to another package | |
package httpd | |
import ( | |
"net/http" | |
"path/to/db" | |
) | |
var db *db.Database |
To start godoc at log in time (so it always there on port 6060 when you need it):
launchctl load ~/Library/LaunchAgents/smarticus.godoc.plist
A running example of the code from:
This gist creates a working example from blog post, and a alternate example using simple worker pool.
TLDR: if you want simple and controlled concurrency use a worker pool.
package main | |
const MaxLength = 1 << 20 | |
var ( | |
addr = flag.String("listen", ":8000", "listen for requests") | |
numprocs = flag.Int("p", runtime.NumCPU(), "number of workers to start") | |
maxqueue = flag.Int("q", runtime.NumCPU()*2, "largest queue size") | |
jobs chan Job |
These are the Kickstarter Engineering and Data role definitions for both teams.
package main | |
import ( | |
"bytes" | |
"compress/gzip" | |
"fmt" | |
"io" | |
"log" | |
) |
# usage: cat ~/Downloads/log_foo-bar-baz.jsonl | ruby honeybadger_parser.rb | |
require 'json' | |
data = ARGF.read | |
lines = data.split("\n") | |
grouped = lines.group_by do |line| | |
JSON.parse(line)["request"]["context"]["project_id"] | |
end |