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
@snay2
snay2 / k8sversions.sh
Created May 13, 2022 14:40
Fetch the SHA-256 hashes for specific versions of `kind` images
#!/bin/bash
set -euo pipefail
# Grab the latest versions of the k8s versions you want to support, and put them in this array
# https://hub.docker.com/r/kindest/node/tags
versions=("1.19.16" "1.20.15" "1.21.12" "1.22.9" "1.23.6" "1.24.0")
# Extract the SHA-256 hash for each version
for i in "${!versions[@]}"; do
version=${versions[$i]}
/// <summary>
/// Iterate over each IEnumerable, returning items in parallel from first and second.
/// When one collection runs out of items, return default(T) instead until the other collection runs out as well.
/// For example, if first contains {1, 2, 3, 4} and second contains {5, 6}, operation will be called with the following values:
/// (1, 5)
/// (2, 6)
/// (3, 0)
/// (4, 0)
/// </summary>
/// <typeparam name="T">Usually string, but can be any type</typeparam>
@snay2
snay2 / alt-twitter.md
Last active August 29, 2015 14:06
Alternative Twitter client to circumvent filtering

Alternative Twitter client to circumvent filtering

If this (http://gigaom.com/2014/09/04/twitter-cfo-says-a-facebook-style-filtered-feed-is-coming-whether-you-like-it-or-not/) comes true, it should still be possible to get an unfiltered tweet stream as long as Twitter doesn’t also tamper with public profiles when the viewer is not logged in. If those still display all of a person’s raw tweets, we can still get the current idea of a timeline.

Basic process

  1. Keep a list of all the people you follow
  2. Pull down each person’s public profile (cache them, if desired)
  3. Filter out tweets starting with an @-mention of anyone you don’t follow
  4. Stitch them all together in chronological order
@snay2
snay2 / nextapproval.py
Created August 13, 2012 22:33
cs462server
import boto
from boto.sqs.message import RawMessage
import ConfigParser
import json
import urllib, urllib2
#read config
config = ConfigParser.ConfigParser()
config.read(["/etc/boto.cfg"])
@snay2
snay2 / a163x154.js
Created February 27, 2012 18:48
Driver registration helper for CS 462 Lab 3
ruleset a163x154 {
meta {
name "Driver registration helper"
description <<
Collect driver personal information and information about the flower shops
for whom the driver delivers. Also provide a UI for this data that can be used
by a "driver" once he installs it to his Kynetx account.
Used for CS 462 Lab 3 in Winter 2012.
>>
@snay2
snay2 / gist:1925904
Created February 27, 2012 18:06
Simple example for using arrays in an entity variable in KRL
ruleset a163x156 {
meta {
name "Arrays"
description <<
Some experiments using arrays in KRL
>>
author "Steve Nay"
logging on
}
@snay2
snay2 / gist:1911296
Created February 25, 2012 22:50
Simple example for using maps in KRL
ruleset a163x153 {
meta {
name "Maps"
description <<
Simple example of creating and using maps
>>
author "Steve Nay"
logging off
}
@snay2
snay2 / a163x149.js
Last active January 17, 2018 14:03
Steve's ruleset
ruleset a163x149 {
meta {
name "On-call TA: Steve"
description <<
Handles the functions for Steve office hours
>>
author "Steve Nay"
logging off
use module a8x114 version "38" alias officehours with url = "{redacted}"
use module a8x115 alias twilio
@snay2
snay2 / sign.sh
Created October 21, 2011 17:15
Bash shell script to automate PGP key signing
while [ 1 ]; do
echo ">> Enter an email address:"
read EMAIL
gpg --keyserver pgp.mit.edu --search-keys $EMAIL
FINGERPRINT=`gpg --fingerprint $EMAIL`
[[ $FINGERPRINT =~ 2048[DR]/([0-9A-F]{8}) ]];
KEY_ID=${BASH_REMATCH[1]}
gpg --sign-key $EMAIL
echo ">> Going to sign key $KEY_ID"
gpg --keyserver pgp.mit.edu --send-key $KEY_ID