package main
import "fmt"
var (
version = "develop"
otherval = "unset"
)
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
package psutil | |
import ( | |
"fmt" | |
"log" | |
"strings" | |
"cloud.google.com/go/pubsub" | |
netcontext "golang.org/x/net/context" | |
) |
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
Thanks to Tyler Burnell, Bill Kennedy and others who had written all the boilerplate I copied in main.go and main_test.go | |
Note: the benchmark data is horribly unrealistic (10M input of either no matches or all matches), but I think the model of testing MB/sec throughput of large input sets is the right one for the problem statement. I welcome additions where we make the test data more realistic. Using a very small data set of a few hundred bytes doesn't seem like a good test | |
for stream processing algorithm performance. | |
go test -run none -bench . -benchtime 3s -benchmem | |
testing: warning: no tests to run | |
PASS | |
BenchmarkProcessByteUnmatched-8 30 143059391 ns/op 69.90 MB/s 1 B/op 1 allocs/op | |
BenchmarkProcessByteMatched-8 30 120619527 ns/op 82.91 MB/s 1 B/op 1 allocs/op |
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
go test -run none -bench . -benchtime 3s -benchmem | |
testing: warning: no tests to run | |
PASS | |
BenchmarkAlgorithmOne-4 1000000 4719 ns/op 53 B/op 2 allocs/op | |
BenchmarkAlgorithmTwo-4 3000000 1645 ns/op 0 B/op 0 allocs/op | |
BenchmarkAlgorithmThree-4 2000000 2572 ns/op 16 B/op 1 allocs/op | |
BenchmarkAlgorithmFour-4 1000000 3368 ns/op 1 B/op 1 allocs/op | |
BenchmarkAlgorithmFive-4 1000000 3423 ns/op 1 B/op 1 allocs/op |
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
// Package lambda helps create workers that run in AWS’ Lambda service. | |
// The Lambda service is designed to run Node.js programs, so we have a very thin | |
// Node.js wrapper which is essentially an adapter between our Go worker programs | |
// and Lambda. Lambda runs our Node.js wrapper/adapter which then in turn runs | |
// our Go worker programs as child processes, communicating with them via stdio pipes | |
// and Unix exit codes. | |
// | |
// The interaction between the Lambda wrapper and our Go programs works like this: | |
// | |
// * The Node.js function is invoked by Lambda. Lambda passes an `event` parameter to |
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
package main | |
// These benchmarks are used to compare how fast it is to read a set of space separated numbers from a string | |
// using different techniques. | |
// The primary motiviation for this came when writing some code for hackerrank and realizing that the parsing of numbers | |
// for large input sets was actually the bottleneck | |
// | |
// For stable results, it is recommended to increase the runtime allocated for benchmarking, such as | |
// go test -v -run none -bench . -benchtime 5s |
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
GOEDITOR="/Applications/Atom.app" | |
# practice does the following | |
# creates a new directory named after the project | |
# creates a file under that directory named $project.go with a small template | |
# NOTE: specifically not using main.go so I can distinguish the files in my editor tabs | |
# opens the file in my editor | |
# changes to the new project directory | |
practice() { | |
if [ $# -ne 1 ]; then |
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
package main | |
// This command will allow you to provision, delete, describe, or estimate the cost of the specified CloudFormation template. | |
// | |
// Once compiled use the -help flag for details. | |
import ( | |
"bufio" | |
"flag" | |
"fmt" | |
"io/ioutil" |
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
console.log('Loading function'); | |
const https = require('https'); | |
const url = require('url'); | |
// to get the slack hook url, go into slack admin and create a new "Incoming Webhook" integration | |
const slack_url = 'https://hooks.slack.com/services/...'; | |
const slack_req_opts = url.parse(slack_url); | |
slack_req_opts.method = 'POST'; | |
slack_req_opts.headers = {'Content-Type': 'application/json'}; |
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
# more detailed instructions are at http://dev.iron.io/mq-onpremise/getting_started | |
# Get a coreos VM up | |
git clone https://github.com/coreos/coreos-vagrant.git | |
cd coreos-vagrant/ | |
vagrant up | |
# get into the coreos box | |
vagrant ssh |
NewerOlder