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
## TODO: Execute the necessary javascript code on mongo servers for setting up the sharding and replications | |
## TODO: Take a param for type (e.g. All, Config, Shard, Mongos). | |
## TODO: Take a param fof installing as a service or firing up the exes. | |
param( | |
[string]$startDir | |
) | |
function get-cnfgServerObj($port, $path) { | |
$firstCnfgSrv = New-Object PSObject |
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
configuration MongoDB { | |
param ( | |
[string[]]$ComputerName = $env:ComputerName | |
) | |
node $ComputerName { | |
File SetupFolder { | |
Type = 'Directory' | |
DestinationPath = "C:\setup" | |
Ensure = 'Present' | |
} |
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
db.contents.aggregate( | |
{ $match: { $and: [{ Type: "Api" }, { $text: { $search: "configuration" } }] } }, | |
{ $sort: { score: { $meta: "textScore" } } }, | |
{ $project: { _id: 1, Tags: 1 } }, | |
{ $unwind: "$Tags" }, | |
{ $group: { _id: "$Tags", count: { $sum : 1 } }} | |
) |
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
GET http://localhost:25135/api/cars HTTP/1.1 | |
User-Agent: Fiddler | |
Accept: application/json | |
Host: localhost:25135 | |
HTTP/1.1 200 OK | |
Content-Type: application/json; charset=utf-8 | |
Date: Wed, 25 Jun 2014 12:36:48 GMT | |
Content-Length: 68 |
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
const string num = "648634"; | |
if (num.All(ch => char.IsDigit(ch))) | |
{ | |
int parsedVal = 0; | |
for (var i = 0; i < num.Length; i++) | |
{ | |
int foo = 10 ^ (num.Length - i); | |
// ?? | |
} | |
} |
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
using System; | |
using System.Collections.Generic; | |
using Newtonsoft.Json; | |
using Newtonsoft.Json.Converters; | |
using System.Runtime.Serialization; | |
namespace ConsoleApplication11 | |
{ | |
[DataContract] | |
public enum JsonPatchOperationType |
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
public static class ClaimsIdentityExtensions | |
{ | |
public static string GetUserEmail(this ClaimsIdentity identity) | |
{ | |
Claim emailClaim = identity.Claims.FirstOrDefault(claim => claim.Type == ClaimTypes.Email); | |
return emailClaim != null | |
? emailClaim.Value | |
: null; | |
} |
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
{ | |
"took": 2, | |
"timed_out": false, | |
"_shards": { | |
"total": 5, | |
"successful": 5, | |
"failed": 0 | |
}, | |
"hits": { | |
"total": 3, |
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
powershell -NoProfile -ExecutionPolicy unrestricted -windowstyle hidden -Command "cd 'c:\dev';dir" |
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
using System.Collections.Generic; | |
using System.Security.Claims; | |
namespace MultipleClaimsSample | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
// NOTE: The below is a sample of how we may construct a ClaimsPrincipal instance over two ClaimsIdentity instances: |