Skip to content

Instantly share code, notes, and snippets.

@damoodamoo
damoodamoo / Makefile-local-debug
Created January 14, 2020 14:53
Makefile for local webhook debugging
copy-running-certs:
kubectl get secret webhook-server-cert -n psc-system -o json | sed 's/ca.crt/cacrt/; s/tls.crt/tlscrt/; s/tls.key/tlskey/' > secrets.json
mkdir -p ./.running-keys
jq -r .data.cacrt < secrets.json | base64 --decode > ./.running-keys/ca.crt
jq -r .data.tlscrt < secrets.json | base64 --decode > ./.running-keys/tls.crt
jq -r .data.tlskey < secrets.json | base64 --decode > ./.running-keys/tls.key
mkdir -p /tmp/k8s-webhook-server/serving-certs
cp ./.running-keys/* /tmp/k8s-webhook-server/serving-certs/
rm secrets.json
@fnky
fnky / ANSI.md
Last active May 5, 2024 19:31
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@bradwilson
bradwilson / ConvertTo-MP3.ps1
Last active March 9, 2020 18:33
Converts FLAC/MP3 input, resamples down to ReplayGain levels, and converts to MP3. Requires on the path: flac, metaflac, ffmpeg, mogrify
param(
[string][Parameter(Mandatory=$true)]$InputFile,
[string][Parameter(Mandatory=$true)]$OutputFile,
[int]$SampleRate = 44100,
[string]$BitRate = "160k"
)
$ErrorActionPreference = "Stop"
$InputFile = [System.IO.Path]::Combine((Get-Location), $InputFile)
@shanselman
shanselman / Dockerfile
Last active November 10, 2023 19:17
Smarter ASP.NET Core Docker File
FROM microsoft/dotnet:2.0-sdk as builder
RUN mkdir -p /root/src/app/aspnetcoreapp
WORKDIR /root/src/app/aspnetcoreapp
#copy just the project file over
# this prevents additional extraneous restores
# and allows us to resuse the intermediate layer
# This only happens again if we change the csproj.
# This means WAY faster builds!
@RichardBronosky
RichardBronosky / README.MD
Last active April 26, 2024 08:21
cb - A leak-proof tee to the clipboard - Unify the copy and paste commands into one intelligent chainable command.

cb

A leak-proof tee to the clipboard

This script is modeled after tee (see [man tee][2]) and works on Linux, macOS, Cygwin, WSL/WSL2

It's like your normal copy and paste commands, but unified and able to sense when you want it to be chainable.

This project started as an answer to the StackOverflow question: [How can I copy the output of a command directly into my clipboard?][3]

@ahelland
ahelland / FunctionBotRun.csx
Created April 26, 2016 18:36
An Azure Function implementing the Microsoft Bot Framework to return random quotes
#r "Newtonsoft.Json"
#r "Microsoft.Rest.ClientRuntime.dll"
#r "Microsoft.Bot.Connector.Utilities.dll"
#r "Microsoft.Bot.Connector.dll"
using System.Net;
using Microsoft.Bot.Connector;
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log)
{
log.Verbose($"C# HTTP trigger function processed a request. RequestUri={req.RequestUri}");
@GabrieleCastellani
GabrieleCastellani / Move-AzureVMInNewCS.ps1
Last active November 8, 2017 14:43
Moving an Azure Virtual Machines in a different Cloud Service with Poweshell [interactive]
#Open Azure Powershell
#Import your Azure Subscription
Add-AzureAccount
#Get the list of Azure Subscriptions
Get-AzureSubscription
#Select the azure Subscription of the Virtual Machines
Select-AzureSubscription "[SubscriptionName]"