Skip to content

Instantly share code, notes, and snippets.

View ec2-configure-service-discovery-registration.sh
#! /bin/bash
EC2_METADATA=http://169.254.169.254/latest
REGION=$(curl -s $EC2_METADATA/dynamic/instance-identity/document | jq -r '.region')
INSTANCE_ID=$(curl -s $EC2_METADATA/meta-data/instance-id);
INSTANCE_IP=$(curl -s $EC2_METADATA/latest/meta-data/local-ipv4);
cat > /etc/init.d/cloudmap-register <<-EOF
#! /bin/bash -ex
aws servicediscovery register-instance \
View gist:a9fa47ef09a2daa2ca5c9aca1fc73207
Largest 1000 Cities in America
2013 popuation data - Biggest US Cities By Population
rank,city,state,population,2000-2013 growth
1,New York,New York,8405837,4.8%
2,Los Angeles,California,3884307,4.8%
3,Chicago,Illinois,2718782,-6.1%
4,Houston,Texas,2195914,11.0%
5,Philadelphia,Pennsylvania,1553165,2.6%
@chrisalbright
chrisalbright / TypeClass.scala
Created May 28, 2019
Exploration of Type Classes in Scala
View TypeClass.scala
/**
* I'm trying to learn type classes in Scala. I've got
* a decent handle on Scala itself, but the intricacies
* of the Type system are still foreign to me.
*
* I decided to start with what I thought would be a
* simple enough problem: Convert a Thing into a String
*/
object TypeClass {
/**
@chrisalbright
chrisalbright / docker-cleanup-resources.md
Created May 17, 2019 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks
View docker-cleanup-resources.md

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@chrisalbright
chrisalbright / ShapelessCoproduct.scala
Created May 17, 2019 — forked from fancellu/ShapelessCoproduct.scala
Examples with Shapeless 2.0, easier to understand from examples. Taken from docs, more examples/comments added etc
View ShapelessCoproduct.scala
// Coproduct is extension of Either concept, to N multually exlusive choices
type ISB = Int :+: String :+: Boolean :+: CNil
val isb = Coproduct[ISB]("foo") //> isb : qaaz.ISB = foo
isb.select[Int] //> res0: Option[Int] = None
isb.select[String] //> res1: Option[String] = Some(foo)
View keybase.md

Keybase proof

I hereby claim:

  • I am chrisalbright on github.
  • I am chrisalbright (https://keybase.io/chrisalbright) on keybase.
  • I have a public key ASCdMBAs9JenzGWR0Py3YKnO1jGUeVRGA8bofGT2OTcl3Qo

To claim this, I am signing this object:

@chrisalbright
chrisalbright / date.abnf
Created Jul 7, 2016 — forked from robjens/date.abnf
A few BNF files I co(rr|ll)ected for Instaparse
View date.abnf
; http://www.ietf.org/rfc/rfc3339.txt
; and http://www.odata.org/documentation/odata-version-3-0/abnf/
oneToNine = "01" / "02" / "03" / "04" / "05" / "06" / "07" / "08" / "09"
zeroToNine = "00" / oneToNine
oneToTwelve = oneToNine / "1" ( "0" / "1" / "2" )
oneToThirteen = oneToTwelve / "13"
View MultipleOutputsExample.scala
/* Example using MultipleOutputs to write a Spark RDD to multiples files.
Based on saveAsNewAPIHadoopFile implemented in org.apache.spark.rdd.PairRDDFunctions, org.apache.hadoop.mapreduce.SparkHadoopMapReduceUtil.
val values = sc.parallelize(List(
("fruit/items", "apple"),
("vegetable/items", "broccoli"),
("fruit/items", "pear"),
("fruit/items", "peach"),
("vegetable/items", "celery"),
("vegetable/items", "spinach")
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
View v2mom-template.md

Your Vision

What is a vision?

Your vision answers the question "What do I want?" A clear vision help you communicate why you're here and what impact you're going to have.

Your vision should be aligned with the company vision, with your manager's V2MOM, and it should be personal. It should be an honest reflection of your own vision for your own work.

If you manage a team, it should be reflective of the purpose of the team and your collective impact.