Skip to content

Instantly share code, notes, and snippets.

View switchspan's full-sized avatar

Ken Taylor switchspan

  • Viking Sasquatch
  • Chesapeake, VA
View GitHub Profile
@switchspan
switchspan / list-all-repos.sh
Created August 25, 2023 18:06 — forked from nikhita/list-all-repos.sh
Generate a list of all repos in a GitHub to paste into Excel
#!/usr/bin/env bash
# This script generates a list of repos in a GitHub org.
# The list can be pasted directly to a Microsoft Excel sheet.
# You will need to use your GitHub username in the username field.
# Update the page=N number to get the complete list of repos.
curl --silent --user "username" "https://api.github.com/orgs/vmware/repos?page=1&per_page=100" | npx jq '.[].html_url' | while read repo
do
echo "=Hyperlink("$repo","$repo")"
done

kubernetes shortcuts & cheatsheet

Use a DaemonSet for Pods that need to run one per machine, because they provide a machine-specific system service.

Learning k8s basics

For example, to mark a node unschedulable, run this command:

@switchspan
switchspan / IE10_pie_notes.md
Created August 18, 2013 15:36
NOTES: IE10 css border-image hack

IE 10 CSS Border Hack

border-image

Option 1 (Fall back)

From Microsoft Blog and html5please:
Internet Explorer 10 doesn’t include support for CSS border-image. To preserve the layout of your page, a best practice is to specify a solid border-style fallback so border widths, padding, and margin are preserved. (If IE doesn’t find a supported border type, it will discard those values.) For example:

Before:

@switchspan
switchspan / docker-cheatsheet.sh
Created November 1, 2021 18:04
A personal cheat sheet for running local Node project in a Docker container
# See list of docker virtual machines on the local box
$ docker-machine ls
NAME ACTIVE URL STATE URL SWARM DOCKER ERRORS
default * virtualbox Running tcp://192.168.99.100:2376 v1.9.1
# Note the host URL 192.168.99.100 - it will be used later!
# Build an image from current folder under given image name
$ docker build -t gleb/demo-app .
@switchspan
switchspan / states.csv
Created December 9, 2021 20:13
US States and Abbreviations
State Abbreviation
Alabama AL
Alaska AK
Arizona AZ
Arkansas AR
California CA
Colorado CO
Connecticut CT
Delaware DE
District of Columbia DC
@switchspan
switchspan / git-flow-cheatsheet.md
Created December 9, 2021 20:11
Git Flow Cheatsheet

Git-Flow

Initialize a Repository for git-flow

git flow init -d

(Omit -d if you want to select values other than the defaults.)

Features

@switchspan
switchspan / gcloud-cli-commands.md
Created December 9, 2021 19:32
Gcloud CLI Commands

GCloud CLI commands

Credentials

List all of the current logins

gcloud auth list

Change the active account

@switchspan
switchspan / gist:5536508
Created May 7, 2013 21:58
Partition function - James Edward Gray II's ruby implementation
# The partition (combinatoric partition theory) function for a given number
def partition(largest, rest = Array.new, &block)
block.call([largest] + rest)
(rest.first || 1).upto(largest / 2) do |i|
partition(largest - i, [i] + rest, &block)
end
end
# call the partition function with "5" as a test
partition(5) { |nums| p nums if nums[0] != 5 }
@switchspan
switchspan / reconnect.js
Created November 13, 2018 17:55 — forked from carlhoerberg/reconnect.js
How to build reconnect logic for amqplib
var amqp = require('amqplib/callback_api');
// if the connection is closed or fails to be established at all, we will reconnect
var amqpConn = null;
function start() {
amqp.connect(process.env.CLOUDAMQP_URL + "?heartbeat=60", function(err, conn) {
if (err) {
console.error("[AMQP]", err.message);
return setTimeout(start, 1000);
}