Skip to content

Instantly share code, notes, and snippets.

@snay2
snay2 / eks-cluster-with-nth-qp.md
Last active August 23, 2022 21:40
How to spin up an EKS cluster and install NTH

These instructions were originally for my testing of aws/aws-node-termination-handler#669, but I'm putting them here for general reference in the future.

Creating an EKS cluster and installing NTH into it

  1. Create an EKS cluster with a managed node group using eksctl
eksctl create cluster --name nthCluster --region us-east-2
@cliss
cliss / DebugTimer.cs
Created February 2, 2015 19:07
C# Debug Timer
public class DebugTimer : IDisposable
{
private readonly System.Diagnostics.Stopwatch _watch;
private readonly string _blockName;
/// <summary>
/// Creates a timer.
/// </summary>
/// <param name="blockName">Name of the block that's being timed</param>
public DebugTimer(string blockName)
@jarsen
jarsen / enumcrap.swift
Created August 15, 2014 17:27
Making an enum out of your own classes. Not sure if this is a great idea, but it works and is cool.
class Name : StringLiteralConvertible, Equatable {
var firstName: String
var lastName: String
required init(firstName: String, lastName: String) {
self.firstName = firstName
self.lastName = lastName
}
class func convertFromStringLiteral(value: StringLiteralType) -> Self {
@JessieAMorris
JessieAMorris / gist:02d992f9fd363183c440
Created August 6, 2014 21:28
Highligh mixed tabs & spaces
highlight MixedIndent ctermbg = red guibg = #FF0000
" Executes all auto commands
function! <SID>SetupAutoCommands()
" Auto commands group
augroup better_whitespace
autocmd!
" Highlight extraneous whitespace at the end of lines, but not the
" current line
syn clear MixedIndent | syn match MixedIndent excludenl /\v^\s*( \t|\t )\s*/
@jacobvosmaer
jacobvosmaer / gist:3187346
Created July 27, 2012 10:35
Open all files with git merge conflicts in Vim

Open all files with git merge conflicts in MacVim

git diff --name-only | uniq | xargs mvim

When git encounters a merge conflict, e.g. during a rebase, it drops you back into the shell with a dirty working directory. I like this one-liner for opening all files with a merge conflict in MacVim.

Once you're in Vim, you can then switch between the files with :n and :prev, or another favourite: :w | n (save current file and open the next command line-supplied file).

UPDATE: see below for a version that works with real terminal commands.

@rsbohn
rsbohn / stringdiff.py
Created October 21, 2011 20:24
show differences in strings -- uses SequenceMatcher
from difflib import SequenceMatcher
def diff(actual, expected):
if actual != expected:
raise AssertionError(combine(actual, expected))
def combine(a,b):
"""Form one string showing the differences between a and b."""
sm = SequenceMatcher(None, a,b)
out = []
@edorcutt
edorcutt / PeerIndex-Module-Test.krl
Created May 19, 2011 04:56
Test & Demo for Kynetx PeerIndex API Module
ruleset a169x320 {
meta {
name "PeerIndex-Module-Test"
description <<
Test PeerIndex API Module
http://exampley.com/?appid=a169x320
>>
author "Ed Orcutt, LOBOSLLC"
logging on
@KyleAMathews
KyleAMathews / onchange.sh
Created May 12, 2011 01:00
Run an arbitrary command on any changes to an arbitrary file
#!/bin/bash
# Usage: onchange.sh COMMAND FILE
# On Ubuntu/Debian, you'll need to install the inotify-tools package.
COMMAND=$1
FILE=$2
# Run once initially.
$command $file
@rsbohn
rsbohn / a421x45.krl
Created April 7, 2011 18:09
Trying some recursive actions
ruleset a421x45 {
meta {
name "Try Recursion"
description <<
Try some recursion
>>
author "Randall Bohn"
logging on
}
ruleset a8x72 {
  meta {
    name "NeoSale"
    description <<
      Selling the Neo Freerunner
    >>
    author "Sam Curren"
    logging on
    key twitter {
      "consumer_key" : "<redacted>",