Skip to content

Instantly share code, notes, and snippets.

@rtyley
rtyley / gist:5673862
Created May 29, 2013 21:09
Create a bad repo that contains a folder named '.git'
implicit val repo = unpackRepo("/sample-repos/example.git.zip")
implicit val (revWalk, reader) = repo.singleThreadedReaderTuple
val inserter = repo.newObjectInserter()
val badTree = Tree(Seq(Tree.Entry(".git", FileMode.TREE, abbrId("8d28f5"))))
val badTreeId = badTree.formatter.insertTo(inserter)
val treeContainingBadTree = Tree(Seq(Tree.Entry("foo", FileMode.TREE, badTreeId)))
val treeContainingBadTreeId = treeContainingBadTree.formatter.insertTo(inserter)
@rtyley
rtyley / verify-pack.txt
Created August 2, 2013 10:25
See http://stackoverflow.com/q/18010820/438886 - my particular object is 7daa9e75f86aa168748aef6c16c76b2acee1acca
This file has been truncated, but you can view the full file.
0614483723ddf336271ebb2440c023d705f18286 commit 247 167 12
4f280637fab0ebe534f29574578948e9a17845af commit 283 198 179
63cea2b1982ca95401f49980328e892638675e28 commit 242 160 377
172ca64bc5ee785745abf1f0ee9d6288cac94093 commit 247 165 537
a498008d08cd4fff61a5ab9f2cd75e00d1e779aa commit 242 164 702
ac14b7f5bcc04e17a2422d78a0d52b261597bb57 commit 242 160 866
88c60531e759371d81fed11a4c82143d65be5fcd commit 247 166 1026
56464bcbf42bb0ff63b7543ffb76ef10ebb5faa7 commit 242 163 1192
c5ddf157ceebdb5cc881ee6c3ed37bffbaf80fd0 commit 249 168 1355
6c40c0e4f697b6af7b35027e9c7be78c0f04b322 commit 250 168 1523
implicit class TextFieldOps(field: TextField) {
/** Returns a stream of text field values entered in the given text field.
*
* @param field the text field
* @return an observable with a stream of text field updates
*/
def textValues: Observable[String] = Observable {
observer => {
val reaction: Reaction = {
@rtyley
rtyley / getNewishNodeJSOnUbuntu.sh
Last active January 4, 2016 03:29
How to get a reasonably up-to-date Node.js install on Ubuntu
# nodejs packages before Ubuntu 13.10 are currently very out of date:
# http://packages.ubuntu.com/search?keywords=nodejs
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
@rtyley
rtyley / gist:b97c096ef1895a68570c
Created June 3, 2015 15:01
Running `sbt release` on guardian/content-api-scala-client
$ sbt
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar
[info] Loading global plugins from /home/rtyley/.sbt/0.13/plugins
[info] Loading project definition from /home/rtyley/development/content-api-scala-client/project/project
[info] Loading project definition from /home/rtyley/development/content-api-scala-client/project
[info] Compiling 1 Scala source to /home/rtyley/development/content-api-scala-client/project/target/scala-2.10/sbt-0.13/classes...
[info] Set current project to content-api-client (in build file:/home/rtyley/development/content-api-scala-client/)
> release
[info] Starting release process off commit: 618334c0da8ad16e24f774cfe9dd84f0af60c85d
[info] Checking remote [origin] ...
Nov 25 14:11:34 prout-bot app/web.1: [info] l.RepoSnapshot$$anon$1 - 51795214 going to do TravisCI({"script":"sbt ++$TRAVIS_SCALA_VERSION acceptance-test-buy-sub","after_script":"./test_feedback.sh"})
Nov 25 14:11:34 prout-bot app/web.1: [info] l.t.TravisApiClient - requestBuild on guardian/subscriptions-frontend response=Failure(com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'you': was expecting ('true', 'false' or 'null')
Nov 25 14:11:34 prout-bot app/web.1: at [Source: buffer(okio.GzipSource@582745c7).inputStream(); line: 1, column: 5])

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@rtyley
rtyley / Checkout
Created March 24, 2016 15:27
Jellyfish tracking
<!DOCTYPE html>
<html lang="en-GB">
/*
Analog Input
Demonstrates analog input by reading an analog sensor on analog pin 0 and
turning on and off a light emitting diode(LED) connected to digital pin 13.
The amount of time the LED will be on and off depends on
the value obtained by analogRead().
The circuit:
* Potentiometer attached to analog input 0
* center pin of the potentiometer to the analog pin
/***************************************************
This is a library example for the MLX90614 Temp Sensor
Designed specifically to work with the MLX90614 sensors in the
adafruit shop
----> https://www.adafruit.com/products/1748
----> https://www.adafruit.com/products/1749
These sensors use I2C to communicate, 2 pins are required to
interface