Skip to content

Instantly share code, notes, and snippets.

class Connection
constructor: (@socket, @manager) ->
@socket.setEncoding 'utf-8'
@socket.on 'data', incomingData
@socket.on 'end', connectionClosed
@peerMet = false
incomingData = (chunck) =>
tls = require 'tls'
fs = require 'fs'
Connection = require('./connection').Connection
class Rendezvous
@unPairedConnections = []
connectionFindOutSecret: (connection, cb) =>
#check if a connection with the same secret exists in the unPairedConnections list
@robinmonjo
robinmonjo / app.coffee
Created July 3, 2013 22:19
Simple static file server in express with authentication
express = require 'express'
fs = require 'fs'
app = express()
authenticationFilter = (req, res, next) ->
auth_token = req.query.auth_token
if auth_token == process.env.AUTH_TOKE
next()
else
@robinmonjo
robinmonjo / server.go
Created June 29, 2013 22:13
Simple http server skeleton in Go
package main
import (
"fmt"
"net/http"
"os"
"io/ioutil"
)
func main() {
@robinmonjo
robinmonjo / init_prod_server.sh
Last active December 16, 2015 14:59
Script used to provision a production server managed by dcdget deployment platform
set -e
sudo apt-get update
sudo apt-get install -y curl build-essential bison openssl libreadline6 libreadline6-dev git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libxml2-dev libxslt-dev autoconf ssl-cert libcurl4-openssl-dev nginx
echo "Installing Ruby..."
echo " -> Downloading Ruby"
wget -q http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz
echo " -> Extracting tarball"
@robinmonjo
robinmonjo / init_container.sh
Last active December 16, 2015 07:59
Script used to provision a lxc container on productions servers
set -e
sudo apt-get install -y curl build-essential bison libreadline6 libreadline6-dev zlib1g zlib1g-dev libyaml-dev libxml2-dev libxslt-dev autoconf
#installing ruby
wget -q http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz
tar xf ruby-1.9.3-p0.tar.gz
cd ruby-1.9.3-p0
./configure --disable-install-doc
make
@robinmonjo
robinmonjo / init.sh
Last active December 15, 2015 19:39
set -e
sudo apt-get update
sudo apt-get install -y curl build-essential bison openssl libreadline6 libreadline6-dev git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libxml2-dev libxslt-dev autoconf ssl-cert libcurl4-openssl-dev nginx
echo "Installing Ruby..."
echo " -> Downloading Ruby"
wget -q http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz
echo " -> Extracting tarball"