Instantly share code, notes, and snippets.

View gist:e36c63f21392ccb9de0b738b44b4b57b
I have a file at: scrooge_sbt/src/main/thrift/com/example/thrift/AStruct.thrift
namespace java com.example.thrift
include "thrift2/BStruct.thrift"
struct AStruct {
1: BStruct a_field
}
View gist:4e609e6318a5f8037bda
// The following are just some useful category theoretic type classes
// Note that this IS an endofunctor -- it has to be. Our category is all possible types,
// so the type A and T[A] are both in our Category, so it's an endofunctor
trait Functor[T[_]] {
def map[A, B](fn: A => B): T[A] => T[B]
}
trait Monad[T[_]] extends Functor[T] {
// we go with the less common join approach because THIS is where the "monoid"-ness of
View gist:651fef547b8e9087547f
// in bijection branch jco/macro_case_class_plus
// ./sbt "bijection-macros/console"
// paste the following
import com.twitter.bijection._
import com.twitter.bijection.macros.common.TypesNotEqual
import com.twitter.bijection.macros.common.MacroImplicits._
trait Semigroup[T] {
View gist:cb06630f4d2867ea3adb
http://www.infoq.com/presentations/scala-idris
http://www.cs.nott.ac.uk/~txa/publ/ydtm.pdf
http://coq.inria.fr/stdlib/Coq.Sorting.Mergesort.html
http://mazzo.li/posts/AgdaSort.html#fnref7
http://eb.host.cs.st-andrews.ac.uk/writings/idris-tutorial.pdf
https://gist.github.com/timjb/9043255
http://wiki.portal.chalmers.se/agda/pmwiki.php?n=Main.InductiveFamilies
http://www.cse.chalmers.se/~ulfn/darcs/AFP08/LectureNotes/AgdaIntro.pdf
http://eb.host.cs.st-andrews.ac.uk/drafts/pe-edsl.pdf
View type_proj_imp
trait Plat[P <: Plat[P]] {
type Keyed[_, _]
}
class MPlat extends Plat[MPlat] {
type Keyed[K, V] = (K, TraversableOnce[V])
}
trait Prod[P <: Plat[P], T, This <: Prod[P, T, This]] {
View gist:6094240
Bruce,
I do not know you, but I am told by people who care about you that you're a really nice guy. I was also told that a picture I tweeted recently was offensive[1]. I'm not going to try and justify this tweet: it was offensive, and it was wrong. Being a person who has been very fortunately untouched by sexual violence against children, I inconsiderately saw it as a funny subversion of a common sign, and not what it is: graffiti which trivializes the the issue of sexualizing children and sexual harassment or violence. I see that I was wrong, and in the future I will try to be much more sensitive to images which make light of a serious issue: when those who have power over children abuse that power in the worst possible way.
[1] The tweet in question: https://twitter.com/jco/status/360755209632362497
PS I made this apology public because the tweet was public, and others saw it. I'd like for them to know that it is offensive, and that I apologize.
View gist:5459644
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import org.apache.avro.Schema;
import org.apache.avro.file.DataFileReader;
import org.apache.avro.file.DataFileWriter;
import org.apache.avro.file.FileReader;
import org.apache.avro.generic.GenericDatumReader;
import org.apache.avro.generic.GenericDatumWriter;
View avro_understanding_1
import avro.schema
from avro.datafile import DataFileReader, DataFileWriter
from avro.io import DatumReader, DatumWriter
import simplejson as json
a = avro.schema.parse(json.dumps({"name": "hey", "type": "record", "fields": [{"name":"n", "type":"double"}]}))
b = avro.schema.parse(json.dumps({"name": "hey", "type": "record", "fields": [{"name":"n", "type":"int"}]}))
c = avro.schema.parse(json.dumps({"name": "hey", "type": "record", "fields": [{"name":"n", "type":["int","double"]}]}))
writer = DataFileWriter(open("a.avro", "w"), DatumWriter(), a)
writer.append({"n": 1.0})
View avro_issue_2
import java.io.FileOutputStream;
import org.apache.avro.Schema;
import org.apache.avro.file.CodecFactory;
import org.apache.avro.file.DataFileWriter;
import org.apache.avro.generic.GenericDatumReader;
import org.apache.avro.generic.GenericDatumWriter;
import org.apache.avro.io.DecoderFactory;
public class Hrm {
public static void main(String[] args) {
View avro_issue_1
a = """{
"fields": [
{
"type": "int",
"name": "first"
},
{
"type": "string",
"name": "second"
},