Skip to content

Instantly share code, notes, and snippets.

View PureKrome's full-sized avatar
๐Ÿ’ญ
๐Ÿฆ˜๐Ÿ•บ๐Ÿป๐ŸŽถ๐Ÿ•น

Justin Adler PureKrome

๐Ÿ’ญ
๐Ÿฆ˜๐Ÿ•บ๐Ÿป๐ŸŽถ๐Ÿ•น
View GitHub Profile
@PureKrome
PureKrome / SlackNotification.yml
Created February 14, 2025 08:55
GitHub Action to notify a Slack Channel when a PR is *merged*
name: Notify Slack via Email on PR Merge
on:
pull_request:
branches: [ main ]
types:
- closed
jobs:
notify:
@PureKrome
PureKrome / program.cs
Last active June 14, 2023 13:49
Logging to the console with .NET 7 + top level statements + Serilog + custom logging extension method
/*
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.1" />
<PackageReference Include="Serilog.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Serilog.Formatting.Compact" Version="1.1.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
</ItemGroup>
@PureKrome
PureKrome / ApplicationSettings.cs
Last active June 6, 2023 13:06
A simple AWS Lambda for .NET7 + Dependency Injection
namespace SomeLambdaFunction
{
public class ApplicationSettings
{
private const string ConnectionStringEnvironmentalVariableName = "MY_POSTGRES_CONNECTIONSTRING";
public ApplicationSettings()
{
var isMissingEnvironmentalVariableData = false;
@PureKrome
PureKrome / program.cs
Created May 8, 2023 05:42
MediatR behavior not working
/*
Needs these package in the csproj
<ItemGroup>
<PackageReference Include="CSharpFunctionalExtensions" Version="2.38.1" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.5.2" />
<PackageReference Include="MediatR" Version="12.0.1" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.5" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
@PureKrome
PureKrome / mongodb_tricks.txt
Created December 20, 2022 05:55
MongoDB tricks to check performance
// Based on https://studio3t.com/knowledge-base/articles/mongodb-query-performance/
// THESE ARE THE Database.Collection
var scope = [
"apps.appInstalls",
"apps.apps"
]
// These are the operations to check
var generalOps = [
"query",
@PureKrome
PureKrome / github-action-environment-variables.md
Created August 4, 2022 13:16
Github custom environment variables - how each shell does this differently
@PureKrome
PureKrome / Node-plus-Docker.md
Last active February 28, 2025 02:54
Running NPM inside a docker container

How to run some Node code in Docker because you're smart and don't want to have evil Node installed on your PC.

NODE DOCKER VERSIONS: https://hub.docker.com/_/node


docker run --rm -it -v ${PWD}:/src/someProject --name npm-stuff node /bin/bash
@PureKrome
PureKrome / gist:e970b5fdf99c82706f12b0fcf72fa9fc
Created October 21, 2021 07:03
Trying to use Elasticsearch
-- Get a list of all indicies
GET /_cat/indices
--
GET /_cat/aliases <-- get the aliases to the indicies
-- normal searching
@PureKrome
PureKrome / rider-debugging-external-code-private-repo.md
Last active August 16, 2021 03:28
Debugging .NET Core external code from a private GitHub repo

HOWTO: Debug .NET Core external code from a ๐Ÿ”’ private GitHub repository, using JetBrains Rider

GITHUB: Create a GitHub "PAT" (Personal Access Token)

To access any locked/private resources in GitHub, you need a PAT. This is a specific access key that you can create to unlock whatever resource you own.

  • Login to GitHub
  • Click on your avatar icon (top right corner) -> Settings
  • Now click Developer Settings -> Personal Access Tokens
  • Click "Generate New Token" button
@PureKrome
PureKrome / gitconfig setup.md
Last active September 11, 2021 08:31
Setting up gitconfig for different work/personal folders/projects

Summary

  • Have different username/email settings for WORK or PERSONAL projects
  • Uses the includeIf hack (unfortunately)
  • To get this to work (or test) the folder needs to have had git init already occur on it.
  • Hack the global .gitconfig file
  • Add separate .gitconfig files where you want have separate settings for different work / personal / serious-projects.
  • For Windows OS, you need to use case -INSENSITIVE- git command => gitdir/i .. most examples say to use gitdir but that fails on Windows OS.