$ ping -c 10 52.3.228.11
PING 52.3.228.11 (52.3.228.11): 56 data bytes
64 bytes from 52.3.228.11: icmp_seq=0 ttl=39 time=196.512 ms
64 bytes from 52.3.228.11: icmp_seq=1 ttl=39 time=216.174 ms
64 bytes from 52.3.228.11: icmp_seq=2 ttl=39 time=241.810 ms
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 -*- | |
import re | |
arr = [] | |
for i in range(1, 40): | |
arr.append("^/api/x%02s/(?:\d+)($)" % i) | |
arr.append("^/api/x%02s/(?:\d+)/edit($)" % i) | |
arr.append("^/api/x%02s/(?:\d+)/comments($)" % i) | |
all_rexp= re.compile("|".join(arr)) #=> AssertionError |
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
Title: How to make the fastest Router library in Python | |
Router is one of the most important feature or component in Web application framework, | |
ant it is also one of the performance bottlenecks of framework. | |
In this session, I'll show you how to make router much faster than ever. | |
* linear search | |
* prefix search | |
* regexp concatenation | |
* regexp optimization |
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
## | |
## before diet | |
## | |
$ du -sk * | |
91512 2.6.9 | |
109068 2.7.13 | |
117908 3.3.6 | |
115024 3.4.5 | |
142572 3.5.2 |
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
$ time gzip -c db_backup.pgdump > db_backup.pgdump.gz | |
real 34m57.109s | |
user 34m13.108s | |
sys 0m38.711s | |
$ time bzip2 -c db_backup.pgdump > db_backup.pgdump.bz2 | |
real 166m0.206s | |
user 164m28.035s |
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 -*- | |
from datetime import date, timedelta | |
class Calendar(object): | |
def __init__(self, year, month): | |
self.year = year | |
self.month = month |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>ah</key> | |
<string>ニョ</string> | |
<key>ai</key> | |
<string>ヌ</string> | |
<key>aj</key> | |
<string>ナ</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
# -*- coding: utf-8 -*- | |
## license: public domain | |
import re | |
URLPATH_PARAM_PATTERN = r'<(\w+)(?::(.*?))?>' | |
re_escape = lambda s: re.escape(s).replace(r'\/', '/') |
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 -*- | |
## | |
## 参考: 「Python機械学習プログラミング」 | |
## | |
## 注: 事前にCSVファイルをダウンロードしておくこと | |
## $ wget https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data | |
## | |
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 -*- | |
#from ch02_1 import Perceptron | |
from perceptron import Perceptron, Perceptron2 | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import pandas as pd | |
NewerOlder