Skip to content

Instantly share code, notes, and snippets.

View solidsnack's full-sized avatar

Jason Dusek solidsnack

  • Dallas, TX
  • 03:14 (UTC)
View GitHub Profile
@solidsnack
solidsnack / rows.ebnf
Last active January 1, 2016 05:59
Sketch of grammar
Unframed ::= UnframedData (NL UnframedData)*
UnframedData ::= FieldChar* (Tab Fields)?
Framed ::= Frame (NL Frame)*
Frame ::= Framing (NL Framing)* FramedData (NL FramedData)*
Framing ::= ColumnInfo | PragmaLine | Version | '#' (Char - NL)*
FramedData ::= ('' | (FieldChar - '#') FieldChar*) (Tab Fields)?
ColumnInfo ::= ('#:' | '#.') Space*
('' | (FieldChar - Space) FieldChar*) (Tab Fields)?
PragmaLine ::= ('#=' | '#-') (Char - NL)*
# This Python/Scala like syntax with type annotations
# would be easier for people to write.
def join_convention(a: Table, b: Table):
col: Column = b.columns[a.table_name]
[ * for * in join(a, b) on a(id) = b(col) ]
# This is more a sketch than anything. The handling of functions,
# table column lookups, actual properties of tables and columns,
# and "computed" tables and columns are all important in the syntax.
@solidsnack
solidsnack / basicauth.scala
Created January 5, 2014 19:17
Basic Auth helper for Play Framework
// Call in the scope of a request handler to retrieve basic auth parameters
// if they are present.
def basicAuth()(implicit request: Request[_]): Option[(String, String)] = {
val Basic = "^ *Basic +([^ ].+)$".r
for {
auth <- request.headers.get("Authorization")
Basic(base64) <- Basic.findFirstIn(auth)
decoded <- Option(new BASE64Decoder().decodeBuffer(base64))
plain <- Option(new String(decoded, "UTF-8"))
@solidsnack
solidsnack / argv.py
Last active August 29, 2015 13:56
This clever function is not really needed for what I am doing...but I'm sure I'll use it someday...
# coding: utf-8
def argv(*args, **opts):
"""
Produces an argument vector from its array of arguments and keyword
options. First, the options are unpacked. When the value is a ``bool``,
the option is passed without an argument if it is true and skipped if it
is ``false``. When the option is one of the flat built-in types -- a
``string`` or ``unicode`` or ``bytes`` or an ``int`` or a ``long`` or a
``float`` -- it is passed literally. If the value is a subclass of
To get started with Docker/Marathon/Mesos, you need to install a
new Mesos, a new Marathon, and Deimos, the bridge to Docker.
You'll also need Docker and the JVM. These instructions are for
Ubuntu 13.10.
## Install Mesos prerequisites
:; sudo apt-get update
:; sudo apt-get install zookeeperd default-jre python-setuptools python-protobuf curl pip
## Install recent Mesos
@solidsnack
solidsnack / gist:323dbd9a4ca641f832cd
Created May 5, 2014 16:04
Build a particular branch of Mesos as a Deb
pushd /tmp &&
git clone https://github.com/mesosphere/mesos-deb-packaging &&
pushd mesos-deb-packaging &&
./build_mesos --repo https://github.com/mesosphere/mesos?0.19.0-xcon3 --nominal-version 0.19.0-xcon3
# Deb will be pkg.deb
# Egg will be mesos.egg
### Launching CentOS AMIs:
:; source ./aws.profile
:; aws ec2 run-instances --image-id ami-eb6b0182 \
--instance-type m1.small --count 6 \
--key-name "$AWS_SSH_KEY" \
--security-groups "$AWS_SECURITY_GROUP"
### Viewing run status and DNS names for relevant instances:
:; source ./aws.profile
:; aws ec2 describe-instances --output text \
package mesosphere.servicenet.dsl
import scala.Ordered
import Ordering.Implicits._
/**
* Names for network entities.
*
* The sort order for names is the intuitive one for DNS names: sort on dotted
> console
[info] Starting scala interpreter...
[info]
Welcome to Scala version 2.10.4 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_55).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import java.net.{ InetAddress, Inet6Address }
import java.net.{InetAddress, Inet6Address}
diff --git a/tests/src/main/scala/mesosphere/servicenet/tests/TestDocGenerator.scala b/tests/src/main/scala/mesosphere/servicenet/tests/TestDocGenerator.scala
index f1975a8..7e6416c 100644
--- a/tests/src/main/scala/mesosphere/servicenet/tests/TestDocGenerator.scala
+++ b/tests/src/main/scala/mesosphere/servicenet/tests/TestDocGenerator.scala
@@ -42,8 +42,7 @@ class TestDocGenerator {
// if instance != subnet
} yield {
val instanceName = f"$serviceName-I$instance%x"
- val instanceAddr = f"$serviceAddr:$instance%x"
- Interface(instanceName, ipv6(s"$instanceAddr::"))