This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Folding paper in half 50 times is 3/4 of the distance from earth to sun | |
From: | |
http://www.quora.com/What-are-some-of-the-most-mind-blowing-facts#answer_526501 | |
Thickness of a sheet of paper: 0.1 mm (~0.004 inches) | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
try: | |
from HTMLParser import HTMLParser # python 2 | |
except ImportError: | |
from html.parser import HTMLParser # python 3 | |
class HTMLStripperParser(HTMLParser): | |
"""Simple, stupid parser to remove all HTML tags from | |
a document. The point is to just get a the data. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [111]: tablib.__version__ | |
Out[111]: '0.9.11' | |
In [112]: d = tablib.Dataset() | |
In [113]: d.headers = ['heading1', 'heading2', 'heading3', ] | |
In [114]: d.append_col(['h1-val1', 'h1-val2', 'h1-val3', None], header="heading1") | |
In [115]: d.append_col(['h2-val1', 'h2-val2', None, None], header="heading2") | |
.....: d.append_col(['h3-val1', 'h3-val2', 'h3-val3', 'h3-val4', ], header="heading3") | |
In [116]: print d.csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head><title>nth child</title> | |
<style type="text/css"> | |
ol.items { color: red; padding: 20px; border: 1px solid red; clear: both; margin: 20px; min-height: 110px; width: 490px;} | |
ol.items li { display: block; padding: 5px; margin: 5px; border: 1px solid #aaa; float: left; width: 100px; } | |
li:nth-child(3n) { color: orange; background-color: yellow; } | |
</style> | |
</head> | |
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def manage(management_command, args=None): | |
with cd(REMOTE_PROJECT_DIR): | |
cmd = "source /path/to/virtualenv/bin/activate && " | |
cmd += "python manage.py %s %s" % (management_command, args or '') | |
run(cmd) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root@polenta:~# chef-client | |
[Wed, 04 Jan 2012 19:30:43 +0000] INFO: *** Chef 0.10.8 *** | |
[Wed, 04 Jan 2012 19:30:46 +0000] INFO: Run List is [role[base], role[radiant_database_master], role[radiant], recipe[radiant::db_bootstrap], role[radiant_load_balancer]] | |
[Wed, 04 Jan 2012 19:30:46 +0000] INFO: Run List expands to [zsh, users::sysadmins, sudo, apt, git, build-essential, database::master, mysql::client, application, radiant::status, radiant::db_bootstrap, haproxy::app_lb] | |
[Wed, 04 Jan 2012 19:30:46 +0000] INFO: Starting Chef Run for polenta | |
[Wed, 04 Jan 2012 19:30:46 +0000] INFO: Running start handlers | |
[Wed, 04 Jan 2012 19:30:46 +0000] INFO: Start handlers complete. | |
[Wed, 04 Jan 2012 19:30:50 +0000] INFO: Loading cookbooks [apache2, application, apt, aws, build-essential, database, git, gunicorn, haproxy, java, jpackage, mysql, openssl, passenger_apache2, php, python, radiant, runit, sqlite, sudo, tomcat, unicorn, users, xfs, xml, zsh] | |
[Wed, 04 Jan 2012 19:30:50 +0000] WARN: Missing gem 'right_aws' | |
[Wed, 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install rvm system-wide | |
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer ) | |
# Update the packages | |
apt-get update | |
apt-get upgrade | |
apt-get install build-essential | |
# get the packages required by ruby | |
rvm pkg install zlib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Trust all connections from localhost | |
local all all trust | |
# password auth from elsewhere | |
host all all 10.0.0.1/32 md5 |