This is the content.
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 [64]: lines = [] | |
In [65]: l = glob.glob('/home/watson/Downloads/attorney_master/*.png') | |
In [66]: for file in l: | |
line = '<h3>'+file+'</h3>'+'<img style="page-break-after:always;" src="' + file + '"</img>' | |
lines.append(line) | |
....: | |
In [67]: f = open('/home/watson/Downloads/attorney_master/index.html', 'w') |
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
-- Two dashes start a one-line comment. | |
--[[ | |
Adding two ['s and ]'s makes it a | |
multi-line comment. | |
--]] | |
---------------------------------------------------- | |
-- 1. Variables and flow control. | |
---------------------------------------------------- |
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
from __future__ import print_function | |
def fbn(n, d, s): | |
for i,j in enumerate(d): | |
if n % j == 0: | |
return s[i] | |
return n | |
print(*(fbn(i, (15, 5, 3), ('fizzbuzz', 'buzz', 'fizz')) for i in range(1, 101))) |
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 inspect | |
import types | |
import explorer.views | |
for name, fn in inspect.getmembers(explorer.views): | |
if name[-4:] == 'View': | |
print name | |
if isinstance(fn, types.UnboundMethodType): | |
#setattr(Something, name, decorator(fn)) | |
print fn |
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
from fabric.api import env, put, run, sudo | |
from fabric.contrib.files import upload_template | |
env.hosts = ['host1', 'host2'] | |
env.password = 'your_password' | |
def upgrade(): | |
run('apt-get update && apt-get -y upgrade') | |
reboot() |
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
This is a test. |
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
class a(): | |
def set_attrs_in_class_given_key_value_pairs(**kwargs): | |
for k,v in kwargs.iteritems(): | |
setattr(self, k, v) |
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
This is <i>only</i> a test. |
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
With an extra file. |
OlderNewer