Skip to content

Instantly share code, notes, and snippets.

View theikkila's full-sized avatar

Teemu Heikkilä theikkila

View GitHub Profile
@theikkila
theikkila / email_backend.md
Last active December 18, 2017 20:29
email_backend.md

Enron Mail Server - GraphQL server exercise

The Enron scandal, publicized in October 2001, eventually led to the bankruptcy of the Enron Corporation, an American energy company based in Houston, Texas, and the de facto dissolution of Arthur Andersen, which was one of the five largest audit and accountancy partnerships in the world. In addition to being the largest bankruptcy reorganization in American history at that time, Enron was cited as the biggest audit failure Wikipedia (https://en.wikipedia.org/wiki/Enron_scandal)

In this excercise your task is to build a email server for storing Enron-emails.

You can choose your tooling pretty freely but the API should have following methods or ways to accomplish these tasks (at root level):

  • Show all emails received by single user, recognized by email-address. ie. mailboxOf([email protected]) { .. }

Keybase proof

I hereby claim:

  • I am theikkila on github.
  • I am theikkila (https://keybase.io/theikkila) on keybase.
  • I have a public key ASBBu1QUGxp0JsPIKgsfOi0aCaIGCzHUij10-tjMdbmerAo

To claim this, I am signing this object:

(require '[clojure.core.async :as async :refer [chan go <! >! <!! >!!]])
(defmacro let-go
"Like ordinary go-block but first param is symbol for channel thats returned automatically.
same as:
(let-go c
function Atom(initialState) {
this.state = initialState
this.cbs = []
this.on = (cb) => this.cbs.push(cb)
this.swap = (f, a) => {
this.state = f(this.state, a)
this.cbs.forEach(cb => cb(this.state))
return this.state
echo "Hello World"
trait ExtractableFields {
val name: Option[String]
val color: Option[String]
}
case class Event(
id: Integer,
etype: String,
name: Option[String],
{"date":"2018-01-01","month":1,"day":1,"rise_h":9.392777777777777,"rise_s":33814,"set_h":15.404722222222222,"set_s":55457}
{"date":"2018-01-02","month":1,"day":2,"rise_h":9.383055555555556,"rise_s":33779,"set_h":15.429722222222223,"set_s":55547}
{"date":"2018-01-03","month":1,"day":3,"rise_h":9.372222222222222,"rise_s":33740,"set_h":15.456111111111111,"set_s":55642}
{"date":"2018-01-04","month":1,"day":4,"rise_h":9.359722222222222,"rise_s":33695,"set_h":15.483611111111111,"set_s":55741}
{"date":"2018-01-05","month":1,"day":5,"rise_h":9.345833333333333,"rise_s":33645,"set_h":15.5125,"set_s":55845}
{"date":"2018-01-06","month":1,"day":6,"rise_h":9.330555555555556,"rise_s":33590,"set_h":15.542222222222222,"set_s":55952}
{"date":"2018-01-07","month":1,"day":7,"rise_h":9.313888888888888,"rise_s":33530,"set_h":15.573333333333334,"set_s":56064}
{"date":"2018-01-08","month":1,"day":8,"rise_h":9.296111111111111,"rise_s":33466,"set_h":15.605277777777777,"set_s":56179}
{"date":"2018-01-09","month":1,"day":9,"rise_h":9.2
apiVersion: v1
kind: Namespace
metadata:
name: kube-lego
logs = spark.read.json("in/logs/*.json.gz").createOrReplaceTempView('logs')
users = spark.read.json('in/user_hostname_mapping.json').createOrReplaceTempView('users')
billing_stats = spark.sql("""
SELECT user,
sum(size) as total_bandwidth
FROM logs
INNER JOIN users ON logs.hostname = users.hostname
GROUP BY user""")
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
// How does this work:
// https://github.com/nginx/nginx/blob/master/src/http/ngx_http_parse.c#L634
#define BYTE_TO_BINARY_PATTERN "%c%c%c%c%c%c%c%c"
#define BYTE_TO_BINARY(byte) \
(byte & 0x80 ? '1' : '0'), \