Skip to content

Instantly share code, notes, and snippets.

package wlhn
import java.net.ServerSocket
import scala.io.BufferedSource
import java.io.PrintStream
import java.net.Socket
import java.net.InetAddress
import scala.collection.mutable.ArrayBuffer
/**
@faraocious
faraocious / chain_runner.py
Last active August 29, 2015 13:58
Exploration of Celery Issue #1671
from celerydemo.chain_tasks import a, b, c
from celery import *
## BASE CASE
a.apply_async()
b.apply_async()
c.apply_async()
## BASE CHAIN CASE
chain(a.si())()
@Bouke
Bouke / gist:10454272
Last active September 22, 2023 17:23
Install FreeTDS, unixODBC and pyodbc on OS X

First, install the following libraries:

$ brew install unixodbc
$ brew install freetds --with-unixodbc

FreeTDS should already work now, without configuration:

$ tsql -S [IP or hostname] -U [username] -P [password]
locale is "en_US.UTF-8"

locale charset is "UTF-8"

@mnd999
mnd999 / hacknight.c
Created May 15, 2014 06:54
West London hack night 14/5/14 - Bloom filter
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#define HASHMASK 0xFFFF
uint64_t hash(const char* key, uint64_t seed)
{
@oroce
oroce / README.md
Created June 12, 2014 07:51
nginx request id
@staltz
staltz / introrx.md
Last active May 12, 2025 23:22
The introduction to Reactive Programming you've been missing
@CaffeinatedDave
CaffeinatedDave / Brainfuck.scala
Last active August 29, 2015 14:05
West London Hack Night - Brainfuck interpreter
object Compiler extends Application {
val program = "++++++++++" +
"[" +
">+++++++" +
">++++++++++" +
">+++" +
">+" +
"<<<<-" +
"]" +
@davegurnell
davegurnell / scala-dojo.scala
Created February 19, 2015 20:00
Notes on error handling and monads from London Scala Dojo on 19th February 2015
def userId(username: String): Option[Int] =
Some(1)
def mostRecentOrderId(userId: Int): Option[Int] =
Some(2)
def orderCost(orderId: Int): Option[Int] =
Some(3)
def mostRecentOrderCost(username: String): Option[Int] =
object scratch {
type SentenceAnagram = Set[String]
type SolutionSpace = Set[SentenceAnagram]
type CharacterCounts = Map[Char, Int]
def frequencyCount(word: String): CharacterCounts = {
val grouped: Map[Char, String] = word.toLowerCase.replaceAll("[^a-z]", "").groupBy(c => c)
grouped.map((pair: Tuple2[Char, String]) => (pair._1, pair._2.length))
}
@pljones
pljones / Game.scala
Created April 21, 2015 21:36
West London Hack Night WLHN April 2015 Text Adventure
package adventure
import scala.collection.mutable.{ Map => MMap }
trait Direction
case object North extends Direction
case object South extends Direction
case object East extends Direction
case object West extends Direction
case object Wrong extends Direction