Skip to content

Instantly share code, notes, and snippets.

bash -c '
if [ ! -f /usr/local/bin/chef-client ]; then
apt-get update
apt-get install -y patch wget build-essential libreadline5-dev zlib1g-dev libssl-dev
cd /usr/src
test -f ruby-enterprise-<%= Chef::Config[:ree_version] %>.tar.gz || wget --quiet --timestamping <%= Chef::Config[:ree_url_prefix] %>/ruby-enterprise-<%= Chef::Config[:ree_version] %>.tar.gz
test -d ruby-enterprise-<%= Chef::Config[:ree_version] %> || tar xfz ruby-enterprise-<%= Chef::Config[:ree_version] %>.tar.gz
cd ruby-enterprise-<%= Chef::Config[:ree_version] %>
test -f /usr/local/bin/ruby || ./installer --auto /usr/local
gem install ohai chef --no-rdoc --no-ri --no-update-sources <%= '--prerelease' if @config[:prerelease] %>
bash -c '
if [ ! -f /usr/local/bin/chef-client ]; then
apt-get update
apt-get install -y git-core curl build-essential binutils-doc gcc autoconf flex bison libreadline5-dev zlib1g-dev libssl-dev libxml2-dev libxslt1-dev
bash < <( curl -L http://bit.ly/rvm-install-system-wide )
(
cat <<'EOP'
[[ -s "/usr/local/lib/rvm" ]] && . "/usr/local/lib/rvm" # This loads RVM into a shell session.
EOP
) > /etc/profile.d/rvm.sh
ree_version "1.8.7-2010.02"
ree_url_prefix "http://rubyforge.org/frs/download.php/71096"
require "rubygems"
require "eventmachine"
module EchoServer
def post_init
puts "-- someone connected to the EventMachine echo server!"
end
def receive_data data
send_data ">>>you sent: " + data
var net = require("net");
function echoServer (stream) {
stream.setEncoding("utf8");
stream.on("connect", function () {
console.log("-- someone connected to the Node.js echo server!");
});
stream.on("data", function (data) {
stream.write(">>>you sent: " + data);
});
@smith
smith / cramerdev-placeholder.html
Created February 9, 2011 22:35
A single file providing a placeholder page for Cramer Development sites
<!DOCTYPE html>
<html>
<head>
<title>Cramer Development, Inc. - Web Development</title>
<meta charset="UTF-8" />
<style>
body { width: 80%; margin: 0 auto; text-align: center; background-color: #1A1A1A; }
div#main { margin-top: 300px; }
img { border: none; }
</style>
@smith
smith / wildcard_admin_redirect.php
Created February 10, 2011 23:04
Redirects the login page for a mapped domain to the non-mapped domain.
function wildcard_admin_redirect($location, $status = 302) {
$url = parse_url($location);
if ($url['scheme'] === 'https' &&
(preg_match("/\/wp-[login|admin|register]/", $url['path']) > 0)) {
$orig = preg_replace("/^https?:\/\//", "", get_original_url($url['host']));
if ($orig && $orig !== $url['host']) {
$location = 'https://'.$orig.$url[path];
}
}
return $location;
var socket = require("net").createConnection(4730, "localhost");
socket.on("connect", function () {
console.log("connect");
});
socket.on("data", function (data) {
console.log("data: " + data);
});
var socket = require("net").createConnection(4730, "localhost"),
packet = require("../lib/packet.js");
socket.on("connect", function () {
console.log("connect");
socket.write(req, function () {
console.log("write");
});
});
<!doctype html>
<!-- Big textarea with a reset button for toddlers. Best run with iexplore -k
or something like that -->
<style>textarea { font-size: 72pt; }</style>
<form>
<textarea cols=21 rows=9></textarea>
<button type="reset">Start Over</button>
</form>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script>