Skip to content

Instantly share code, notes, and snippets.

@chrisalbright
chrisalbright / cleanup_compromized_php.sh
Created January 23, 2014 01:27
Clean up eval(base64_decode(..*)) PHP code (php hates programmers)
ack-grep -c 'eval\(base64_decode' --php | grep -ve '0$' | cut -d: -f1 | xargs perl -pi -e 's@<..*eval.base64_decode..*?>@@'
@chrisalbright
chrisalbright / index.html
Last active July 25, 2016 02:23
Bookmarklets :)
<a href='javascript:(function(){var a=alert,b=Date,c=Number,d="";if("undefined"!=typeof window.getSelection){var e=window.getSelection();if(e.rangeCount){for(var f=document.createElement("div"),g=0,h=e.rangeCount;g<h;++g)f.appendChild(e.getRangeAt(g).cloneContents());d=f.innerHTML}}else"undefined"!=typeof document.selection&&"Text"==document.selection.type&&(d=document.selection.createRange().htmlText);a(new b(c(d)));})();'>Parse Epoch</a>

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.

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
/* 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")
@chrisalbright
chrisalbright / date.abnf
Created July 7, 2016 00:07 — forked from robjens/date.abnf
A few BNF files I co(rr|ll)ected for Instaparse
; 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"

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 / ShapelessCoproduct.scala
Created May 17, 2019 21:31 — forked from fancellu/ShapelessCoproduct.scala
Examples with Shapeless 2.0, easier to understand from examples. Taken from docs, more examples/comments added etc
// 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)
@chrisalbright
chrisalbright / docker-cleanup-resources.md
Created May 17, 2019 21:38 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

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 / TypeClass.scala
Created May 28, 2019 20:34
Exploration of Type Classes in 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 {
/**