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.Runtime.InteropServices; | |
| using System.Threading; | |
| [StructLayout(LayoutKind.Sequential)] | |
| internal struct InteropCancellationToken | |
| { | |
| public InteropCancellationToken(CancellationToken ct) | |
| { | |
| IsCancellationRequested = () => ct.IsCancellationRequested; | |
| } |
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 Microsoft.Extensions.Logging; | |
| public static class LogEx | |
| { | |
| public static ScopeStateBuilder<T> With<T>(this ILogger<T> logger, string k, object? v) => new(logger, k, v); | |
| public sealed class ScopeStateBuilder<T> : ILogger<T> | |
| { | |
| private readonly ILogger<T> _logger; | |
| private readonly IDictionary<string, object?> _state = new Dictionary<string, object?>(); |
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.ComponentModel.DataAnnotations; | |
| using System.Net.Mime; | |
| using System.Text; | |
| using MassTransit; | |
| using Microsoft.Extensions.Configuration; | |
| using Microsoft.Extensions.DependencyInjection; | |
| using Microsoft.Extensions.Hosting; | |
| using Microsoft.Extensions.Logging; | |
| using Microsoft.Extensions.Options; |
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
| #!/bin/sh | |
| toEnvVars() { | |
| toFlatJson "$1" | jq --raw-output '. | to_entries[] | "\(.key)=\(.value)"' | |
| } | |
| toFlatJson() { | |
| # thank you jeff mercado https://stackoverflow.com/a/42303836/659715 | |
| jq --arg delim '__' 'reduce (tostream|select(length==2)) as $i ({}; | |
| .[[$i[0][]|tostring]|join($delim)] = $i[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
| [user] | |
| name = Jacob | |
| email = jace42@thegoogles.mail | |
| [alias] | |
| unstage = restore --staged | |
| changelog = log --format='* %s%n%w(,4,4)%+b' | |
| pick = cherry-pick | |
| ll = log --graph --pretty=format:'%C(auto)%h %ad %d %s %C(white)[%aN]' --date='format:%y·%b·%d' --use-mailmap | |
| l = ll --remotes='origin/head' origin/head~5..HEAD |
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.Net.Http.Json; | |
| using System.Text; | |
| using System.Text.Json; | |
| using System.Text.Json.Serialization; | |
| class GitlabClient | |
| { | |
| private readonly HttpClient _client; | |
| public GitlabClient(HttpClient client, string token) |
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
| #!/bin/sh | |
| countWords() { | |
| commit="$1" | |
| word_count=$(git show --format='%B' --no-patch "$commit" | wc -w) | |
| auth="$(git show --format='%h %aN / %cN' --no-patch $commit)" | |
| echo "$word_count $auth" | |
| exit 0 | |
| } |
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
| #!/bin/sh | |
| SELF=${0##*/} | |
| setPgEnvVars() { | |
| # consult `man test` for conditionals | |
| if [ -z "$1" ]; then | |
| usage | |
| die "Missing aws env argument, like dev or live" | |
| fi |
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 Ardalis.GuardClauses; | |
| using Microsoft.Extensions.Logging; | |
| public static class LoggerExtensions | |
| { | |
| /// <summary> | |
| /// Begins a logical operation scope. | |
| /// </summary> | |
| /// <example> | |
| /// <para> |
NewerOlder