grafana-server --config=/usr/local/etc/grafana/grafana.ini --homepath /usr/local/share/grafana cfg:default.paths.logs=/usr/local/var/log/grafana cfg:default.paths.data=/usr/local/var/lib/grafana cfg:default.paths.plugins=/usr/local/var/lib/grafana/plugins
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tr := TestResult{ | |
URL: req.URL.String(), | |
Status: resp.StatusCode, | |
StartTime: startTime, | |
EndTime: endTime, | |
Latency: latency} | |
testResults = append(testResults, tr) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func EntryToRequest(entry *Entry) (*http.Request, error) { | |
req, _ := http.NewRequest(entry.Request.Method, entry.Request.URL, nil) | |
for _, h := range entry.Request.Headers { | |
if httplex.ValidHeaderFieldName(h.Name) && httplex.ValidHeaderFieldValue(h.Value) { | |
req.Header.Add(h.Name, h.Value) | |
} | |
} | |
for _, c := range entry.Request.Cookies { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func waitTimeout(wg *sync.WaitGroup, timeout time.Duration) bool { | |
c := make(chan struct{}) | |
go func() { | |
defer close(c) | |
wg.Wait() | |
}() | |
select { | |
case <-c: | |
return false // completed normally | |
case <-time.After(timeout): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func LoadTest(r *bufio.Reader, workers int, timeout time.Duration, u url.URL) error { | |
c, err := NewInfluxDBClient(u) | |
if err != nil { | |
useInfluxDB = false | |
log.Warn("No test results will be recorded to InfluxDB") | |
} else { | |
log.Info("Recording results to InfluxDB: ", u.String()) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// newReader returns a bufio.Reader that will skip over initial UTF-8 byte order marks. | |
// https://tools.ietf.org/html/rfc7159#section-8.1 | |
func newReader(r io.Reader) *bufio.Reader { | |
buf := bufio.NewReader(r) | |
b, err := buf.Peek(3) | |
if err != nil { | |
// not enough bytes | |
return buf | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.Commands = []cli.Command{ | |
{ | |
Name: "fetch", | |
Aliases: []string{"f"}, | |
Usage: "Fetch URLs in .har", | |
UsageText: "fetch - fetch all URLs", | |
Description: "fetch all URLs found in HAR file, saving all objects in an output directory", | |
ArgsUsage: "<.har file> <output dir>", | |
Action: func(c *cli.Context) { | |
harFile := c.Args().First() |
I hereby claim:
- I am mrichman on github.
- I am mrichman (https://keybase.io/mrichman) on keybase.
- I have a public key whose fingerprint is 9107 5C06 97D5 E564 8793 4822 EE68 4129 585B 1B3B
To claim this, I am signing this object:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wg := &sync.WaitGroup{} | |
results := make([]myType, len(sourceData) | |
for i, source := range sourceData { | |
wg.Add(1) | |
go func(i int, source mySourceType) { | |
defer wg.Done() | |
results[i] = doStuff(source) | |
}(i, source) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
public class DictionaryTest | |
{ | |
public static void Main() | |
{ | |
var cache = new Dictionary<int, int>(1000000); | |
var sw = Stopwatch.StartNew(); |