Add this to your PYTHONSTARTUP (~/.pythonrc.py) file:
try:
import readline
except ImportError:
print "Module readline not available."
else:
import rlcompleter
readline.parse_and_bind("tab: complete")
Add this to your PYTHONSTARTUP (~/.pythonrc.py) file:
try:
import readline
except ImportError:
print "Module readline not available."
else:
import rlcompleter
readline.parse_and_bind("tab: complete")
#!/usr/bin/env python | |
import readline | |
import glob | |
def complete(text, state): | |
for file in glob.glob(text+"*"): | |
if not state: | |
return file | |
else: | |
state -= 1 |
import urllib2, base64 | |
request = urllib2.Request("http://api.url") | |
base64string = base64.encodestring('%s:%s' % (username, password)).replace('\n', '') | |
request.add_header("Authorization", "Basic %s" % base64string) | |
result = urllib2.urlopen(request) |
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
BOX_NAME = ENV['BOX_NAME'] || "ubuntu" | |
BOX_URI = ENV['BOX_URI'] || "http://files.vagrantup.com/precise32.box" | |
AWS_REGION = ENV['AWS_REGION'] || "us-east-1" | |
AWS_AMI = ENV['AWS_AMI'] || "ami-23d9a94a" | |
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
VAGRANTFILE_API_VERSION = "2" |
#!/usr/bin/env python | |
# genpass.py | |
# Random password generation | |
# author: Patrick Pelletier | |
import md5 | |
import random | |
def genpass(len=20): | |
''' generates a random password based on the md5 of a random float ''' |
import time | |
def tailf(filename): | |
f = open(filename, 'r') | |
f.seek(0,2) | |
while True: | |
line = f.readline() | |
if not line: | |
time.sleep(0.1) | |
continue |
#!/usr/bin/env python | |
import cgi | |
import subprocess | |
import cgitb | |
cgitb.enable() | |
def run(command): | |
if not command: |