Skip to content

Instantly share code, notes, and snippets.

View codejitsu's full-sized avatar

Alex codejitsu

View GitHub Profile
@jastice
jastice / lebkuchen.md
Last active August 29, 2015 14:10
Justin's Lebkuchen

Justin's Lebkuchen

A variation of Elisenlebkuchen, which contain no flour. Makes ca 45-60 Lebkuchen, 7cm.

Vegan, gluten-free (with the right kind of oblaten), certainly not low-fat or low-sugar.

Primary ingredients

  • 900g nuts or similar. Preferred mixture:
@mihow
mihow / _webfaction_setup.rst
Created April 26, 2011 00:21 — forked from ptone/_webfaction_setup.rst
setting up a stack on webfaction

Setting up Webfaction for modern Django deployment

last updated: 4/5/2011

note that this stuff is always a moving target, much of this has been cribbed and combined from various blog posts. Much of the information was out of date from those, and if it is more than a couple months after the last updated date above, consider some of this likely to now be out of date.

@petrovg
petrovg / gist:6323747
Last active December 21, 2015 14:59
Consuming a twitter feed with OAuth
object twitter {
import play.api.libs.ws._
import play.api.libs.iteratee._
import play.api.libs.oauth._
import scala.concurrent.ExecutionContext.Implicits.global
val key = ConsumerKey("XXXX", "XXXX")
val twitter = OAuth(ServiceInfo(
"https://api.twitter.com/oauth/request_token",
@ifesdjeen
ifesdjeen / with-latch.clj
Last active December 21, 2015 18:19
Testing with countdown latch
(ns my-test-ns
(:require [clojure.test :refer :all])
(:import [java.util.concurrent CountDownLatch TimeUnit])
(defmacro with-latch
[countdown-from & body]
`(let [latch# (CountDownLatch. ~countdown-from)
~'latch latch#]
~@body
(.await latch# 5 TimeUnit/SECONDS)
@jcabrra
jcabrra / VideoInfo.scala
Created January 6, 2014 19:57
Grab information from either a Youtube or Vimeo online video. I would change enum so more information could be extracted with a single http reponse. Example: import VideoService._, dispatch._ val time = Youtube.video.duration(id)()
import dispatch._
import xml._
import concurrent.Future
import concurrent.ExecutionContext.Implicits.global
/**
* Video information of certain video service providers.
* Supports Youtube, Vimeo.
* Can only get video duration, but easily extensible.
// Define the following traits and companion object
// It's in Rapture Core (https://github.com/propensive/rapture-core) if you don't want to
trait LowPriorityDefaultsTo { implicit def fallback[T, S]: DefaultsTo[T, S] = null }
object DefaultsTo extends LowPriorityDefaultsTo { implicit def defaultDefaultsTo[T]: DefaultsTo[T, T] = null }
trait DefaultsTo[T, S]
// Then, assuming we want to specify a default for a type class like `Namer`,
case class Namer[T](name: String)
@milessabin
milessabin / gist:b16e0765e1acdc90fd29
Last active August 16, 2016 16:25
Functional update of common fields of an open family of case classes via a case-class-like copy through the common super type ...
import shapeless._
/**
* Functional update of common fields of an *open* family of case classes
* via a case-class-like copy through the common super type ...
*
* This is a follow up to my earlier post showin how to do functional
* update for a sealed family of case classes,
*
* https://gist.github.com/milessabin/a212d946aef33811fee1
@rbranson
rbranson / gist:038afa9ad7af3693efd0
Last active September 29, 2016 17:44
Disaggregated Proxy & Storage Nodes

The point of this is to use cheap machines with small/slow storage to coordinate client requests while dedicating the machines with the big and fast storage to doing what they do best. I found that request coordination was contributing to about half the CPU usage on our Cassandra nodes, on average. Solid state storage is quite expensive, nearly doubling the cost of typical hardware. It also means that if people have control over hardware placement within the network, they can place proxy nodes closer to the client without impacting their storage footprint or fault tolerance characteristics.

This is accomplished in Cassandra by passing the -Dcassandra.join_ring=false option when the process is started. These nodes will connect to the seeds, cache the gossip data, load the schema, and begin listening for client requests. Messages like "/x.x.x.x is now UP!" will appear on the other nodes.

There are also some more practical benefits to this. Handling client requests caused us to push the NewSize of the heap up

#/usr/bin/env perl -wl
use strict;
use List::Util qw(sum);
my %graph;
<>;
while (<>) {
my ($a, $b) = split;
push @{$graph{$a}}, $b;
@bigsnarfdude
bigsnarfdude / gist:1abb6d53ff36834b5ed0
Created August 3, 2014 05:04
algebird sbt "project algebird-core" console
antigensAir:algebird antigen$ git pull upstream master
From https://github.com/twitter/algebird
* branch master -> FETCH_HEAD
* [new branch] master -> upstream/master
Already up-to-date.
antigensAir:algebird antigen$ sbt
^CantigensAir:algebird antigensbt "project algebird-core" console
[info] Loading project definition from /Users/antigen/dev/algebird/project
[info] Updating {file:/Users/antigen/dev/algebird/project/}algebird-build...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...