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
#!/usr/bin/python2.5 | |
# -*- coding: utf-8 -*- | |
# Copyright © 2010 Andrew D. Yates | |
# All Rights Reserved | |
"""Assorted Google App Engine Python Utilities. | |
ID: random string for IDs | |
KeyPath: human readable path of an app engine datastore key | |
Cookie: generate HTTP cookie header formatted string | |
""" |
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
<samlp:Response xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" ID="{{ response_id }}" IssueInstant="{{ issue_instant }}" Version="2.0"><samlp:Status><samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"></samlp:StatusCode></samlp:Status><saml:Assertion ID="{{ assertion_id }}" IssueInstant="{{ issue_instant }}" Version="2.0"><saml:Issuer>{{ issuer }}</saml:Issuer><saml:Subject><saml:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress">{{ username }}</saml:NameID><saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"><saml:SubjectConfirmationData {% if request_id %}InResponseTo="{{ request_id }}" {% endif %}NotOnOrAfter="{{ not_on_or_after }}" Recipient="{{ acs_url }}"></saml:SubjectConfirmationData></saml:SubjectConfirmation></saml:Subject><saml:Conditions NotBefore="{{ not_before }}" NotOnOrAfter="{{ not_on_or_after }}"><saml:AudienceRestriction><saml:Audience>{{ acs_url }}</saml:Audience></saml:AudienceR |
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
application: myapplication | |
version: 1 | |
runtime: python | |
api_version: 1 | |
handlers: | |
- url: /_ah/login_required | |
script: do_openid_login.py |
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 gzip | |
import zipfile | |
def open_with_zip(filepath): | |
"""Open a file with .gzip, .zip, or no compression. | |
Returns: | |
[*str] read filepointer of uncompressed file stream | |
""" | |
ext = filepath.lower().rpartition('.')[-1] |
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
# -*- coding: utf-8 -*- | |
""" | |
Created on Fri Jun 15 14:00:29 2012 | |
Author: Josef Perktold | |
License: MIT, BSD-3 (for statsmodels) | |
http://en.wikipedia.org/wiki/Distance_correlation | |
Yaroslav and Satrajit on sklearn mailing list |
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
# Copyright (c) 2012, Florian Finkernagel. All right reserved. | |
## Redistribution and use in source and binary forms, with or without | |
## modification, are permitted provided that the following conditions are | |
## met: | |
## * Redistributions of source code must retain the above copyright | |
## notice, this list of conditions and the following disclaimer. | |
## * Redistributions in binary form must reproduce the above | |
## copyright notice, this list of conditions and the following |
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
#!/usr/bin/python | |
import numpy as np | |
import os | |
TEST_FILE=os.path.expanduser("~/Dropbox/biostat/eqtl_data/GSE25935/GSE25935.GPL4133.eQTL.nooutliers.tab") | |
# this does not (yet) work | |
# http://docs.scipy.org/doc/numpy/reference/generated/numpy.genfromtxt.html#numpy.genfromtxt | |
# http://docs.scipy.org/doc/numpy/reference/generated/numpy.loadtxt.html#numpy.loadtxt |
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
""" | |
===================================================== | |
Distance computations for masked arrays (:mod:`scipy.spatial.mdistance`) | |
===================================================== | |
.. sectionauthor:: Damian Eads, Jason Merkin | |
Function Reference | |
------------------ |
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
# http://stackoverflow.com/questions/842059/is-there-a-portable-way-to-get-the-current-username-in-python | |
import os, pwd | |
username = pwd.getpwuid(os.getuid()).pw_name |
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
#!/usr/bin/python | |
import os, errno | |
def make_dir(outdir): | |
try: | |
os.makedirs(outdir) | |
except OSError, e: | |
if e.errno != errno.EEXIST: raise | |
return outdir |
OlderNewer