Skip to content

Instantly share code, notes, and snippets.

View olix0r's full-sized avatar
🍓

Oliver Gould olix0r

🍓
View GitHub Profile
@olix0r
olix0r / gob.clj
Last active December 17, 2015 18:29
my first clojure program
(ns gob.core)
(use '[clojure.string :only (join)])
(def penus "PENUS")
(defn env-columns [config]
(let [columns (System/getenv "COLUMNS")]
(if (nil? columns)
config
@olix0r
olix0r / jammer.scala
Last active December 18, 2015 14:59 — forked from anonymous/jammer.scala
import com.twitter.finagle.{Filter, Service}
import com.twitter.util.{Await, Future}
case class Fruit(flavor: String)
case class Veggie(flavor: String)
case class Jam(flavor: String)
object Jammer extends Service[Veggie, Jam] {
def apply(veg: Veggie) =
Future value Jam(veg.flavor)
@olix0r
olix0r / jamloop.scala
Last active August 2, 2017 02:41
an example using Broker to publish results of something
import com.twitter.concurrent.{Offer, Broker}
import com.twitter.finagle.{Filter, Service}
import com.twitter.finagle.http.{HttpMuxer, Request, Response, Status}
import com.twitter.server.TwitterServer
import com.twitter.util.{Await, Future}
object Harness extends TwitterServer {
val fruits =
flag[Seq[String]]("fruits", "apple" :: "banana" :: "cherry" :: "durian" :: Nil, "A list of fruits")
(ns gob.core
[:use [clojure.core.reducers :only (cat)]]
[:use [clojure.string :only (join)]])
(def penus "PENUS")
(defn env-columns [config]
(let [columns (System/getenv "COLUMNS")]
(if (nil? columns)
config
@olix0r
olix0r / keybase.md
Created July 31, 2014 21:36
keybase.md

Keybase proof

I hereby claim:

  • I am olix0r on github.
  • I am olix0r (https://keybase.io/olix0r) on keybase.
  • I have a public key whose fingerprint is 2DD1 B90B 6EAA AD36 CF44 DE78 B1D8 3BB8 13B1 7069

To claim this, I am signing this object:

@olix0r
olix0r / git-unfuck.sh
Last active August 6, 2018 20:27
git-unfuck
#!/bin/sh
set -e
if ! klist -t 2>/dev/null >&2 ; then
echo ":; :; kinit --keychain"
kinit --keychain
fi
branch=$(git branch --no-color 2>/dev/null | sed -e '/^[^*]/d' -e 's/\* \(.*\)/\1/')
@olix0r
olix0r / food.rs
Last active August 29, 2015 14:10
babby's breakfast program
/// Food, food, food. I love food.
pub mod food {
use std::rand::{Rand, Rng};
/// All food has calories
pub trait Food {
fn calories(&self) -> u64;
}
/// There are some things you can eat for breakfast.
@olix0r
olix0r / fooer_bad.go
Created April 7, 2015 20:59
Adapters in go
package main
type Goaled interface {
Goaled() bool
}
type Sane interface {
Sane() bool
}
@olix0r
olix0r / Api.scala
Last active September 15, 2015 13:11
case class WatchEvent(kind: String)
class Api(client: Service[Request, Resopnse]) {
def mkreq(): Request = ???
def watch(): AsyncStream[WatchEvent] =
for {
rsp <- AsyncStream.fromFuture(client(mkreq()))
watch <- rsp.status match {
package com.twitter.finagle.httpx
import org.jboss.netty.handler.codec.http.multipart.HttpPostRequestEncoder
/**
* A goddamned awful hack.
*/
object PostRequestEncoder {
def encode(req: Request, params: Seq[(String, String)]): Unit = {