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 http.server | |
import socketserver | |
PORT = 5555 | |
class IndexHandler(http.server.SimpleHTTPRequestHandler): | |
"""Always show the index no matter what the requested path.""" | |
def parse_request(self, *args, **kwargs): |
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
Python 2.7.5 (default, Jul 17 2013, 17:11:57) | |
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.27)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> import timeit | |
>>> timeit.timeit("dict()") | |
0.3571889400482178 | |
>>> timeit.timeit("{}") | |
0.04683995246887207 |
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/bash | |
source ~/.profile; workon p3; unset PYTHONPATH; ipython3 |
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
$ python temp.py | |
in try | |
in exceptky |
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
$ history | grep git | awk '{print $3}' | sort | uniq -c | sort -rn | head | |
127 st | |
53 dif | |
46 add | |
33 co | |
23 commit | |
16 push | |
12 pull | |
12 merge | |
10 br |
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
Date & Time, Trans, Elap Time, Data Trans, Resp Time, Trans Rate, Throughput, Concurrent, OKAY, Failed | |
2012-01-31 09:40:15, 1000, 4.47, 0, 0.08, 223.71, 0.00, 19.00, 1000, 0 | |
2012-01-31 09:58:08, 344, 1.32, 0, 0.14, 260.61, 0.00, 35.61, 344, 1154 | |
2012-01-31 09:58:55, 5000, 9.62, 1, 0.14, 519.75, 0.10, 74.46, 5000, 0 | |
2012-02-27 16:28:57, 5349, 186.81, 0, 0.01, 28.63, 0.00, 0.30, 5349, 0 | |
2012-02-27 16:42:54, 0, 109.37, 0, nan, 0.00, 0.00, 0.00, 0, 46 | |
2012-02-27 17:20:42, 9408, 364.87, 0, 0.02, 25.78, 0.00, 0.51, 9408, 15 | |
2012-02-27 17:56:04, 12188, 426.62, 1, 0.01, 28.57, 0.00, 0.24, 12188, 0 | |
2012-03-19 10:48:34, 293, 11.73, |
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/env python | |
x = '10-10-10-10-10-72-97-112-112-121-32-66-105-114-116-104-100-97-121-33-10-10-10-10' | |
print(''.join(chr(int(i)) for i in x.split('-'))) |
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/env python | |
# Run this in python 2 | |
from timeit import timeit | |
# Use a list comprehension instead of map & lambda | |
# ------------------------------------------------ | |
code = "map(lambda x: {'id': x}, range(100))" | |
print(code) | |
print("--> {0}\n".format(timeit(code))) # ~ 21.14860200881958 |
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
server { | |
listen 8000; | |
root /vagrant/MY_PROJECT/static; | |
# My vm's host name is 'appserver' | |
server_name appserver; | |
access_log /var/log/nginx/access.log; | |
gzip off; | |
location /static { |
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
DATA = {u'makesCount': 39, u'makes': [{u'models': [{u'years': [{u'id': 200471908, u'year': 2014}], u'id': u'Acura_ILX', u'niceName': u'ilx', u'name': u'ILX'}, {u'years': [{u'id': 200493809, u'year': 2014}], u'id': u'Acura_ILX_Hybrid', u'niceName': u'ilx-hybrid', u'name': u'ILX Hybrid'}, {u'years': [{u'id': 200465929, u'year': 2014}], u'id': u'Acura_MDX', u'niceName': u'mdx', u'name': u'MDX'}, {u'years': [{u'id': 200467168, u'year': 2014}], u'id': u'Acura_RDX', u'niceName': u'rdx', u'name': u'RDX'}, {u'years': [{u'id': 100539511, u'year': 2014}], u'id': u'Acura_RLX', u'niceName': u'rlx', u'name': u'RLX'}, {u'years': [{u'id': 200488448, u'year': 2014}], u'id': u'Acura_TL', u'niceName': u'tl', u'name': u'TL'}, {u'years': [{u'id': 200490517, u'year': 2014}], u'id': u'Acura_TSX', u'niceName': u'tsx', u'name': u'TSX'}, {u'years': [{u'id': 200673755, u'year': 2014}], u'id': u'Acura_TSX_Sport_Wagon', u'niceName': u'tsx-sport-wagon', u'name': u'TSX Sport Wagon'}], u'id': 200002038, u'niceName': u'acura', u'name': u'Ac |
OlderNewer