Skip to content

Instantly share code, notes, and snippets.

View dm03514's full-sized avatar

dm03514

View GitHub Profile
$ go tool pprof pprof/heap.3.pprof
Local symbolization failed for main: open /tmp/go-build598947513/b001/exe/main: no such file or directory
Some binary filenames not available. Symbolization may be incomplete.
Try setting PPROF_BINARY_PATH to the search path for local binaries.
File: main
Type: inuse_space
Time: Jul 30, 2018 at 6:11pm (UTC)
Entering interactive mode (type "help" for commands, "o" for options)
(pprof) svg
Generating report in profile002.svg
[14808.063890] main invoked oom-killer: gfp_mask=0x24000c0, order=0, oom_score_adj=0 [7/972]
[14808.063893] main cpuset=34186d9bd07706222bd427bb647ceed81e8e108eb653ff73c7137099fca1cab6 mems_allowed=0
[14808.063899] CPU: 2 PID: 11345 Comm: main Not tainted 4.4.0-130-generic #156-Ubuntu
[14808.063901] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
[14808.063902] 0000000000000286 ac45344c9134371f ffff8800b8727c88 ffffffff81401c43
[14808.063906] ffff8800b8727d68 ffff8800b87a5400 ffff8800b8727cf8 ffffffff81211a1e
[14808.063908] ffffffff81cdd014 ffff88006a355c00 ffffffff81e6c1e0 0000000000000206
[14808.063911] Call Trace:
[14808.063917] [<ffffffff81401c43>] dump_stack+0x63/0x90
[14808.063928] [<ffffffff81211a1e>] dump_header+0x5a/0x1c5
@dm03514
dm03514 / Makefile
Last active October 16, 2017 00:33
Documentation Through Convention
start-dev-stack:
# docker-compose
start-functional-test-stack:
# clean env that can be brought up in CI for functional tests
# this includes all inter-process dependencies required to execute functional tests
# usually includes configuring those dependencies
lint:
# run static anlysis
func main() {
flag1 := flag.TYPE....
flagn := ...
// setup signal channels to hook into ExitChan
exitChan := make(chan int)
sourceService := &Source{
NumGoRoutineConncurreny: X,
ExitChan: exitChan,
package main
func URLBody(url string) (string, error) {
resp, err := http.Get(url)
if err != nil {
return "", err
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.body)
package main
func URLBody(url string) (string, error) {
resp, err := http.Get(url)
if err != nil {
return "", err
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.body)
package main
import "net/http"
func URLBody(url string) (string, error) {
resp, err := http.Get(url)
if err != nil {
return "", err
}
defer resp.Body.Close()
func URLBody(url string) (string, error) {
resp, err := http.Get(url)
if err != nil {
return "", err
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.body)
if err != nil {
return "", err
}
@dm03514
dm03514 / main.go
Created November 13, 2016 01:23
Event Channel
type LogReader struct {
Events chan *Event
}
func (lr *LogReader) Consume() {
for event := range lr.Events {
e, err := json.Marshal(event)
if err != nil {
@dm03514
dm03514 / di_makeRequest.js
Created November 29, 2015 14:40
Dependency injection of IO function in test
var assert = require('chai').assert;
var resources = require('./resources.js');
var sinon = require('sinon');
describe('resources.js', function() {
describe('getData()', function() {
it('calls makeRequest with a built request', function() {
var makeRequest = sinon.spy();
var resource = 'a resource';