Skip to content

Instantly share code, notes, and snippets.

View PureKrome's full-sized avatar
💭
🦘🕺🏻🎶🕹

Justin Adler PureKrome

💭
🦘🕺🏻🎶🕹
View GitHub Profile
@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 / 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.
@PureKrome
PureKrome / Notes.md
Last active June 9, 2021 08:44
Running a docker image which shares a windows folder with a folder inside the docker instance

docker run --rm -it -v ${PWD}:/src/scripts --name XXXXXX IMAGENAME /bin/bash

  • --rm this instance will be deleted once we 'exit' the image
  • -it interactive mode
  • -v sharing folders (called sharing VOLUMES)
  • ${PWD} source folder
  • : denotes that we're sharing between these two volumes
@PureKrome
PureKrome / mongodb-cli-cheatsheet.md
Last active November 13, 2022 05:02
🚀 MongoDB CLI newbie cheat sheet 🤘🏻

MongoDB -CLI- Cheat Sheet

  • You do NOT need to have MongoDB "installed" on your machine.
  • Leverage docker images and persist your data via docker 'volumes'.

Start a docker instance.

Create a mongo docker instance (from an image) and start a new shell (this is not a MongoDB shell .. just a normal BASH shell)

  • NOTE: check the volumn settings for your OS. This is a windows example, which connects the files in the current directly, to a specific folder inside the docker image.