Skip to content

Instantly share code, notes, and snippets.

View cecilphillip's full-sized avatar

Cecil Phillip cecilphillip

View GitHub Profile
@afscrome
afscrome / DelayStartAnnotation.cs
Last active May 16, 2024 11:28
Aspire Readiness checks
public class DelayStartAnnotation(IResource waitForResource) : IResourceAnnotation
{
public IResource WaitForResource { get; } = waitForResource;
}
@davidfowl
davidfowl / MinimalAPIs.md
Last active June 28, 2024 17:42
Minimal APIs at a glance
@johnpapa
johnpapa / repo-sync.bash
Last active May 14, 2021 22:27
Repo Sync: Refresh/merge your local and origin with the upstream.
function repo-sync {
# ######################################
# link: https://jpapa.me/reposync
#
# What this does:
# [𝟙] Get the latest for your origin and upstream main branches'
# [𝟚] Make sure your main origin is in sync with your upstream and your local is pushed
# [𝟛] Checkout your branch and pull the latest'
# [𝟜] Merge main with your branch. This will sync your branch all changes in the upstream
@lizrice
lizrice / Vagrantfile
Last active February 3, 2023 02:21
Vagrant file for setting up a single-node Kubernetes cluster that I can access from my desktop. Read more: https://medium.com/@lizrice/kubernetes-in-vagrant-with-kubeadm-21979ded6c63
# -*- mode: ruby -*-
# vi: set ft=ruby :
# This script to install Kubernetes will get executed after we have provisioned the box
$script = <<-SCRIPT
# Install kubernetes
apt-get update && apt-get install -y apt-transport-https
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
@Jonalogy
Jonalogy / handling_multiple_github_accounts.md
Last active July 21, 2024 20:48
Handling Multiple Github Accounts on MacOS

Handling Multiple Github Accounts on MacOS

The only way I've succeeded so far is to employ SSH.

Assuming you are new to this like me, first I'd like to share with you that your Mac has a SSH config file in a .ssh directory. The config file is where you draw relations of your SSH keys to each GitHub (or Bitbucket) account, and all your SSH keys generated are saved into .ssh directory by default. You can navigate to it by running cd ~/.ssh within your terminal, open the config file with any editor, and it should look something like this:

Host *
 AddKeysToAgent yes

> UseKeyChain yes

@iamarcel
iamarcel / Creating Neat .NET Core Command Line Apps.md
Last active November 28, 2023 10:41
Creating Neat .NET Core Command Line Apps

Creating Neat .NET Core Command Line Apps

You can now read this on my (pretty) website! Check it out here.

Every reason to get more HackerPoints™ is a good one, so today we're going to write a neat command line app in .NET Core! The Common library has a really cool package Microsoft.Extensions.CommandlineUtils to help us parse command line arguments and structure our app, but sadly it's undocumented.

No more! In this guide, we'll explore the package and write a really neat

@g0t4
g0t4 / glossary.md
Last active June 7, 2021 16:49
Consul and related terms
  • Node - a physical or virtual machine that hosts services
    • Nodes also referred to as members.
    • Examples
      • Your computer
      • An AWS EC2 instance
      • A bare metal machine in your private data center
  • Service - executing software that provides utility via an interface
    • Typically long-lived process listening on a port(s)
    • Examples
  • A web server (nginx, apache, iis)
@benaadams
benaadams / Streams-MixinsAndCombines.cs
Last active November 26, 2015 23:25
Stream Evolution in Interfaces (Mixins+Streams)
// Interface segregation (Combined Mixin+Non-mixin)
// For no-mixins version see https://gist.github.com/benaadams/d35ff5c534a43fd6c89d
// For mixins/generic constraints version see https://gist.github.com/benaadams/77c6e7aa34aae92b876a
// Do something with sync Reading, Seeking, Disposable stream (Generic Constraints)
public static void DoSomething<T>(T stream) where T : IBlockingReader, ISeekable, ISizable, IDisposable
{
stream.ReadByte();
stream.SetLength(6);
stream.Position = 5;
@PurpleBooth
PurpleBooth / README-Template.md
Last active July 22, 2024 02:29
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@piers7
piers7 / LogInjectionModule
Last active January 6, 2016 03:01
Generic Autofac logging injector
using System;
using System.Linq;
using Autofac;
using Autofac.Core;
namespace Autofac.Logging
{
/// <summary>
/// Sets up automatic DI for service dependencies on <typeparamref name="TLogger"/>,
/// via an external factory that resolves based on the type of the resolver