Skip to content

Instantly share code, notes, and snippets.

finger_server.js

An extremely minimal implementation of the Finger protocol using node.js.

To run (Finger uses port 79 which requires sudo):

sudo node finger_server.js
@mcroydon
mcroydon / nntpd.js
Created February 2, 2011 05:45
A minimal NNTP implementation in node.js
var net = require('net');
var END = '\r\n';
var groups = ['nodejs.test'];
var articles = {
'<1@127.0.0.1>' : {body : 'An article.'},
'<2@127.0.0.1>' : {body : 'Another article.'},
};
package com.postneo
package index
package test
import org.apache.lucene.analysis.SimpleAnalyzer
import org.apache.lucene.analysis.standard.StandardAnalyzer
import org.apache.lucene.document.{Document, Field}
import org.apache.lucene.index.{IndexWriter, Term}
import org.apache.lucene.search.{IndexSearcher, Query, TermQuery, TopDocs}
import org.apache.lucene.store.RAMDirectory
# Download all current FAA sectional GeoTIFFs (zipped)
import urllib, os, csv
from lxml.html.soupparser import fromstring
FAA_CHART_URL = 'http://aeronav.faa.gov/index.asp?xml=aeronav/applications/VFR/chartlist_sect'
BASE_CONTENT_URL = 'http://aeronav.faa.gov/'
DOWNLOAD_DIR = 'download'
data = urllib.urlopen(FAA_CHART_URL).read()
@mcroydon
mcroydon / tcpfing.pas
Created February 10, 2012 16:52
A finger implementation in Pascal using Trumpet TCP in DOS. Retrieved from http://www.pld.ttu.ee/~priidu/library/net/trumpet.html
program TCPFing;
uses
DOS, TrumpTCP, Crt, StrTools;
CONST
NulAddr: TIPAddr = (S_B1:0; S_B2:0; S_B3:0; S_B4:0);
var Result: Byte;
TmpAddr: TIPAddr;
// gopher.js - a minimal gopher implementation using node.js
// Released under the 3 clause BSD license by Matt Croydon <mcroydon@gmail.com> (http://postneo.com)
var net = require('net');
net.createServer(function (socket) {
socket.setEncoding("ascii");
socket.on("data", function (data) {
if (data === '\r\n') {
console.log('Serving index.');
@mcroydon
mcroydon / sillyproto.go
Created January 12, 2012 00:01
Performance-oriented silly text-based protocol server in go.
package main
import (
"bufio"
"flag"
"fmt"
"io"
"log"
"net"
"net/textproto"
[14:16:36] <rgarcia_> is there a reason why you can't start a serf agent and simultaneously tell it to join a cluster?
[14:16:56] <rgarcia_> seems awkward to have to run another cmd to tell it to join
[14:17:43] <Kyle> thought you could?
[14:18:41] • Kyle: looks
[14:19:20] m0hit (~mohit@208.66.30.174) joined the channel.
[14:19:27] <Kyle> heh, guess you can't
[14:20:05] <Kyle> rgarcia_: could use a member join event, look for you, and serf join then?
[14:20:06] <Kyle> *shrug*
[14:20:43] <jacques_> could open a GI for it
[14:20:46] <@mitchellh> rgarcia_ So I originally coded that in
@mcroydon
mcroydon / noflo.json
Created October 8, 2013 21:38
NoFlo Hello World with a never-ending network. View it at http://noflojs.org/noflo-ui/#example/6892206
{
"properties": {
"environment": {
"runtime": "html",
"src": "./preview/iframe.html",
"width": "300",
"height": "300",
"content": "<div id='content'></div>"
},
"name": "Hello World"

Context: I was asked for a list of interesting reading relating to "distributed databases, behavior under partitions and failures, failure detection." Here's what I came up with in about an hour.

For textbooks, "Introduction to Reliable and Secure Distributed Programming" is a superb introduction to distributed computing from a formal perspective; it's really not about "programming" or "engineering" but about distributed system fundamentals like consensus, distributed registers, and broadcast. Used in Berkeley's Distributed Computing course (and HT to @lalithsuresh) Book Site

Notes from courses like Lorenzo Alvisi's Distributed Computing class can be great.

There are a bunch of classics on causality, [Paxos](ht