Skip to content

Instantly share code, notes, and snippets.

# using VirtualBox version $VBOX_VERSION
FROM boot2docker/boot2docker
RUN apt-get install p7zip-full
RUN mkdir -p /vboxguest && \
cd /vboxguest && \
curl -L -o vboxguest.iso http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso && \
7z x vboxguest.iso -ir'!VBoxLinuxAdditions.run' && \
sh VBoxLinuxAdditions.run --noexec --target . && \
@bertrandom
bertrandom / ephemswap
Created March 20, 2012 04:56
Creates a 4 gig swap file and mounts it as swap space, used for EC2 small instances for on-boot ephemeral swap space, put it somewhere in boot init
#!/bin/bash
if swapon -s | grep -q /mnt/swapfile
then
echo "Swapfile already mounted"
else
if [ -e /mnt/swapfile ]
then
echo "Mounting swapfile"
swapon /mnt/swapfile
@creationix
creationix / coroutine-example.js
Created November 8, 2011 22:14
Lua style coroutines in nodeJS proposal
var FS = require('fs');
var Fiber = require('./fiber'); // Not to be confused with the existing node-fibers module
// readFile is a normal non-blocking, async function, but internally it can use
// the coroutine helper fiber. These kinds of coroutines are no more dangerous
// to the caller than any other async function.
function readfile(filename, next) {
// The call to Fiber is non-blocking. It's contents are only run sync till
// the first call to wait and then it returns.
Fiber(function (resume, wait) {