Skip to content

Instantly share code, notes, and snippets.

Colin Webb cjwebb

Block or report user

Report or block cjwebb

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
@cjwebb
cjwebb / Scala.Dockerfile
Created Aug 25, 2018
Scala SBT dockerfile - runs SBT to build, and then copies on the jar to the alpine java image
View Scala.Dockerfile
# This uses the Docker builder pattern.
# The first container runs SBT to stage our application.
# todo - use a Docker image that has already downloaded SBT
FROM hseeberger/scala-sbt AS builder
WORKDIR /app
COPY src src
COPY project project
COPY build.sbt build.sbt
RUN sbt stage
View tail-kinesis.sh
if [ -z "$1" ]
then
echo "Usage: ./kinesis-messages.sh <stream-name>"
exit 1
fi
streamname=$1; aws kinesis describe-stream --stream-name $streamname --output text | grep SHARDS | awk '{print $2}' | while read shard; do aws kinesis get-shard-iterator --stream-name $streamname --shard-id $shard --shard-iterator-type LATEST --output text | while read iterator; do while output=`aws kinesis get-records --shard-iterator $iterator --output text`; do iterator=`echo "$output" | head -n1 | awk '{print $2}'`; echo "$output" | awk 'NR > 1' | grep RECORDS | while read record; do echo $record | awk '{print $3}' | base64 -D | jq .; done; done; done; done
@cjwebb
cjwebb / cilic_v_berankis.txt
Created Jan 6, 2016
tennis scores, point by point, of a match at wimbledon 2015
View cilic_v_berankis.txt
Berankis 15:0 15:15 15:30 15:40, BP 6-3 4-6 7-6 4-6 7-5
Cilic 0:15 15:15 15:30 15:40 30:40 40:40 A:40 6-3 4-6 7-6 4-6 6-5
Berankis 15:0 30:0 40:0 40:15 6-3 4-6 7-6 4-6 5-5
Cilic 15:0 30:0 40:0 6-3 4-6 7-6 4-6 5-4
Berankis 15:0 30:0 40:0 6-3 4-6 7-6 4-6 4-4
Cilic 15:0 15:15 30:15 40:15 40:30 6-3 4-6 7-6 4-6 4-3
Berankis 0:15 15:15 30:15 40:15 6-3 4-6 7-6 4-6 3-3
Cilic 0:15 15:15 15:30 15:40 30:40 40:40 A:40 40:40 A:40 6-3 4-6 7-6 4-6 3-2
Berankis 15:0 15:15 30:15 40:15 6-3 4-6 7-6 4-6 2-2
Cilic 15:0 30:0 40:0 6-3 4-6 7-6 4-6 2-1
View graph.elm
import Color exposing (..)
import Graphics.Collage exposing (..)
import Graphics.Element exposing (..)
main : Element
main =
collage 300 300
[ blueLine
, xAxis
, yAxis
@cjwebb
cjwebb / ai-notes-1.markdown
Last active Dec 6, 2015
Notes on MIT 6.034 Artificial Intelligence
View ai-notes-1.markdown

Lecture videos, programming assignments, and exam papers for [MIT's Artificial Intelligence course][course-url] are available online. These are my notes from "taking" the course.

[Lecture 1: Introduction and Scope][lecture-1]

This course, and every subject at MIT, is based around making models. [Professor Winston][prof-winston] explains that this course will teach:

Algorithms enabled by

Constraints evolved by

View ingredients.txt
acorn squash
ale
alfalfa sprouts
allspice
almond
almond extract
almonds
amaretti
amaretto
anchovies
@cjwebb
cjwebb / recipes.cypher
Created Aug 25, 2015
Cypher to import BBC Food recipes into Neo4J
View recipes.cypher
This file has been truncated, but you can view the full file.
MERGE (f:Food:Recipe {id: "e02e63be-2b7c-4bfe-a1a0-7d6153f24673", name: "Bread sauce", source_url: "http://www.bbc.co.uk/food/recipes/breadsauce_84755", source_name: "BBC Food", image_url: "http://ichef.bbci.co.uk/food/ic/food_16x9_448/recipes/breadsauce_84755_16x9.jpg", description: "This crowd-pleasing bread sauce recipe by Nigella Lawson is an easy extra for Christmas Day and is just as good served cold with leftovers. The recipe appears in Nigella's book Feast, published by Chatto &amp; Windus."});
MERGE (f:Food{ name:"1 day-old loaf unsliced white bread"}) ON CREATE SET f.id = "d744762e-2351-480a-84fb-878d53b72992";
MATCH (r:Recipe {id: "e02e63be-2b7c-4bfe-a1a0-7d6153f24673"}),(f:Food{id:"d744762e-2351-480a-84fb-878d53b72992"}) CREATE (r)-[:CONTAINS]->(f);
MERGE (f:Food{ name:"1 litre/2 pints full-fat milk"}) ON CREATE SET f.id = "8840ab8d-61f4-4c7a-bcbe-cd607be10772";
View jsonschema.scala
import com.github.fge.jsonschema.core.report.ProcessingMessage
import scala.collection.JavaConversions._
import com.fasterxml.jackson.databind.JsonNode
import com.github.fge.jsonschema.main.JsonSchemaFactory
import org.json4s._
import org.json4s.jackson.JsonMethods._
@cjwebb
cjwebb / cassandra-cqlsh-errors.txt
Created Dec 2, 2014
Creating a table with a timestamp column, and then inserting data with a massive timestamp results in CQLSH errors when trying to remove the inserted data.
View cassandra-cqlsh-errors.txt
Creating a table with a timestamp column, and then inserting data with a massive timestamp results in CQLSH errors when trying to remove the inserted data.
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 2.1.0 | CQL spec 3.2.0 | Native protocol v3]
cqlsh> create keyspace test WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 3 };
cqlsh> use test;
cqlsh:test> create table test.table1 (id int, time timestamp, primary key (id));
clqsh:test> insert into table1(id, time) values (1, 1000000000000000) ;
cqlsh:test> select * from table1;
@cjwebb
cjwebb / irclogger.go
Created Nov 20, 2014
Log into IRC and display chat
View irclogger.go
package main
import (
"net"
"net/textproto"
"fmt"
"log"
"bufio"
)
You can’t perform that action at this time.