Skip to content

Instantly share code, notes, and snippets.

@dystopiandev
dystopiandev / nugetpackageload.cs
Created December 9, 2023 23:28 — forked from alistairjevans/nugetpackageload.cs
Complete Example Package Loader
using AutoStep.Extensions;
using Microsoft.Extensions.DependencyModel;
using NuGet.Common;
using NuGet.Configuration;
using NuGet.Frameworks;
using NuGet.Packaging;
using NuGet.Packaging.Core;
using NuGet.Packaging.Signing;
using NuGet.Protocol.Core.Types;
using NuGet.Resolver;
@dystopiandev
dystopiandev / postgres.md
Created July 7, 2022 20:34 — forked from phortuin/postgres.md
Set up postgres + database on MacOS (M1)

Based on this blogpost.

Install with Homebrew:

$ brew install postgresql

Run server:

import * as pulumi from "@pulumi/pulumi";
import * as hc from "@pulumi/hcloud";
import { randomUUID } from "crypto";
interface DynamicProviderOutputs {
name: string
configuration: {[index:string]: any};
}
class CtrlConfigurationProvider implements pulumi.dynamic.ResourceProvider {
@dystopiandev
dystopiandev / 1_triggers.sql
Created May 15, 2022 11:45 — forked from fritzy/1_triggers.sql
Get table change notifications from Postgres as JSON
CREATE OR REPLACE FUNCTION table_update_notify() RETURNS trigger AS $$
DECLARE
id bigint;
BEGIN
IF TG_OP = 'INSERT' OR TG_OP = 'UPDATE' THEN
id = NEW.id;
ELSE
id = OLD.id;
END IF;
PERFORM pg_notify('table_update', json_build_object('table', TG_TABLE_NAME, 'id', id, 'type', TG_OP)::text);
@dystopiandev
dystopiandev / eventstoredb-projection-typings.d.ts
Created July 27, 2021 03:00
Typings/intellisense for EventStoreDB's JavaScript-based projections.
declare type RecordedEvent = {
body: any
isJson: boolean
data: any
// TODO: add props
}
declare type ProjectionState = Record<string, any>
declare type HandlerFunction =
@dystopiandev
dystopiandev / NameCaseHelper.cs
Last active June 1, 2021 23:37
C# Name Case Helper
/*** Original: https://stackoverflow.com/a/45774526 ***/
namespace Common.CIQ.Helpers
{
using System.Collections.Generic;
using System.Globalization;
using System.Text.RegularExpressions;
public static class NameCaseHelper
{
private static readonly Dictionary<string, string> Exceptions = new()
@dystopiandev
dystopiandev / NameCaseHelper.cs
Created June 1, 2021 14:49
C# Name Case Helper
/*** Original: https://stackoverflow.com/a/45774526 ***/
namespace Common.Lib.Helpers
{
using System.Collections.Generic;
using System.Globalization;
using System.Text.RegularExpressions;
public static class NameCaseHelper
{
private static readonly Dictionary<string, string> Exceptions = new()
@dystopiandev
dystopiandev / certbot.sh
Last active July 10, 2019 22:11
NodeJS + Nginx hosting env setup on Debian 9 (Stretch)
sudo echo 'deb http://deb.debian.org/debian stretch-backports main' | sudo tee -a /etc/apt/sources.list > /dev/null
sudo apt update
sudo apt install certbot python-certbot-nginx -t stretch-backports