Skip to content

Instantly share code, notes, and snippets.

View yssk22r's full-sized avatar

Yohei Sasaki yssk22r

View GitHub Profile
@yssk22r
yssk22r / node-http-timeout.js
Created August 25, 2011 05:14
Node http timeout
#!/usr/bin/env node
var http = require('http');
var server = http.createServer(function(req, res){
}).listen(8080, function(){
// a('api.vcap.me');
a('localhost', 8080);
});
@yssk22r
yssk22r / update_eth.sh
Created November 26, 2011 10:19
Automatic Network Configuration based on MAC address.
#!/bin/bash
hwaddr=$(ifconfig -a | grep HWaddr | awk '{print $5}')
echo "Update /etc/udev/rules.d/70-persistent-net.rules"
cat <<-EOS > /etc/udev/rules.d/70-persistent-net.rules
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="${hwaddr}", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
EOS
echo "Update hostname and ipaddress"
host=$(echo $hwaddr | awk -F: '{print $6}' | tr '[a-z]' '[A-Z]')
@yssk22r
yssk22r / gist:1544225
Created December 31, 2011 15:02
init script for vcap components
#! /bin/sh
### BEGIN INIT INFO
# Provides: nats_server
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Starts the nats message bus server
### END INIT INFO
export RUBY_PATH=/home/ubuntu/.rvm/rubies/ruby-1.9.2-p180
export GEM_PATH=/home/ubuntu/.rvm/gems/ruby-1.9.2-p180
EXEC_USER=ubuntu