Skip to content

Instantly share code, notes, and snippets.

View udoprog's full-sized avatar

John-John Tedro udoprog

View GitHub Profile
@udoprog
udoprog / output
Last active August 29, 2015 14:04
; entry := [] [[:+, 10, [:hello, 33]]]
LDC 10
LDC 33
LDF 10
AP 1 ; hello
ADD
RTN
; __let1 := [:f] [[:+, :f, :foo]]
LD 0 0 ; f
LD 1 0 ; foo
@udoprog
udoprog / foo_test.clj
Last active August 29, 2015 14:04
Example lyceum test cases
(use-fixtures :each (rule-fixture spotify.rules.foo))
(deftest test-monitoring-hooks
(testing "Critical hooks should notify through e-mail and pagerduty"
(send-events
{:event-base {:host :host1 :tags ["hook"] :service "some-service"}}
[{:time 0 :state "critical"}
{:time 10 :state "ok"}
{:time 20 :state "ok"}])
(check-externals
public class SerializerTest {
public abstract class SerializerBase<T extends SomeType> implements Serializer<T> {
private final Serializer<Integer> number;
public SerializerBase(final SerializerFramework s) {
this.number = s.fixedInteger();
}
@Override
public void serialize(SerialWriter buffer, T value) throws IOException {
@udoprog
udoprog / startup.sh
Created February 12, 2016 16:58
HeroicShell Startup Time
$ time tools/heroic-shell -P memory <<< exit
17:58:24.238 [main] INFO com.spotify.heroic.HeroicShell - Starting local Heroic...
17:58:24.239 [main] INFO com.spotify.heroic.HeroicCore - Building Loading Injector
17:58:24.355 [main] INFO com.spotify.heroic.HeroicCore - Loaded 19 module(s)
17:58:24.360 [main] INFO com.spotify.heroic.HeroicCore - Loading profile 'Configures in-memory backends for everything (useful for integration/performance testing)' (params: ExtraParameters(parameters={}))
17:58:24.393 [main] INFO com.spotify.heroic.HeroicCore - Building Primary Injector
17:58:24.442 [main] INFO com.spotify.heroic.HeroicCore - Starting life cycles
17:58:24.444 [main] INFO com.spotify.heroic.HeroicCore - Started all life cycles
17:58:24.447 [main] INFO com.spotify.heroic.CoreHeroicLifeCycle - startup Core Future Resolver
17:58:24.448 [main] INFO com.spotify.heroic.cluster.CoreClusterManager - No discovery mechanism configured, using local node
@udoprog
udoprog / out.txt
Last active February 25, 2016 16:50
Failing enum-based API Blueprint
{ code: 1,
message: 'parser exception: \'mismatched adapter and node type\'',
location: [] }
from multiprocessing import Pool
from gcloud.exceptions import Conflict
from gcloud import datastore
import random
import traceback
import os
import uuid
import time
import sys
@udoprog
udoprog / Main.java
Last active October 18, 2016 13:29
Case where non-final is OK
public class Main {
public static void main(String[] argv) throws Exception {
Exception e = null;
try {
doSomething();
} catch(final Exception inner) {
e = inner;
}
import datetime
import sys
import json
def printThrown(thrown):
if 'message' in thrown:
print " {name}: {message}".format(**thrown)
else:
print " {name}".format(**thrown)
.PHONY: all
all:
gcc -ljack jack_status.c -o jack_status
extern crate ws;
use std::sync::Arc;
use std::sync::Mutex;
use std::collections::HashMap;
use ws::*;
use ws::util::Token;
type Connections = Arc<Mutex<HashMap<Token, Arc<Mutex<Client>>>>>;