Skip to content

Instantly share code, notes, and snippets.

@DavidMikeSimon
DavidMikeSimon / gist:1175090
Created August 27, 2011 07:03
Bundler oddness
jsas@domU-12-31-39-02-1D-0F:~/staging/shared/cached-copy$ bundle install --deployment --path ../bundle --without test development
Fetching source index for http://rubygems.org/
Using rake (0.9.2)
Using ZenTest (4.6.0)
Using RubyInline (3.9.0)
Using activesupport (2.3.12)
Using rack (1.1.2)
Using actionpack (2.3.12)
Using actionmailer (2.3.12)
Using activerecord (2.3.12)
@DavidMikeSimon
DavidMikeSimon / SConstruct
Created September 19, 2011 23:12
SCons for Efene Project
import os
def efene_build(target, source, env):
if len(target) == 0:
raise StandardError('No targets!')
if len(target) != len(source):
raise StandardError('Source list and target list different lengths!')
for t in target:
target_dir, target_base = os.path.split(str(t))
target_name, target_ext = os.path.splitext(target_base)
@DavidMikeSimon
DavidMikeSimon / SConstruct
Created September 20, 2011 03:05
SCons Efene mark II
import os
def efene_build(env, sources):
cmds = []
for file in sources:
filename = os.path.basename(str(file))
base, ext = os.path.splitext(filename)
if ext not in [".fn", ".ifn"]:
raise StandardError("Invalid Efene source file extension for %s" % filename)
cmds.append(env.Command(
@DavidMikeSimon
DavidMikeSimon / gist:1311207
Created October 25, 2011 03:24
MySQL trigram-search magic
mysql> describe preloaded_trigrams;
+----------------------+-----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------------+-----------+------+-----+---------+-------+
| token | binary(3) | NO | PRI | NULL | |
| fuzzy_search_type_id | int(11) | NO | PRI | NULL | |
| rec_id | int(11) | NO | PRI | NULL | |
+----------------------+-----------+------+-----+---------+-------+
3 rows in set (0.00 sec)
@DavidMikeSimon
DavidMikeSimon / gist:5248726
Created March 26, 2013 20:08
install_haproxy.yml
- name: install haproxy required packages
apt: pkg=libssl0.9.8
# We can't use the regular Ubuntu packages because they only go up to
# haproxy 1.4, which does not have SSL support
- name: download haproxy deb file
get_url: url=http://debian.byte-consult.be/haproxy_1.5-dev17_amd64.deb
dest=/root/haproxy.deb
- name: install haproxy
- name: sync repository to target system
local_action: "command rsync -a -e ssh ${ENV(HOME)}/.ansible-cache-${name}
ubuntu@${ansible_hostname}:/home/ubuntu/ansible-cache-${name}"
TASK: [sync repository to target system] *********************
- name: sync repository to target system
local_action: command rsync -a -e ssh ${ENV(HOME)}/.ansible-cache-${name}
ubuntu@${ansible_hostname}:/home/ubuntu/ansible-cache-${name}
TASK: [sync repository to target system] *********************
failed: [beatbox.actesting.org] => {"changed": true, "cmd": ["rsync", "-a", "-e", "ssh", "${ENV(HOME)}/.ansible-cache-${name}", "ubuntu@${ansible_hostname}:/home/ubuntu/ansible-cache-${name}"], "delta": "0:00:00.015967", "end": "2013-03-26 16:47:53.852129", "item": "", "rc": 255, "start": "2013-03-26 16:47:53.836162"}
- hosts: beatbox.actesting.org
tasks:
- name: sync repository to target system
local_action: command rsync -a -e ssh ${ENV(HOME)}/.ansible-cache-${name}
ubuntu@${inventory_hostname}:/home/ubuntu/ansible-cache-${name}
vars:
name: foo
- name: install haproxy required packages
apt: pkg=libssl0.9.8
# We can't use the regular Ubuntu packages because they only go up to
# haproxy 1.4, which does not have SSL support
- name: download haproxy deb file
get_url: url=http://debian.byte-consult.be/haproxy_1.5-dev17_amd64.deb
dest=/root/haproxy.deb
- name: install haproxy
global
log 127.0.0.1 local0
chroot /home/haproxy
user haproxy
group haproxy
daemon
#debug
#quiet
defaults