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
insert/s query/s update/s delete/s getmore/s command/s mapped vsize res % locked % idx miss conn time | |
1647 32 74 0 1 45 17050 116046 12357 1.7 0 9536 21:49:33 | |
919 24 68 0 2 32 17050 116076 12357 0.853 0 9539 21:49:34 | |
1118 15 76 0 2 53 17050 116116 12357 0.83 0 9542 21:49:35 | |
865 13 38 0 2 25 17050 116106 12357 0.812 0 9540 21:49:36 | |
2003 13 58 0 3 63 17050 116066 12357 0.913 0 9535 21:49:37 | |
3949 26 68 0 1 84 17050 116006 12357 0.975 0 9532 21:49:38 | |
1391 24 87 0 1 62 17050 116056 12357 0.812 0 9537 21:49:40 | |
2908 30 89 0 0 87 17050 116086 12357 1.66 0 9540 21:49:41 |
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 pymongo | |
import time | |
servers = ['mongo1', 'mongo2'] | |
master = pymongo.Connection(servers) | |
print "MASTER is: %s" % master.host | |
slave = pymongo.Connection( | |
[x for x in servers if x != master.host][0], slave_okay=True) |
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
<script id="tmpl_locations" type="text/x-jquery-tmpl"> | |
{%templatetag openvariable%}each locations{%templatetag closevariable%} | |
<tr> | |
<td><a href="${slug}">${name}</a></td> | |
<td><a href="${slug}">${address}</a></td> | |
<td>${roundto2(latlng[0])}, ${roundto2(latlng[1])}</td> | |
<td>${roundto2(distance)}</td> | |
</tr> | |
{%templatetag openvariable%}/each{%templatetag closevariable%} | |
</script> |
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
<script id="tmpl_locations" type="text/x-jquery-tmpl"> | |
{%templatetag openvariable%}each locations{%templatetag closevariable%} | |
<tr> | |
<td><a href="${slug}">${name}</a></td> | |
<td><a href="${slug}">${address}</a></td> | |
<td>${roundto2(latlng[0])}, ${roundto2(latlng[1])}</td> | |
<td>${roundto2(distance)}</td> | |
</tr> | |
{%templatetag openvariable%}/each{%templatetag closevariable%} | |
</script> |
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
<script type="text/javascript"> | |
alert('running'); | |
</script> |
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
sudo defaults write com.apple.screencapture location $HOME/Desktop/Screenshots | |
killall -HUP SystemUIServer |
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
[color] | |
branch = auto | |
diff = auto | |
status = auto | |
[color "branch"] | |
current = yellow reverse | |
local = yellow | |
remote = green | |
[color "diff"] | |
meta = yellow bold |
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
# autoreconnect handling | |
def autoreconnect(f, *a, **kw): | |
max_tries = 12 | |
num_tries = 1 | |
while True: | |
try: | |
return f(*a, **kw) | |
except pymongo.errors.AutoReconnect, e: | |
logging.warning( | |
'MONGO-AUTORECONNECT attempt=%s' % num_tries, exc_info=True) |
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 diffmatchpatch import diff_match_patch | |
DMP = diff_match_patch() | |
def diff(a, b): | |
diffs = DMP.diff_main(a, b) | |
if len(diffs) > 2: | |
DMP.diff_cleanupEfficiency(diffs) | |
if len(diffs) > 0: | |
delta = DMP.diff_toDelta(diffs) |
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 base64 | |
from diffmatchpatch import diff_match_patch | |
DMP = diff_match_patch() | |
def diff(a, b): | |
a = base64.b64encode(a.encode('utf-8')) | |
b = base64.b64encode(b.encode('utf-8')) | |
diffs = DMP.diff_main(a, b) | |
if len(diffs) > 2: |
OlderNewer