Skip to content

Instantly share code, notes, and snippets.

@bdrupieski
bdrupieski / Program.cs
Created Dec 3, 2019
delete unbound persistent volume claims
View Program.cs
using System;
using System.Linq;
using System.Threading.Tasks;
using k8s;
namespace KubeStuff
{
class Program
{
static async Task Main(string[] args)
@bdrupieski
bdrupieski / fixed-width-table.js
Last active Apr 3, 2020
extract output from DataGrip into evenly spaced fixed width columns so it's readable when you paste it into Slack
View fixed-width-table.js
if (!String.prototype.repeat) {
// polyfill from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat
String.prototype.repeat = function(count) {
'use strict';
if (this == null) {
throw new TypeError('can\'t convert ' + this + ' to object');
}
var str = '' + this;
count = +count;
if (count != count) {
@bdrupieski
bdrupieski / CompareForEachToParallelForEachForAddingToDictionary.cs
Created Mar 12, 2017
Performance and correctness comparison between foreach and Parallel.ForEach for adding items to a generic Dictionary<TKey, TValue>
View CompareForEachToParallelForEachForAddingToDictionary.cs
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
namespace App
{
/// <summary>
/// This snippet shows a performance and correctness comparison between
@bdrupieski
bdrupieski / GenerateNatoAlphabetAnkiCards.cs
Created Mar 11, 2017
Generate NATO alphabet Anki cards
View GenerateNatoAlphabetAnkiCards.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using MoreLinq;
namespace App
{
public static class GenerateNatoAlphabetAnkiCards
{
@bdrupieski
bdrupieski / MigrateOrigins.cs
Created Mar 11, 2017
Update origin for all git repositories in a folder
View MigrateOrigins.cs
using System;
using System.Diagnostics;
using System.IO;
namespace App
{
public static class MigrateOrigins
{
public static void DoIt(string[] args)
{
@bdrupieski
bdrupieski / CompareForeachToParallelForeach.cs
Created Mar 11, 2017
Performance and correctness comparison between foreach and Parallel.ForEach
View CompareForeachToParallelForeach.cs
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
namespace App
{
/// <summary>
/// This snippet shows a performance and correctness comparison between
/// foreach and Parallel.ForEach when adding a small number of objects to a
@bdrupieski
bdrupieski / ConfigurablePolymorphicFluentInterface.cs
Created Jul 21, 2016
Configurable polymorphic fluent interface in C#
View ConfigurablePolymorphicFluentInterface.cs
using System;
using System.Collections.Generic;
namespace ConfigurablePolymorphicFluentInterface
{
public class Program
{
static void Main(string[] args)
{
string s = ListEnrollmentsSelectBuilder.Create()
@bdrupieski
bdrupieski / SimpleFluentInterface.cs
Last active Mar 17, 2022
Simple fluent interface in C#
View SimpleFluentInterface.cs
using System;
using System.Collections.Generic;
namespace SimpleFluentInterface
{
class Program
{
static void Main(string[] args)
{
string s = ListEnrollmentsSelectBuilder.Create()