Skip to content

Instantly share code, notes, and snippets.

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

Justin Adler PureKrome

💭
🦘🕺🏻🎶🕹
View GitHub Profile
@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.
@PureKrome
PureKrome / backend-storage-azurite.yml
Created August 22, 2019 10:07
Azurite in a Kubernetes setup
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: storage-azurite-deployment
spec:
replicas: 1
selector:
matchLabels:
tier: backend
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Hornet.Core.Storage.EventBus
{
public interface IEventBus
{
string Name { get; }
Task PublishAsync<T>(T @event) where T : class, IEvent;
@PureKrome
PureKrome / program.cs
Last active November 29, 2018 08:22
Playing around with the new .NET Generic Host in .NET Core 2.1+
//
// REF: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/host/generic-host?view=aspnetcore-2.1
// https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging/?view=aspnetcore-2.1#add-providers
// https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-2.1#memory-configuration-provider
//
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
@PureKrome
PureKrome / DocumentStoreExtensions.cs
Created September 20, 2018 09:30
RavenDb DocumentStore extensions class for simplifying the setup of RavenDb in a .NET Core app
using Microsoft.Extensions.Logging;
using Polly;
using Raven.Client.Documents;
using Raven.Client.Documents.Indexes;
using Raven.Client.Documents.Operations;
using Raven.Client.Exceptions.Database;
using Raven.Client.Exceptions.Security;
using Raven.Client.ServerWide;
using Raven.Client.ServerWide.Operations;
using System;
@PureKrome
PureKrome / program.cs
Created August 30, 2018 04:08
Sample program.cs
using Microsoft.ApplicationInsights;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Serilog;
using System;
using System.IO;
namespace Hornet.Api
@PureKrome
PureKrome / SlowRequestController.cs
Last active August 18, 2017 13:47
Testing a slow request (like a bad performing DB query)
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace wwwlearn.Controllers
{
@PureKrome
PureKrome / gist:55698e875e6c9028a09096c04691186f
Created March 1, 2017 08:31
Calling google api's in unit tests by providing fake responses
/*
This is a quick example of how to fake out the response for calling a Google API endpoint.
I'm using the QPX Express api as an example, but I'm _assuming_ this could apply accross the board
for other Google API's.
The reason you would want to do this, is so you don't need to hit the internet to get your results
(think, coding on a plane, no internet coverage, no hurting your API allowance, etc).
The main trick here is that we need to do two things:
1. Create a fake HttpMessageHandler
@PureKrome
PureKrome / gist:00e7f2be557e94911fb6b23119639e3e
Last active May 10, 2016 12:58
RavenDb repo with breaking code.
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Raven.Client;
using Raven.Client.Linq;
using Raven.Tests.Helpers;
using Xunit;
namespace ClassLibrary1
{