Things are rarely simple or obvious when working across languages; especially when one is .net. Rather than waste time here's the code, in its long form. Test parameters With a key 182634d8894831d5dbce3b3185c50881 and a message or data value of some random junk with both solutions we should receive d94ed997943420b7d5dfb9b31ae236b7b5225510d8f0314c54ad44fb5fd44a06 C# public string HmacSHA256(string key, string data) { string hash; ASCIIEncoding encoder = new ASCIIEncoding(); Byte[] code = encoder.GetBytes(key); using (HMACSHA256 hmac = new HMACSHA256(code)) { Byte[] hmBytes…

When copying to the local file system I always use the following rsync options: rsync -aWhv --no-compress --progress /source/ /destinationfolder/ --no-compress as it's on the same machine --progress speaks for itself -a preserves ownership & permissions using archive flag -W copying whole files only # and optional ones for watching -h human-readable transfer rate and file sizes -v keeps it verbose so we can see whats happening…

Back in early 2013 I was pasting stickers all over my Acer, as if it was some sort of third-rate thermal insulation, and I thought to myself, wouldn't it be nice if I could have a C# one. Annoyingly all the C# ones were god awful. But Jeremy Kratz had made a nice C++ one while at MSFT and had kindly made it clear he wasn't bothered about the licence something confirmed recently. Anyhoo I liked…

Just a few bits and bobs I've collected up lately. Aggregation is a neat feature in MongoDB and as with most mongo c# stuff it's often a small hurdle to implementing the same query you perform in BSON in the driver language… Sooo just to get you started https://chrismckee.co.uk/mongo-aggregation-in-c/ Quite a good idea to mix this with Profiling so you can watch how it's querying etc... Pipeline Requests I like the pipe…

Grouping Data with Count Note: This starts with the 1.10.1 version of the mongo driver; https://www.nuget.org/packages/mongocsharpdriver/1.10.1 the v2 driver wraps the Async methods to syncronous to stay 'compatible' and as such is slower. So running 'synchronous' using v2 would be disadvantaged by the new driver while async with the async driver may have a minor benefit. The async is covered further down using Driver 2.1.…