This captures notes around problems I encountered while working through R for Data Scientists.
On OSX, the installation of xml2 fails with an error:
Configuration failed because libxml-2.0 was not found.
| #!/bin/bash -ex | |
| # | |
| # Collection of tools I like to have installed locally. | |
| # | |
| go install golang.org/x/tools/cmd/...@master | |
| go install golang.org/x/perf/cmd/...@master | |
| # Go documentation server. |
| /* | |
| Create a string usage a web-safe version of the specified background color. | |
| The foreground will be set to an inverse color for legibility. | |
| Untested and definitely broken. | |
| */ | |
| func decorate(bgColor color.Color, s string) string { | |
| fgColor := inverse(bgColor) |
| #!/bin/bash | |
| set -euo pipefail | |
| # | |
| # Tidies up the remote and local references of a Git repository. | |
| # | |
| # By default, it assumes that origin/master is the mainline branch. | |
| # | |
| GIT_UPSTREAM_REMOTE=${GIT_UPSTREAM_REMOTE:-origin} |
This captures notes around problems I encountered while working through R for Data Scientists.
On OSX, the installation of xml2 fails with an error:
Configuration failed because libxml-2.0 was not found.
| package main_test | |
| import ( | |
| "testing" | |
| ) | |
| /* | |
| This is an example implementation of a golden file test that is easy to update. | |
| */ |
| PACKAGE ?= lambda.zip | |
| HANDLER ?= main | |
| all: $(PACKAGE) | |
| .PHONY: clean | |
| clean: | |
| rm -f $(PACKAGE) | |
| $(PACKAGE): $(HANDLER) |
I hereby claim:
To claim this, I am signing this object:
| package math | |
| // Average returns the floor of the average of two signed integers without risk of overflow. | |
| // | |
| // See: http://aggregate.org/MAGIC/#Average%20of%20Integers | |
| func Average(x, y int64) int64 { | |
| return (x & y) + ((x ^ y) >> 1) | |
| } |
| #!/bin/bash | |
| # | |
| # This script finds incoming PR branches from a GitHub based remote. | |
| # | |
| # Example | |
| # | |
| # $ git checkout -b incoming origin/master | |
| # $ git incoming origin | xargs git merge | |
| # |
| #!/bin/bash | |
| # | |
| # Generate benchmark files in a Git repository. | |
| # | |
| # Usage: TIMES=1 go-bench [prefix] | |
| # | |
| # Number of times to run the benchmark; useful for benchstat. | |
| TIMES=${TIMES:-1} |