Skip to content

Instantly share code, notes, and snippets.

View theikkila's full-sized avatar

Teemu Heikkilä theikkila

View GitHub Profile
trait ExtractableFields {
val name: Option[String]
val color: Option[String]
}
case class Event(
id: Integer,
etype: String,
name: Option[String],
echo "Hello World"
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
(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

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:

@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]) { .. }
; Finnish date parser with EBNF parser
(require '[instaparse.core :as insta])
;
; "huomenna",
; "ylihuomenna",
; "eilen",
; "huomenna aamupäivällä",
; "huomenna aamupäivästä",
package main
import (
"fmt"
"io"
"crypto/md5"
)
func md5hex(d string) string {
h := md5.New()
from datetime import datetime
import pytz
import requests
today = datetime.now().strftime('%Y-%m-%d')
API_URL = 'https://rata.digitraffic.fi/api/v1/trains/{}'.format(today)
r = requests.get(API_URL)
@theikkila
theikkila / logstashes.sh
Created July 24, 2017 12:19
Logstash plans
# Read files from /log/*.json and output them into listening tcp-server
logstash -e 'input { file { path => "/log/*.json" } } output { tcp { host => "0.0.0.0" port => 3333 mode => "server" codec => line { format => "%{message}" }} }'