I hereby claim:
- I am adamcheasley on github.
- I am adamfc (https://keybase.io/adamfc) on keybase.
- I have a public key ASBrc7vcoUTX2Jg-7FtVdk20XyXud6cfB6gbqXKUfDLatwo
To claim this, I am signing this object:
import docx | |
from docx.shared import Inches | |
doc = docx.Document() | |
table = doc.add_table(rows=2, cols=2) | |
table.style = 'TableGrid' | |
table.autofit = True | |
table.cell(0, 0).text = 'Time Zone' |
import requests | |
def sum_of_proper_divisors(n): | |
divisor_sum = 1 | |
for x in range(2, int((n / 2) + 1)): | |
if n % x == 0: | |
divisor_sum += x | |
return divisor_sum |
#!/bin/bash | |
# based on http://www.snip2code.com/Snippet/165926/Check-for-ipdb-breakpoints-git-hook | |
pdb_check=$(git grep -E -n '[ ;]i?pdb') | |
if [ ${#pdb_check} -gt 0 ] | |
then | |
echo "COMMIT REJECTED: commit contains code with break points. Please remove before commiting." | |
echo $pdb_check | |
exit 1 | |
fi |
I hereby claim:
To claim this, I am signing this object:
""" | |
helloevolve.py implements a genetic algorithm that starts with a base | |
population of randomly generated strings, iterates over a certain number of | |
generations while implementing 'natural selection', and prints out the most fit | |
string. | |
The parameters of the simulation can be changed by modifying one of the many | |
global variables. To change the "most fit" string, modify OPTIMAL. POP_SIZE | |
controls the size of each generation, and GENERATIONS is the amount of | |
generations that the simulation will loop through before returning the fittest |
#! /bin/bash | |
DESCRIBE=`git describe --tags` | |
MAJOR=`echo $DESCRIBE | awk '{split($0,a,"."); print a[1]}'` | |
MINOR=`echo $DESCRIBE | awk '{split($0,a,"."); print a[2]}'` | |
BUG=`echo $DESCRIBE | awk '{split($0,a,"."); print a[3]}'` | |
echo $MAJOR | |
echo $MINOR | |
echo $BUG |
# quick and dirty skin script to audit a site's content | |
# stucture is {portal_type: {state: count}} | |
brains = context.portal_catalog.searchResults() | |
types = {} | |
for brain in brains: | |
ctype = brain['portal_type'] | |
state = brain['review_state'] | |
state_counts = types.setdefault(ctype, {}) | |
count = state_counts.setdefault(state, 0) |
def uniquify_ordered(seq, idfun=None): | |
# Removes duplicates from a list and preserves the order of items | |
# Taken from http://www.peterbe.com/plog/uniqifiers-benchmark | |
if idfun is None: | |
def idfun(x): | |
return x | |
seen = {} | |
result = [] | |
for item in seq: | |
marker = idfun(item) |
from z3c.relationfield.schema import RelationChoice, RelationList | |
class IRDFFramework(form.Schema): | |
"""RDF descriptors""" | |
rdf_framework = RelationList( | |
title=_(u"RDF Framework"), | |
default=[], | |
value_type=RelationChoice( | |
source=ObjPathSourceBinder( |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" | |
xmlns:tal="http://xml.zope.org/namespaces/tal" | |
xmlns:metal="http://xml.zope.org/namespaces/metal" | |
xmlns:i18n="http://xml.zope.org/namespaces/i18n" | |
lang="en" | |
metal:use-macro="context/main_template/macros/master" | |
i18n:domain="plone"> | |
<body> | |
<metal:main fill-slot="content-core"> |