This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'thread' | |
require 'singleton' | |
class Logger | |
include Singleton | |
def initialize | |
STDOUT.sync = true | |
@queue = ::Queue.new | |
create_thread |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Stuff this in spec/support/ : | |
class ProcStub | |
attr_accessor :called, :args | |
def initialize | |
@called = false | |
@args = nil | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Application | |
include Morphine | |
register :track_service do | |
KestrelTrackService.new(kestrel_client, config.tracking_queue) | |
end | |
register :track_processor do | |
KestrelTrackProcessor.new(blocking_kestrel_client, config.tracking_queue) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# node.js using PPA (for statsd) | |
sudo apt-get install python-software-properties | |
sudo apt-add-repository ppa:chris-lea/node.js | |
sudo apt-get update | |
sudo apt-get install nodejs npm | |
# Install git to get statsd | |
sudo apt-get install git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
require 'redis' | |
require 'json' | |
class ServerRepository | |
attr_reader :redis | |
def initialize | |
@redis = Redis.new | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
def json_object_parser(o): | |
""" | |
Default parser to be called by the JSON Encoder when all other options failed. | |
""" | |
if hasattr(o, 'as_json'): | |
return o.as_json() | |
raise TypeError(repr(o) + " is not JSON serializable (and doesn't support as_json)") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"shutdown" | |
) | |
func main() { | |
ch := shutdown.Add("test") | |
ch2 := shutdown.Add("test2") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scribe.scribe import Processor | |
from scribe.ttypes import * | |
from thrift.transport import TSocket | |
from thrift.transport import TTransport | |
from thrift.protocol import TBinaryProtocol | |
from thrift.server import TNonblockingServer | |
import socket |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export REDASH_CONNECTION_ADAPTER=pg | |
export REDASH_CONNECTION_STRING="dbname=ubuntu" | |
export REDASH_STATIC_ASSETS_PATH="../rd_ui/dist/" | |
export REDASH_LOG_LEVEL="INFO" | |
export REDASH_WORKERS_COUNT=6 | |
export REDASH_REDIS_URL=redis://localhost:6379/ | |
export REDASH_DATABASE_URL="postgresql://ubuntu" | |
export REDASH_COOKIE_SECRET= | |
export REDASH_ADMINS= | |
export REDASH_GOOGLE_APPS_DOMAIN= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Goal: write a program that displays LCD style numbers. | |
### Part 1 | |
Write a program that given a number (with arbitrary number of digits), converts it into LCD style numbers using the following format: | |
_ _ _ _ _ _ _ | |
| _| _||_||_ |_ ||_||_| | |
||_ _| | _||_| ||_| _| | |