Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
1. Knowledge is Power. | |
2. Time is Money. | |
As every engineer knows: | |
Power = Work / Time | |
Since: | |
Knowledge = Power | |
Time = Money |
# generate super secret private key | |
# (not really, this key and the certificate are "throwaway" items) | |
openssl genrsa -des3 -out ssl.key 1024 | |
# generate the self-signed certificate | |
openssl req -new -x509 -nodes -sha1 -days 365 -key ssl.key -out ssl.crt | |
# create decrypted version of key so that nginx can be started without a passphrase | |
openssl rsa -in ssl.key -out ssl.key.insecure | |
chmod 600 ssl.key.insecure |
def acquire(name): | |
tries = 0 | |
while True: | |
tries += 1 | |
if tries >= 30: | |
raise Exception("Couldn't acquire lock on mutex "+name) | |
try: | |
n = r.incr("lock-"+name) | |
if n == 1: | |
return True |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
☭ ~ $ revel new src/sweet_app | |
☭ ~ $ cd src/sweet_app/ | |
☭ ~/sweet_app $ git init | |
☭ ~/sweet_app (master)$ cat > .godir | |
sweet_app | |
^C | |
☭ ~/sweet_app (master)$ git add .godir * | |
☭ ~/sweet_app (master)$ git ci -m"Initial" | |
☭ ~/sweet_app (master)$ heroku create --buildpack https://github.com/traviscline/heroku-buildpack-go-revel.git | |
☭ ~/sweet_app (master)$ git push heroku master |
#!/usr/bin/python | |
# This requires rados.py to be at least as recent as | |
# https://raw.github.com/chrisglass/ceph/expose_cluster_stats_to_python/src/pybind/rados.py | |
import rados | |
stats = {} | |
with rados.Rados(conffile='/etc/ceph/ceph.conf') as cluster: | |
stats = cluster.get_cluster_stats() | |
print stats |
#!/usr/bin/python | |
import os | |
import urllib | |
import shutil | |
lines = [] | |
playlist = "/tmp/Test.pls" | |
playlist_name = playlist.split("/")[-1] | |
playlist_name = playlist_name.split(".")[0] | |
destination_folder = "/tmp/%s" % playlist_name |
#!/usr/bin/python | |
import os | |
import urllib | |
import shutil | |
lines = [] | |
playlist = "/tmp/Test.pls" | |
playlist_name = playlist.split("/")[-1] | |
playlist_name = playlist_name.split(".")[0] | |
destination_folder = "/tmp/%s" % playlist_name |
$('*').each(function() { $(this).css({background: "#"+((1<<24)*Math.random()|0).toString(16)});}); |
lxc-create -n <NAME> -t ubuntu -- --release <RELEASE ie. precise, raring...> -b <USERNAME to bind home to in the VM> |