This file contains hidden or 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 ubuntu:precise | |
RUN apt-get update && apt-get -y install ruby strace | |
ADD test.rb /root/test.rb | |
CMD [] | |
ENTRYPOINT ["strace", "-f", "ruby", "/root/test.rb"] |
This file contains hidden or 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/sh | |
( | |
set -e | |
cd $(dirname $0)/.. | |
echo "======== ghc-pkg list ========" | |
ghc_ver=$(ghc --version | sed -r 's/.*[[:space:]]([0-9.]+)/\1/') | |
ghc-pkg list -v \ |
This file contains hidden or 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/sh | |
( | |
set -e | |
echo "======== ghc-pkg list ========" | |
ghc_ver=$(ghc --version | sed -r 's/.*[[:space:]]([0-9.]+)/\1/') | |
ghc-pkg list -v \ | |
--global --user \ | |
--package-db .cabal-sandbox/*-ghc-$ghc_ver-packages.conf.d 2>&1 |
This file contains hidden or 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
consM x xs = do x' <- x; return [x'] <> xs | |
mapWhileM f c (a:as) = do | |
r <- f a | |
if c r == True | |
then return r `consM` (mapWhileM f c as) | |
else return [] | |
instance Monoid (IO [String]) where | |
mempty = return [] |
This file contains hidden or 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
function multipart_upload_stream(url, parts, callback) { | |
// TODO: better GUID | |
var boundary = Math.random().toString().slice(2); | |
var len = 0; | |
parts = parts.map(function(part){ | |
part = make_part(part); | |
len += part.length; | |
return part; | |
}); |
This file contains hidden or 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
var util = require('util'); | |
var EventEmitter = require('events').EventEmitter; | |
var OneLiner = module.exports = function OneLiner(stream){ | |
var self = this; | |
self.line_regex = /\n\r?|\r\n?/; | |
var buffer = ''; | |
stream.on('data', function(chunk) { |
This file contains hidden or 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
var http = require('http'); | |
var connect = require('connect'); | |
var httpProxy = require('http-proxy'); | |
var proxy = module.exports = function(options){ | |
return function (req, res) { | |
var proxy = new httpProxy.HttpProxy(req, res); | |
var headerFields = null; | |
This file contains hidden or 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
struct socklist | |
{ | |
struct socket_t sl_socket; | |
struct socklist* sl_next; | |
}; | |
static int sl_add(socklist** list, socket_t socket) | |
{ | |
struct socklist* sl = (socklist*) malloc(sizeof(socklist)); |
This file contains hidden or 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
Authenticated symmetric encryption | |
-> no HMAC to check for right receiver. | |
OCB - Faster than CCM | |
L Patent in US, GPL -> no patent | |
L commercial -> patent | |
CCM - no patent, 2 runs per block | |
EAX - Slower |
This file contains hidden or 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
# Make keys unfindable | |
key: sha1( salt + keyPath ) | |
salt: sha1(rsaSign(userEmail, userPrivKey)) | |
or sha1(sessionKey) # Probably better, a subscriber would already have the session key | |
Example | |
------- | |
Publisher: SET sha1("sekey" + "/blog"): aes("Hello World", "sekey") |