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
# 2009-05-14 13:49 < spdr-:#python> hello. is there an elegant way | |
# to loop for at most N iterations? for a in collection: ... | |
# 2009-05-14 13:49 < KirkMcDonald:#python> spdr-: | |
for x in itertools.islice(collection, N): | |
pass |
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 Person (Entity): | |
using_options (tablename = 'person') | |
full_name = Field(String) | |
given_name = Field(String) | |
sur_name = Field(String) | |
affiliation = Field(String) | |
account = OneToMany('Account') |
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
Just to be painfully complete the solution was: | |
subquery = select([Taggable.c.id], query._criterion, from_obj= query._from_obj).as_scalar() | |
names.select (exists ([names.c.id], and_(names.c.id == obj_tags.c.name_id, obj_tags.c.parent_id==Taggable.c.id , Taggable.c.id.in_ ( subquery) )) | |
which works in 0.4.1, but not in 0.3.11 | |
Thanks for the help! |
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
Mexican Chocolate Tofu Pudding | |
* Sign In to E-Mail | |
* Reprints | |
* ShareClose | |
o Linkedin | |
o Digg | |
o Facebook | |
o Mixx |
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 Webapp: | |
_cp_config = { | |
'/static': { | |
'tools.staticdir.dir': os.path.join(os.path.dirname(__file__),'/static'), | |
'tools.staticdir.on': True | |
} | |
} | |
def index(self): |
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 cp_config(cfg): | |
'''Add cherrypy configuration dictionary to the _cp_config | |
attribute of a method.''' | |
def decorate(f): | |
setattr(f, '_cp_config', cfg) | |
return f | |
return decorate |
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
wyss.harvard.edu. 10800 IN A 128.103.241.91 | |
wyss.harvard.edu. 300 IN MX 10 magix.seas.harvard.edu. | |
wyss.harvard.edu. 300 IN MX 10 mirax.seas.harvard.edu. | |
stage.wyss.harvard.edu. 10800 IN CNAME stage2.wds-appdev.cadm.harvard.edu. | |
www.wyss.harvard.edu. 10800 IN CNAME prod2.wds-appprod.cadm.harvard.edu. |
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
git svn init -s $svnrepo | |
git svn fetch | |
git rebase --onto trunk --root | |
git svn dcommit |
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 gpgme | |
>>> ctx = gpgme.Context() | |
>>> data = open('sample.sh.asc') | |
>>> import sys | |
>>> sig = ctx.verify(data, None, sys.stdout) | |
#!/bin/sh | |
echo "Hello, world." | |
>>> sig[0].validity |
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
#!/bin/sh | |
cd $HOME | |
fs=$(df -P . | tail -1 | sed -n 's|\([^:]*:/[^/]*/[^/]*\)/.*|\1|p') | |
quota -s | head -2 | |
quota -s | grep -A1 "$fs" | head -2 | sed 's|^'"$fs"'.*|'"$fs"'|' | |
OlderNewer