Skip to content

Instantly share code, notes, and snippets.

@cocowalla
cocowalla / Program.cs
Created December 7, 2018 20:31
Subcommands with Oakton
using System;
using System.Linq;
using System.Threading.Tasks;
using Lamar;
using Oakton;
using MyApp.Commands;
namespace MyApp
{
internal class Program
@cocowalla
cocowalla / Debouncer.cs
Last active July 7, 2022 13:49
Simple debounce
using System;
using System.Threading;
using System.Threading.Tasks;
namespace MyNamespace
{
public class Debouncer : IDisposable
{
private readonly CancellationTokenSource cts = new CancellationTokenSource();
private readonly TimeSpan waitTime;
@cocowalla
cocowalla / splunk.log
Created October 12, 2018 09:19
docker service logs -f my_service
sinks_splunk.1.9tyicwhik6cj@linuxkit-00155d3ad12f | [WARNING]: provided hosts list is empty, only localhost is available. Note
sinks_splunk.1.9tyicwhik6cj@linuxkit-00155d3ad12f | that the implicit localhost does not match 'all'
sinks_splunk.1.9tyicwhik6cj@linuxkit-00155d3ad12f |
sinks_splunk.1.9tyicwhik6cj@linuxkit-00155d3ad12f |
sinks_splunk.1.9tyicwhik6cj@linuxkit-00155d3ad12f | PLAY [localhost] ***************************************************************
sinks_splunk.1.9tyicwhik6cj@linuxkit-00155d3ad12f |
sinks_splunk.1.9tyicwhik6cj@linuxkit-00155d3ad12f | TASK [Gathering Facts] *********************************************************
sinks_splunk.1.9tyicwhik6cj@linuxkit-00155d3ad12f | Friday 12 October 2018 09:12:47 +0000 (0:00:00.040) 0:00:00.040 ********
sinks_splunk.1.9tyicwhik6cj@linuxkit-00155d3ad12f | ok: [localhost]
sinks_splunk.1.9tyicwhik6cj@linuxkit-00155d3ad12f |
@cocowalla
cocowalla / Dockerfile
Last active December 11, 2018 18:37
Web MQTT not using certfile from config
FROM rabbitmq:3.7.5-management-alpine
RUN rabbitmq-plugins enable \
rabbitmq_amqp1_0 \
rabbitmq_shovel \
rabbitmq_shovel_management \
rabbitmq_auth_mechanism_ssl \
rabbitmq_mqtt \
rabbitmq_web_mqtt
@cocowalla
cocowalla / Program.cs
Created June 6, 2018 18:37
Simple console app for testing how mod_nss handles client certificates
using System;
using System.IO;
using System.Net.Http;
using System.Security.Cryptography.X509Certificates;
using System.Threading;
using System.Threading.Tasks;
namespace NssTest
{
class Program
{
// Configure the daemon below:
"options": {
// Select the osquery config plugin.
"config_plugin": "filesystem",
// Select the osquery logging plugin.
"logger_plugin": "filesystem",
// The log directory stores info, warning, and errors.
@cocowalla
cocowalla / dotnetlayout.md
Created February 26, 2018 08:23 — forked from davidfowl/dotnetlayout.md
.NET project structure
$/
  artifacts/
  build/
  docs/
  lib/
  packages/
  samples/
  src/
 tests/
@cocowalla
cocowalla / rabbit-azure.txt
Created February 12, 2018 10:32
RabbitMQ <--> Azure Service Bus
+
Internal network | Azure
|
|
+--------+ | +----------+
| Client +---+ | +---+ Consumer |
+--------+ | | | +----------+
| | |
| +-----------------+ | +-------------------+ |
+-+ RabbitMQ Broker +---------+ Azure Service Bus +--+
@cocowalla
cocowalla / gist:97ba28c28d5f7a3a09c1cd58a443f84a
Last active February 10, 2018 20:44
Docker build output
Sending build context to Docker daemon 36.86kB
Step 1/6 : FROM postgres:9.6-alpine
---> 613fcd71a3c8
Step 2/6 : MAINTAINER Linhe Huo <[email protected]>
---> Using cache
---> 5ded9a9ddcee
Step 3/6 : ENV PLV8_VERSION v2.0.3
---> Using cache
---> ff3c92b5174b
Step 4/6 : ENV DEPOT_TOOLS /depot_tools
@cocowalla
cocowalla / ClaimsIdentity.cs
Last active November 9, 2018 15:49
Attempt at adding a custom ClaimsIdentity to the Principal
builder.AddOpenIdConnect(options =>
{
options.Events = new OpenIdConnectEvents
{
OnTokenValidated = async ctx =>
{
var db = ctx.HttpContext.RequestServices.GetRequiredService<DataContext>();
// Get the user's Azure Active Directory ID
var userId = Guid.Parse(ctx.Principal.FindFirst(OBJECT_ID_CLAIM_TYPE).Value);