I hereby claim:
- I am rianjs on github.
- I am rianjs (https://keybase.io/rianjs) on keybase.
- I have a public key ASCOyDcaIMio8HeHSPE8Mt83rZJsqVhcS5rzwU0SDkg06Ao
To claim this, I am signing this object:
-- Add the IANA time zones so we can reference them when doing DateTime and DateTimeOffset conversions | |
-- Data from NodaTime via Matt Johnson: https://github.com/mj1856/SqlServerTimeZoneSupport | |
-- I generated this script by: | |
-- 1. Running the NodaTime import program into a local database | |
-- 2. Exporting the schema creation AND data | |
-- 3. Massaging the SSMS output to make it idempotent | |
SET ANSI_NULLS ON | |
GO |
// Create the WND time with a real time zone | |
var localDt = LocalDateTime.FromDateTime(DateTime.Now); | |
var wndTz = DateTimeZoneProviders.Tzdb["America/Toronto"]; | |
var zonedAsWnd = localDt.InZoneLeniently(wndTz); | |
// Convert that WND time to RNO time | |
var renoTz = DateTimeZoneProviders.Tzdb["America/Los_Angeles"]; | |
var inReno = zonedAsWnd.WithZone(renoTz); | |
// Convert a DateTimeOffset to WND time with a real time zone |
I hereby claim:
To claim this, I am signing this object:
#!/bin/sh git log --numstat | awk '/^Author: /{author=$0} /^[0-9]+\t[0-9]+/{n = $1 + $2; d[author] += n; t += n} END { for(a in d) { printf("%6d %6.3f%% %s\n", d[a], d[a] * 100 / t, a)}}' | sort -rn |
using System.Threading.Tasks; | |
namespace Scratch | |
{ | |
public interface IWorker | |
{ | |
Task DoWorkAsync(); | |
} | |
} |
using System; | |
using System.IO; | |
using System.IO.Compression; | |
using System.Text.Json; | |
namespace CodatIngestion | |
{ | |
public static class CompressionUtils | |
{ | |
public static byte[] ToJsonSerializedGzipBytes<T>(T value, JsonSerializerOptions jsonOpts) |
private static ILogger<T> GetLogger<T>() | |
{ | |
using var loggerFactory = LoggerFactory.Create(builder => | |
{ | |
builder | |
.AddFilter("Microsoft", LogLevel.Warning) | |
.AddFilter("System", LogLevel.Warning) | |
.AddFilter("LoggingConsoleApp.Program", LogLevel.Debug) | |
.AddConsole(); | |
}); |
public static string JoinStrings(IEnumerable<string> args, string separator) | |
{ | |
var needsSeparator = false; | |
var builder = new StringBuilder(); | |
foreach (var arg in args) | |
{ | |
if (string.IsNullOrWhiteSpace(arg)) | |
{ | |
continue; | |
} |
var i = 0; | |
const int limit = 100_000; | |
using (var fStream = fs.FileOpenRead(editionsPath)) | |
using (var gzipStream = new GZipStream(fStream, CompressionMode.Decompress)) | |
using (var textReader = new StreamReader(gzipStream)) | |
{ | |
var line = await textReader.ReadLineAsync(); | |
while (!string.IsNullOrWhiteSpace(line) && i < limit) | |
{ |
public bool HasPermission(long userPermissions, Permission desiredAction) | |
{ | |
if (userPermissions < 1) | |
{ | |
return false; | |
} | |
var asLong = (long)desiredAction; | |
var hasPermission = userPermissions & asLong; |