Skip to content

Instantly share code, notes, and snippets.

Avatar

Anthony Woods woodsaj

View GitHub Profile
@woodsaj
woodsaj / ping.go
Created Sep 11, 2020
Example usage of github.com/woodsaj/go-pinger
View ping.go
package main
import (
"fmt"
"log"
"net"
"os"
"os/signal"
"strings"
"sync"
@woodsaj
woodsaj / generate-HAR.md
Created Nov 6, 2018
Instructions for generating HAR files with Chrome or Firefox
View generate-HAR.md

How to generate a HAR file in Chrome

Start by opening Google Chrome.

  • In Chrome, go to the page within our application where you are experiencing trouble

  • Select the Chrome menu (⋮) at the top-right of your browser window, then select Tools > Developer Tools.

  • The Developer Tools will open as a docked panel at the side or bottom of Chrome. Click on the Network tab.

  • Select the option Preserve log (at the top of the panel)

@woodsaj
woodsaj / lock_test.go
Created Sep 19, 2018
Benchmark to compare shared locks vs per-thread locks
View lock_test.go
package input
import (
"fmt"
"sync"
"testing"
)
// simple datastruct to provide a lock around an int variable
type Data struct {
@woodsaj
woodsaj / walk_tree.py
Last active Dec 17, 2019
Walk graphite metrics tree from specified prefix
View walk_tree.py
#!/usr/bin/python
from __future__ import print_function
import requests
import json
import argparse
try:
from Queue import Queue
except:
@woodsaj
woodsaj / goroutines.txt
Created Dec 6, 2017
MT instance not consuming
View goroutines.txt
goroutine 48039790 [running]:
runtime/pprof.writeGoroutineStacks(0x7f51e32857f8, 0xc423a2e700, 0x30, 0xc42cb497a0)
/usr/local/go/src/runtime/pprof/pprof.go:603 +0x79
runtime/pprof.writeGoroutine(0x7f51e32857f8, 0xc423a2e700, 0x2, 0xc466d92570, 0x40fdb8)
/usr/local/go/src/runtime/pprof/pprof.go:592 +0x44
runtime/pprof.(*Profile).WriteTo(0x105b820, 0x7f51e32857f8, 0xc423a2e700, 0x2, 0xc423a2e700, 0xc466d927a0)
/usr/local/go/src/runtime/pprof/pprof.go:302 +0x3b5
net/http/pprof.handler.ServeHTTP(0xc42cb493f1, 0x9, 0x7f51e1da60b0, 0xc423a2e700, 0xc432ecd600)
/usr/local/go/src/net/http/pprof/pprof.go:209 +0x1d1
net/http/pprof.Index(0x7f51e1da60b0, 0xc423a2e700, 0xc432ecd600)
@woodsaj
woodsaj / test.py
Last active Nov 30, 2017
bufferedHTTPResonse
View test.py
import sys
sys.path.append('/opt/graphite/webapp')
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'graphite.settings')
from graphite.http_pool import http
from graphite.util import unpickle
import time
import io
now = int(time.time())
View tsdb-gw.txt
fatal error: concurrent map iteration and map write
2017/09/17 17:40:37 [I] graphiteProxy: request to graphite-17303-medium-wix:8080 failed, will retry: context canceled
goroutine 21921 [running]:
runtime.throw(0x9ad065, 0x26)
/usr/local/go/src/runtime/panic.go:596 +0x95 fp=0xc4206a29e0 sp=0xc4206a29c0
runtime.mapiternext(0xc4206a2ba0)
/usr/local/go/src/runtime/hashmap.go:737 +0x7ee fp=0xc4206a2a90 sp=0xc4206a29e0
runtime.mapiterinit(0x958d80, 0xc421196030, 0xc4206a2ba0)
/usr/local/go/src/runtime/hashmap.go:727 +0x2b3 fp=0xc4206a2ae8 sp=0xc4206a2a90
View contextDemo.go
package main
import (
"context"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"strconv"
View carbon-relay-ng-on-prem.ini
## Global settings ##
instance = "on-prem"
max_procs = 4
spool_dir = "spool"
pid_file = "carbon-relay-ng.pid"
## Logging ##
# one of critical error warning notice info debug
# see docs/logging.md for level descriptions
View api_test.go
package api
import (
"io/ioutil"
"net/http"
"net/http/httptest"
"testing"
"time"
"github.com/raintank/metrictank/cluster"
You can’t perform that action at this time.