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
/* | |
MIT License | |
Copyright (c) 2017 Martin Buberl | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
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
# | |
# tuned configuration optimized for MongoDB on AWS (or other cloud services) | |
# based on the 'virtual-guest' tuned profile | |
# tested on RHEL7 | |
# | |
[main] | |
summary=Optimize for MongoDB wiredTiger Performance | |
include=virtual-guest |
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
/** | |
* | |
* This script is to experiment with a compound shard key. | |
* | |
* Goals: | |
* 1. the hash (h) to always be the same for the same date (down to the day level) | |
* 2. documents with the same exact date (dMy) go on the same shard but different day to different shards | |
* 3. will work well with 100m+ documents | |
* 4. small overhead related to a simple (non-compound) date shard key | |
* 5. still support targeted queries (as long as "h" field is included in the query by the application) |
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
import com.github.scribejava.core.builder.ServiceBuilder; | |
import com.github.scribejava.core.builder.api.DefaultApi20; | |
import com.github.scribejava.core.model.*; | |
import com.github.scribejava.core.oauth.OAuth20Service; | |
import org.jetbrains.annotations.Nullable; | |
import org.json.simple.JSONArray; | |
import org.json.simple.JSONObject; | |
import org.json.simple.parser.JSONParser; | |
import org.json.simple.parser.ParseException; |
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
// Inline Labels | |
// -------------------------------------------------- // | |
$('input, textarea').each(function() { | |
// load the corresponding label | |
var $self = $(this); | |
var $label = $("label[for='" + $self.attr("id") + "']"). | |
if ($label.text(); { |
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
systemLog: | |
destination: file | |
path: "/var/log/mongo/mongo-arb.log" | |
logAppend: true | |
storage: | |
dbPath: "/var/lib/mongo-arb" | |
processManagement: | |
fork: true | |
pidFilePath: "/var/run/mongo/mongod-arb.pid" | |
net: |
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
# After etckeeper installation | |
/etc/etckeeper/etckeeper.conf VCS="git" | |
etckeeper init && etckeeper commit | |
# ------ | |
git config --global user.name "My Machine" | |
git config --global user.email "etckeeper@my.machine" |
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
// derived from http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Parallel_algorithm | |
function map() { | |
emit(1, // Or put a GROUP BY key here | |
{sum: this.value, // the field you want stats for | |
min: this.value, | |
max: this.value, | |
count:1, | |
diff: 0, // M2,n: sum((val-mean)^2) | |
}); |