Skip to content

Instantly share code, notes, and snippets.

Paul Draper pauldraper

Block or report user

Report or block pauldraper

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
pauldraper /
Last active Aug 23, 2019
Generator vs Array vs Inline iteration

In this test, inline is 10x faster than arrayt which is 1.4x faster than generator.

pauldraper /
Last active Apr 15, 2020
Docker ECR credential helper
# A docker credential helper that automatically calls AWS CLI for docker push/pull.
cat <<EOF
grep -q 'dkr.ecr.[^.]\' - || exit
aws --output text ecr get-authorization-token --query authorizationData[0].authorizationToken \
| base64 --decode \
| sed -e 's/:/", "Secret":"/' -e 's/^/{"Username":"/' -e 's/$/"}/'
EOF | sudo tee /usr/local/bin/docker-credential-ecr-login
sudo chmod +x /usr/local/bin/docker-credential-ecr-login
pauldraper / events.ts
Last active Mar 15, 2019
OpenTracing for Node.js http
View events.ts
import { EventEmitter } from 'events';
import { globalTracer, Span } from 'opentracing';
* All events from the emitter share the same span.
export function activateEventEmitter(span: Span, emitter: EventEmitter) {
const { emit } = emitter;
emitter.emit = function(this: any) {
const args = arguments;
pauldraper / BiMap.scala
Created Dec 22, 2013
Scala BiMap - a bidirectional map for Scala
View BiMap.scala
import scala.collection.mutable.Map
class BiMap[A,B] extends BiMapHelper(Map[A,B](), Map[B,A]()) {
object BiMap {
def apply[A,B](elems:(A,B)*) = new BiMap[A,B] ++= elems
You can’t perform that action at this time.