This file contains hidden or 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
| .tox/ | |
| /MANIFEST |
This file contains hidden or 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 | |
| # | |
| # Get all posts from del.icio.us | |
| # See http://www.delicious.com/help/api | |
| # | |
| USER=$1 | |
| OUT=posts-${USER}.xml | |
| [ -z "$USER" ] && echo "USAGE: $0 USERNAME" && exit 2 |
This file contains hidden or 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
| """SSL client/server certificates verification for `urllib2`. | |
| It works on Python 2.6, 2.7, 3.1, 3.2 | |
| It also works on Python 2.4, 2.5 if `ssl` is installed (``pip install ssl``) | |
| Example:: | |
| >>> import urllib2, urllib2_ssl | |
| >>> opener = urllib2.build_opener(urllib2_ssl.HTTPSHandler( | |
| ... key_file='clientkey.pem', |
This file contains hidden or 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
| # checkout pyintaller | |
| ##svn co http://svn.pyinstaller.org/trunk pyinstaller && cd pyinstaller | |
| # make Python script that prints uid, euid | |
| printf '#!/usr/bin/env python\nimport os\nprint(os.getuid(),os.geteuid())\n' >print-uid.py | |
| # create stand-alone executable | |
| python pyinstaller.py -F print-uid.py | |
| # change ownership to root |
This file contains hidden or 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 selenium.common.exceptions import NoSuchElementException, TimeoutException, WebDriverException | |
| class SeleniumPage(object): | |
| driver = None | |
| waiter = None | |
| def open_page(self, url): | |
| self.driver.get(url) |
This file contains hidden or 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
| ## | |
| ## ca-bundle.crt -- Bundle of CA Root Certificates | |
| ## | |
| ## Certificate data from Mozilla as of: Wed Jan 18 00:04:16 2012 | |
| ## | |
| ## This is a bundle of X.509 certificates of public Certificate Authorities | |
| ## (CA). These were automatically extracted from Mozilla's root certificates | |
| ## file (certdata.txt). This file can be found in the mozilla source tree: | |
| ## http://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt?raw=1 | |
| ## |
This file contains hidden or 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 sys | |
| import time | |
| version = sys.hexversion | |
| if 0x03000000 <= version < 0x03010000 : | |
| import tkinter | |
| import ttk | |
| elif version >= 0x03010000: | |
| import tkinter | |
| import tkinter.ttk as ttk |
This file contains hidden or 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
| #file: next_permutation.pyx | |
| from libcpp cimport bool | |
| cimport numpy as np | |
| ctypedef np.int_t dtype_t | |
| cdef extern from "<algorithm>" namespace "std": | |
| bool cpp_next_permutation "std::next_permutation" (dtype_t* first, dtype_t* last) |
This file contains hidden or 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
| #cython: boundscheck=False, wraparound=False | |
| import numpy as np | |
| cimport numpy as np | |
| from cython.parallel cimport prange | |
| def dot(np.ndarray[np.float32_t, ndim=2] a not None, | |
| np.ndarray[np.float32_t, ndim=2] b not None, | |
| np.ndarray[np.float32_t, ndim=2] out=None): | |
| """Naive O(N**3) 2D np.dot() implementation.""" |
This file contains hidden or 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
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |