Skip to content

Instantly share code, notes, and snippets.

@thoward
thoward / index.html
Created September 25, 2013 08:25
Example of SSI includes for testing.
<html>
<body>
<h1>Party time!</h1>
<!--#include virtual="quote.html" -->
</body>
@thoward
thoward / rabbit-shim.rb
Created September 25, 2013 09:12
Cloud Foundry Service Shims for Rabbit/Redis configs
#!/usr/bin/env ruby
#
# Shims Rabbit configuration for CloudFoundry
#
require 'json'
if ENV['VCAP_SERVICES']
$vcap_services ||= JSON.parse(ENV['VCAP_SERVICES'])
rabbit_service_name = $vcap_services.keys.find { |svc| svc =~ /rabbit/i }
rabbit_service = $vcap_services[rabbit_service_name].first
@thoward
thoward / threebox.sh
Created September 25, 2013 09:19
Create a three-box environment using vagrant-testbed. Generates unique ssh keys for each box and removes default vagrant keys.
#!/bin/bash
# make three boxes
BOXES=3 IP_START=60 vagrant up
# generate ssh keys
if [ ! -f /tmp/testbed1.pub ]; then
ssh-keygen -b 2048 -t rsa -f /tmp/testbed1 -P "" -C "testbed1"
fi
@thoward
thoward / index.php
Created September 25, 2013 09:24
Simple PHP app to test if the app can connect to a bound mysql instance, in a CloudFoundry environment.
<?php
echo "<p>Testing the connection to the MySQL database.<p>";
echo "<p>vcap: " . getenv("VCAP_SERVICES") . "</p>";
$services_json = json_decode(getenv("VCAP_SERVICES"),true);
echo "<p>services: " . $services_json . '</p>';
@thoward
thoward / oscon-2014-group-bike-ride.md
Last active March 28, 2017 00:08
OSCON 2014 Group Bike Ride

OSCON 2014 Group Bike Ride

Love bikes and open source? In town for OSCON 2014? Join us for a group ride.

bike pic

WHEN

Wednesday, July 23rd 2014 at 6:00pm

@thoward
thoward / designer.html
Last active August 29, 2015 14:16
designer
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-input/core-input.html">
<polymer-element name="my-element">
<template>
<style>
:host {
@thoward
thoward / designer.html
Created February 24, 2015 22:27
designer
<link rel="import" href="../core-drawer-panel/core-drawer-panel.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
@thoward
thoward / designer.html
Last active August 29, 2015 14:16
designer
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-input/core-input.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
@thoward
thoward / profiling.py
Created January 29, 2017 20:42
Some snippets for profiling in Python
# paste these in
import contextlib
@contextlib.contextmanager
def profile(result_file_name=None):
import cProfile
import pstats
import sys
pr = cProfile.Profile()
@thoward
thoward / cli.sh
Created February 11, 2017 00:43
Basic implementation of CLI subcommands/options parsing in Bash
#!/bin/bash
# Private implementation of bar subcommand
_bar() {
echo "foo_value is $foo_value"
echo "flag_value is $flag_value"
echo "1: $1"
echo "2: $2"
echo "3: $3"
}