Skip to content

Instantly share code, notes, and snippets.

View benjaminws's full-sized avatar

Benjamin W. Smith benjaminws

View GitHub Profile
@benjaminws
benjaminws / gist:1309375
Created October 24, 2011 15:59
For Gary
======================================================================
ERROR: test_coolstorybro.TestCoolStoryBro.test_coolstorybro
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/bsmith/Dev/python/coolstorybro/local/lib/python2.7/site-packages/nose/case.py", line 133, in run
self.runTest(result)
File "/home/bsmith/Dev/python/coolstorybro/local/lib/python2.7/site-packages/nose/case.py", line 151, in runTest
test(result)
File "/usr/lib/python2.7/unittest/case.py", line 385, in __call__
return self.run(*args, **kwds)
@benjaminws
benjaminws / meh
Created October 10, 2011 20:19
meh
File "/home/bsmith/nagios-plugin-rabbitmq/lib/python2.7/site-packages/requests/models.py", line 435, in __getattr__
raise AttributeError
AttributeError
@benjaminws
benjaminws / joyent-smartos.erb
Created October 10, 2011 19:50
joyent-smartos.erb
# shove this in ~/.chef/bootstrap/joyent-smartos.erb
# run knife bootstrap <hostname> -d joyent-smartos
bash -c '
if [ ! -f /opt/local/bin/chef-client ]; then
cd /tmp
pkgin install gcc-compiler gcc-runtime gcc-tools-0 ruby19 scmgit-base scmgit-docs gmake sun-jdk6
wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.10.tgz
tar -xzf rubygems-1.8.10.tgz
cd rubygems-1.8.10
@benjaminws
benjaminws / runin.sh
Created October 6, 2011 21:24
Wrapper to run scripts that need a virtualenv
#!/bin/bash
VENV=$1
if [ -z $VENV ]; then
echo "usage: $0 [virtualenv_path] CMDS"
exit 1
fi
. ${VENV}/bin/activate
shift 1
echo "Executing $@ in ${VENV}"
exec "$@"
@benjaminws
benjaminws / gist:1253894
Created September 30, 2011 14:26
New feature, uses ec2 instance tags.
# When deploying, we will now tag the instances with a simple indicator noting they're for microarmy.
microarmy> find_cannons
Deployed cannons: [(u'i-2aa3d04a', u'ec2-50-17-124-163.compute-1.amazonaws.com'), (u'i-2ca3d04c', u'ec2-107-20-106-218.compute-1.amazonaws.com')]
microarmy> config
Enter host data: [(u'i-2aa3d04a', u'ec2-50-17-124-163.compute-1.amazonaws.com'), (u'i-2ca3d04c', u'ec2-107-20-106-218.compute-1.amazonaws.com')]
@benjaminws
benjaminws / gist:1252454
Created September 30, 2011 01:50
command runner?
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53)
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from microarmy.commands import CommandRunner
>>> c = CommandRunner()
>>> c.dispatch_command('help')
help: This menu.
status: Get info about current cannons
deploy: Deploys N cannons
setup: Runs the setup functions on each host
@benjaminws
benjaminws / local_settings.py
Created September 30, 2011 00:46
more progress
microarmy> config
Enter host data: [(u'i-1e35467e', u'ec2-107-20-131-225.compute-1.amazonaws.com'), (u'i-e0354680', u'ec2-184-73-103-225.compute-1.amazonaws.com')]
microarmy> siege_urls
Urls detected in settings and will be automatically deployed with "setup"
Continue? (y/n) y
Enter urls: ['http://dagorlad.just-another.net/', 'http://dagorlad.just-another.net/test']
Urls written, deploying to cannons
Configuring urls... Done!
@benjaminws
benjaminws / gist:1252148
Created September 29, 2011 22:43
for j2labs
-> ./command_center.py
microarmy> config
microarmy> config
Enter host data: [(u'i-7ab7c71a', u'ec2-107-20-57-143.compute-1.amazonaws.com'), (u'i-7cb7c71c', u'ec2-184-72-159-69.compute-1.amazonaws.com')]
microarmy> status
Cannon: i-7ab7c71a:ec2-107-20-57-143.compute-1.amazonaws.com
Cannon: i-7cb7c71c:ec2-184-72-159-69.compute-1.amazonaws.com
@benjaminws
benjaminws / microarmy_shell
Created September 29, 2011 20:36
I'm in yer microarmy, making some improvements...
microarmy> deploy
Deploying cannons... Done!
Hosts config: [(u'i-e6314186', u'ec2-50-19-136-152.compute-1.amazonaws.com'), (u'i-e8314188', u'ec2-107-20-120-45.compute-1.amazonaws.com')]
microarmy> status
Cannon: i-e6314186:ec2-50-19-136-152.compute-1.amazonaws.com
Cannon: i-e8314188:ec2-107-20-120-45.compute-1.amazonaws.com
microarmy> term
@benjaminws
benjaminws / mod_php5_options.diff
Created September 28, 2011 16:05
pseudo proposal
diff --git a/apache2/attributes/default.rb b/apache2/attributes/default.rb
index 7d9aa6e..f99a55d 100644
--- a/apache2/attributes/default.rb
+++ b/apache2/attributes/default.rb
@@ -101,3 +101,6 @@ default[:apache][:worker][:minsparethreads] = 64
default[:apache][:worker][:maxsparethreads] = 192
default[:apache][:worker][:threadsperchild] = 64
default[:apache][:worker][:maxrequestsperchild] = 0
+
+# Default attributes for certain modules