Skip to content

Instantly share code, notes, and snippets.

View technosophos's full-sized avatar
💭
Rust

Matt Butcher technosophos

💭
Rust
View GitHub Profile
@technosophos
technosophos / fabfile.py
Created May 29, 2013 14:13
A simple Fabfile for creating and installing a LAMP server on HP Cloud.
from fabric.api import *
# Keyfile for SSH. Use this if you're not
# using SSH Agent.
env.key_filename = "~/.ssh/hpcompute.pem"
@task
def hello():
puts("Hello")
@technosophos
technosophos / fabfile.py
Created May 29, 2013 01:13
Example fabfile for creating a new HP Cloud server instance. This uses the `hpcloud` CLI.
from fabric.api import *
import re
@task
def create_server(name):
"""Create a new HP Cloud server."""
image = 81078 # Ubuntu 12.04 in AZ-1
flavor = 100 # extra-small
security_group = 'Web'
key = 'hpcompute'
@technosophos
technosophos / gist:5650812
Created May 25, 2013 21:14
Test case for #112
$xml = '<?xml version="1.0"?>
<root>
<Document name="A" title="A" >
<Document name="B" title="B" >
<Document name="C" title="C" >
<Section title="1" position="" >
Section ABDFD
</Section>
</Document>
</Document>
#cloud-config
# Automatically update all of the packages
package_upgrade: true
package_reboot_if_required: true
# Install the LAMP stack for me
packages:
- apache2
- mysql-server
@technosophos
technosophos / gist:5258706
Last active December 15, 2015 12:09 — forked from AeroNotix/gist:5247096
One way of making it easy to construct new service instances, hide the implementation details, but separate the services. One big advantage in doing things this way is that you could pretty easily create tools to deal with multiple azs, regions, and geos. E.g. you could copy objects from USWest to USEast.
/* hpcloud */
import "hpcloud/objectstorage"
type Account struct {
// Stuff
}
func (a Account) ObjectStorage(region) {
/* Look up the endpoints and stuff...
@technosophos
technosophos / kibana.conf
Last active January 11, 2020 21:41
An upstart (Ubuntu 12.04) script for starting Kibana as a service. The file goes in /etc/init/. This goes with the Upstart script for Logstash (http://cookbook.logstash.net/recipes/using-upstart/)
# kibana.conf# kibana - log viewer
#
description "Kibana logstash viewer"
start on virtual-filesystems
stop on runlevel [06]
respawn
respawn limit 5 30
@technosophos
technosophos / gist:4453518
Created January 4, 2013 15:36
SPLObjectStorage vs. PHP Arrays
<?php
/**
* Object hashing tests.
*/
$sos = new SplObjectStorage();
$docs = array();
$iterations = 100000;
for ($i = 0; $i < $iterations; ++$i) {
package main;
import (
"fmt"
);
func main() {
var m = make(map[string]interface{})
mf := new(MonkeyFace)
@technosophos
technosophos / gist:4259125
Created December 11, 2012 15:00
Element creation in QP
<?php
//define('QP_NO_AUTOLOADER', TRUE);
require 'src/qp.php';
function examples_qptest() {
$qp = qp("<?xml version=\"1.0\" encoding=\"UTF-8\"?><root/>");
$i = 0;
while ($i < 200) {
$issuerType = rand() ? 'type1' : 'type2';
$firstName = md5(rand(0,100000));
@technosophos
technosophos / drupal_dev.rb
Created May 19, 2012 12:44
roles/drupal_dev.rb
name "drupal_dev"
description "Useful tools for Drupal developers."
run_list(
"recipe[drupal::dev]",
"recipe[drush]", # TRY THIS!
#"recipe[drush::head]",
#"recipe[drush::pear]",
"recipe[drush_make]",
"recipe[phpmyadmin]", # TODO Cookbook needs testing!
"recipe[webgrind]", # TODO Does this actually work?