Skip to content

Instantly share code, notes, and snippets.

View Rydgel's full-sized avatar
😂
💯 🔥

Jérôme Mahuet Rydgel

😂
💯 🔥
View GitHub Profile
@casualjim
casualjim / resque.scala
Created March 17, 2011 17:40
A resque implementation in scala with akka actors and scala-redis
package com.mojolly.backchat
package redis
package resque
import com.mojolly.backchat.redis.resque.Resque.{ResqueWorkerActor}
import net.liftweb.json._
import JsonAST._
import JsonDSL._
import java.net.InetAddress
import com.redis.ds.{ RedisDeque, RedisDequeClient }
import unfiltered.jetty._
import unfiltered.request._
import unfiltered.response._
import unfiltered.filter._
import unfiltered.Cookie
trait AuthService[T]{
def auth(username: String, password: String): Option[T]
}
package ya
import scala.util.parsing.combinator._
import scala.util.parsing.input._
import scalax.file.Path
import scala.io.Source
class BytePosition(index: Int) extends Position {
@turicas
turicas / example_image_utils.py
Created December 10, 2011 19:04
Layer on top of Python Imaging Library (PIL) to write text in images easily
#!/usr/bin/env python
# coding: utf-8
# You need PIL <http://www.pythonware.com/products/pil/> to run this script
# Download unifont.ttf from <http://unifoundry.com/unifont.html> (or use
# any TTF you have)
# Copyright 2011 Álvaro Justen [alvarojusten at gmail dot com]
# License: GPL <http://www.gnu.org/copyleft/gpl.html>
from image_utils import ImageText
@isomorphism
isomorphism / Nim.hs
Created January 10, 2012 09:24
Code review
-- Suggested changes for http://codereview.stackexchange.com/q/7623/4949
module Nim where
import Data.List
import Data.Maybe
import qualified Data.Map as Map
--Domain
--Nim is a mathematical game of strategy
@vastdevblog
vastdevblog / ExampleServer.scala
Created March 12, 2012 14:30
Example of a Finagle server
package com.vast.example
import java.net.InetSocketAddress
import java.util.UUID
import java.util.concurrent.{Executors, TimeUnit}
import com.google.common.base.Splitter
import com.twitter.finagle.http.Http
import com.twitter.finagle.builder.{Server, ServerBuilder}
import com.twitter.finagle.service.TimeoutFilter
import com.twitter.finagle.{Service, SimpleFilter, GlobalRequestTimeoutException}
@tonymorris
tonymorris / ReaderWriterStateT.scala
Created April 11, 2012 16:59
Reader/Writer/State transformer in Scala
case class ReaderWriterStateT[R, W, S, F[_], A](
run: (R, S) => F[(W, A, S)]
) {
def map[B](f: A => B)(implicit F: Functor[F])
: ReaderWriterStateT[R, W, S, F, B] =
ReaderWriterStateT {
case (r, s) => F.map(run(r, s)) {
case (w, a, s) => (w, f(a), s)
}
}
@bechu
bechu / boost_tcp_client.cpp
Created April 19, 2012 19:18
simple boost tcp client example
/*
g++ main.cpp -lboost_system -lboost_thread -lpthread -o main
*/
#include <boost/asio.hpp>
#include <boost/array.hpp>
#include <iostream>
void send_something(std::string host, int port, std::string message)
from directoryhash import path_checksum
from functools import partial
def static(filename, _external=False):
path = partial(url_for, 'static', filename=filename, _external=_external)
host = app.config.get('CDN_HOSTNAME')
if host:
return u'http://{host}/{fingerprint}{path}'.format(
host=host, fingerprint=g.fingerprint, path=path())
return path(fingerprint=g.fingerprint)
@mdmarek
mdmarek / WaiApp3.hs
Created May 13, 2012 22:06
Haskell web application to serve static files.
{-# LANGUAGE OverloadedStrings #-}
-- | Wai+Warp file server. Used GHC 7.4, Wai 1.1, Warp 1.1 versions.
module Main where
import Network.Wai.Handler.Warp (run)
import Network.Wai.Application.Static
( StaticSettings(..)
, staticApp
, fileSystemLookup