Skip to content

Instantly share code, notes, and snippets.

@roblayton
roblayton / app.js
Created May 27, 2015 02:43
Example nodejs app
var http = require('http');
// Http server
var server = http.createServer(function (request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
text = "Running Node.js:" + process.versions.node
response.end(text);
});
@roblayton
roblayton / Dockerfile
Created May 27, 2015 02:35
Example nodejs Dockerfile
FROM ubuntu
RUN apt-get install -y python-software-properties python
RUN add-apt-repository ppa:chris-lea/node.js
RUN echo "deb http://us.archive.ubuntu.com/ubuntu/ precise universe" >> /etc/apt/sources.list
RUN apt-get update
RUN apt-get install -y nodejs
RUN mkdir /var/www
ADD app.js /var/www/app.js
#!/usr/bin/python
import random
import time
import statsd
ctr_name = 'stats.test.1'
while True:
client = statsd.StatsClient('localhost', 8125)
rand = random.randrange(1, 250)
print('count: (%d)' % rand)
@roblayton
roblayton / Vagrantfile
Last active August 29, 2015 14:20
2-core Trusty64
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provider "virtualbox" do |v|
v.memory = 1024