Skip to content

Instantly share code, notes, and snippets.

View bitprophet's full-sized avatar
🎯
Focusing

Jeff Forcier bitprophet

🎯
Focusing
View GitHub Profile
In [20]: list(value for key, value in vars(models).items() if isinstance(value, type) and issubclass(value, Model))
Out[20]:
[<class 'readyroom.catalog.models.Service'>,
<class 'readyroom.catalog.models.System'>,
<class 'readyroom.catalog.models.DriveType'>,
<class 'readyroom.catalog.models.DriveConfig'>,
<class 'readyroom.catalog.models.Worklog'>,
<class 'django.contrib.auth.models.User'>,
<class 'readyroom.catalog.models.Daemon'>,
<class 'readyroom.catalog.models.MemoryType'>,
enum = 'http://readyroom/catalog/enumerate/'
def get_hosts(which=None):
qs = ''
if which:
qs = '?which=%s' % which
ret = urllib.urlopen(enum + 'systems/' + qs).read()
return ret.split()
env.roledefs.update({
jeff:~/D/C/fabfile {fabric} [master] $ fab -l
Available commands:
add_nrpe_cpu_check One-time command to append a new CPU check com...
add_user Add a new user named ``name`` to the remote sy...
apache
ar_mailer
build_djb_packages Download, build and install djbdns, ucspi-tcp ...
check_timezone If date(1) reports UTC, run dpkg-reconfigure t...
check_yum_repos
from __future__ import with_statement
from fabric.api import *
from fabric.contrib.files import *
import system
def xen():
"""
@bitprophet
bitprophet / gist:274410
Created January 11, 2010 17:36
Designed for use with non-system gem location e.g. homebrew or ~/.gems
#
# Try to make up for Ruby's lack of easy setup.py develop sorta thing.
#
function fakegem() {
if [[ `env | grep GEM_HOME` ]]; then
projects=~/Documents/Code
for project in `ls -1 $projects`; do
bin=$projects/$project/bin
lib=$projects/$project/lib
#
# Initial, naive version
#
from fabric.api import *
def _new_rpms():
"""
16:12 < idangazit> termie: I had some ruminations on the gunicorn vs. django pony this morning.
16:13 < termie> if the gunicorn and the django pony had sex the django pony would explode as if a small but powerful explosive had been set off inside it
16:14 < termie> but then the django pony would reconstitute itself through the power of love
16:15 < robhudson> drawing on the magic once removed from Django?
adsf (1.0.1)
bluecloth (2.0.7)
bundler (0.9.25)
compass (0.10.1)
cri (1.0.1)
diff-lcs (1.1.2)
grit (2.0.0)
haml (3.0.6)
mime-types (1.16)
nanoc (3.1.3)
@bitprophet
bitprophet / system.py
Created January 7, 2011 18:18
Fabric subroutine for prepping debconf
def debconf(package, key, value, type_='string', key_prefix=None):
"""
Seeds the debconf database with given values.
Take the following example::
debconf(
package='mysql-server',
key='root_password',
type_='password',
#!/usr/bin/env python
# Copyright (c) 2008 Nick Jensen
# MIT License
import xml.dom.minidom
import urllib, sys, datetime
PHONE_STRIPS = ('-', ' ', ')', '(')