Skip to content

Instantly share code, notes, and snippets.

View hoffrocket's full-sized avatar
👋

Jon Hoffman hoffrocket

👋
  • Anomaly
  • New York, NY
View GitHub Profile
db.getCollectionNames().forEach(function(n){
var shardConfig = db.getSisterDB('config').collections.findOne({_id:"foursquare." + n},{key:1});
if (shardConfig){
var shardKeyNameParts = [];
for (var keyPart in shardConfig.key) {
shardKeyNameParts.push(keyPart + "_" + shardConfig.key[keyPart]);
}
var shardKeyName = shardKeyNameParts.join('_');
var shardKeySizeMb = Math.round(db[n].stats().indexSizes[shardKeyName]/1024/1024);
db[n].getIndexes().forEach(function(i){
import org.apache.commons.lang.StringUtils;
public class ReplaceTime
{
static final int LOOPS = 100000;
static void timeReplace() {
long start = System.nanoTime();
for (int i = 0; i < LOOPS; i++) {
"foo;bar;car".replace(";", "%3B");
@hoffrocket
hoffrocket / README.md
Last active December 27, 2015 12:49 — forked from miku/README.md

Example outputs:

$ python dynamic.py DynamicRequirements --a 4 --b 8

DEBUG: Checking if DynamicRequirements(a=4, b=8) is complete
INFO: Scheduled DynamicRequirements(a=4, b=8)
DEBUG: Checking if SomeTask(number=4) is complete
INFO: Scheduled SomeTask(number=4)
INFO: Done scheduling tasks

DEBUG: Asking scheduler for work...

Linux - create "Default (Linux).sublime-mousemap" in ~/.config/sublime-text-3/Packages/User
Mac - create "Default (OSX).sublime-mousemap" in ~/Library/Application Support/Sublime Text 3/Packages/User
Win - create "Default (Windows).sublime-mousemap" in %appdata%\Sublime Text 3\Packages\User
[
{
"button": "button1",
"count": 1,
"modifiers": ["super"],
"press_command": "drag_select",