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
cheat sheet: | |
http://cheat.errtheblog.com/s/mongo | |
for more on update see: | |
http://www.mongodb.org/display/DOCS/Updating#Updating-update%28%29 | |
======================== DEV ============================== | |
---search by date: | |
db.houses.find({"dateadded": { "$gt" : ISODate("2013-01-01")} } ) | |
-- Get by subdocument key field: |
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
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 |
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 | |
"""\ | |
A simple demo of logging configuration with YAML (Python 2.7) | |
============================================================= | |
Requires PyYAML -> "easy_install PyYAML" | |
See the recipes for configuring logging with dicts and YAML | |
- http://docs.python.org/2.7/howto/logging-cookbook.html | |
- http://stackoverflow.com/questions/10519392/python2-7-logging-configuration-with-yaml |
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 | |
""" | |
How to use it: | |
1. Just `kill -2 PROCESS_ID` or `kill -15 PROCESS_ID` , The Tornado Web Server Will shutdown after process all the request. | |
2. When you run it behind Nginx, it can graceful reboot your production server. | |
3. Nice Print in http://weibo.com/1682780325/zgkb7g8k7 | |
""" |