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
| version = config.get('app', 'version') # '4.2.0' | |
| for row in db.view('mydb/' + version): | |
| do_stuff(row) |
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
| #!/usr/bin/env node | |
| var sys = require('sys') | |
| var filename = process.ARGV[2]; | |
| if (!filename) | |
| return sys.puts("Usage: node monitor_memcached.js /path/to/memcached.log"); | |
| // Look at http://nodejs.org/api.html#_child_processes for detail. | |
| var tail = process.createChildProcess("tail", ["-f", filename]); |
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
| server { | |
| location / { | |
| root /var/www/nginx-default; | |
| try_files /maintenance.html @frontends; | |
| } | |
| location @frontends { | |
| proxy_pass http://appservers; | |
| } | |
| } |
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
| source :in, { | |
| :file => "../data/input/period_times.csv", | |
| :parser => :delimited | |
| }, | |
| [ | |
| :period, | |
| :start_time, | |
| :end_time | |
| ] |
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
| result = db.log.mapReduce( | |
| function() { | |
| if(this.hash) { | |
| emit(this.hash, { | |
| 'sum': this.duration, | |
| 'count': 1, | |
| 'sql': this.sql | |
| }) | |
| } | |
| }, |
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 logging | |
| from functools import wraps | |
| from hashlib import md5 | |
| from memcache import Client | |
| def memoized(side_effect=None): | |
| side_effect = side_effect or (lambda s, a, k: None) | |
| def _memoized(func): |
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
| node /^cloud\d+\.prod\.mydomain\.net$/ { | |
| include portal | |
| } | |
| node /^cloud\d+\.dev\.mydomain\.net$/ { | |
| include portal | |
| include random-dev-stuff | |
| } | |
| class portal { |
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 which cp | |
| /bin/cp |
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
| It goes: | |
| <dict> | |
| <key>key1</key> | |
| <string>val1</string> | |
| <key>key2</key> | |
| <string>val2</string> | |
| </dict> | |
| Which translate to |
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
| $.get('/my_data_service', function(data) { | |
| // Am I guaranteed that data.values will always be there and always will be an array? | |
| for (var i in data.values) { | |
| do_things(data.values[i]) | |
| } | |
| }) |