Skip to content

Instantly share code, notes, and snippets.

View technosophos's full-sized avatar

Matt Butcher technosophos

View GitHub Profile
@technosophos
technosophos / tag_category_list.rb
Created March 12, 2014 14:38
Jekyll Category Listing Plugin
module Jekyll
class CategoryListTag < Liquid::Tag
# safe true
def initialize(tag_name, text, tokens)
super
end
def render(context)
html = ""
@technosophos
technosophos / colorizer.go
Created March 19, 2014 03:18
This broke the io.Multiwriter because I had Colorizer.Write() returning the number of bytes it wrote, not the number of bytes passed into it.
package main
import (
"github.com/Masterminds/cookoo"
"github.com/Masterminds/cookoo/io"
"os"
)
func main() {
_, _, cxt := cookoo.Cookoo()
### Keybase proof
I hereby claim:
* I am technosophos on github.
* I am technosophos (https://keybase.io/technosophos) on keybase.
* I have a public key whose fingerprint is ABA2 5295 98F6 626C 420D 335B 62F4 9E74 7D91 1B60
To claim this, I am signing this object:
@technosophos
technosophos / gist:1b7c68ea8b9330c7e45f
Created June 7, 2014 04:28
Apple Script to Raise and Focus the First MacVIM Window
tell application "MacVim"
activate
set visible of first window to true
end tell
@technosophos
technosophos / gist:32b1815a4ff26cf5bf48
Created September 23, 2014 03:55
Example of Cookoo subcommand.
package main
import (
"github.com/Masterminds/cookoo"
"github.com/Masterminds/cookoo/cli"
"github.com/Masterminds/cookoo/fmt"
"flag"
)
@technosophos
technosophos / gist:0e743e51ab94c8f814e9
Created December 20, 2014 17:26
BonsaiJS Christmas Tree
treegreen = color('green');
new Text('Merry Christmas').addTo(stage).attr({
fontFamily: 'Arial, sans-serif',
fontSize: '48',
textFillColor: 'red',
textStrokeColor: 'green',
textStrokeWidth: 2,
x: -400
}).animate('2s', {x:150, y:50}, {
easing: "bounceIn"
@technosophos
technosophos / glide-init-state.txt
Last active July 18, 2018 20:23
Glide init process
@startuml glide-init-state.png
start
:glide init;
:Scan source;
:List deps;
while (read list of deps) is (found dep)
:Find dep;
if (Found) then (yes)
:Add to list;
elseif (Missing dep) then (yes)
@technosophos
technosophos / 3-reasons-not-to-check-in.md
Last active December 8, 2015 04:16
Three Reasons Not to Check Vendor Into VCS

Losing the VCS

When you check vendored code into VCS, that code is no longer tracked in its own git repo (since you must remove the .git directory to check it in, or else treat it as a submodule). We thus lose all of the assistance the VCS was giving us. This leads to three problems:

  1. Updates require full checkouts every single time. Any time you need to update a dependency, you have to check out that dependency, along with all of those that it requires. Then you must do all the version management, only to remove most of what you checked out at the end. The unfortunate result is that for many teams, they never update vendored packages, and security and stability issues go unnoticed. For us, one of our core dependencies is Kubernetes. So updating that one dependency requires checking out around 200 additional packages. Thus, updating is a non-trivial (quite time-consuming) task.

  2. Working with dependent packages is harder. Say I have two packages: A and B. And A depends on B. Working on problems b

@technosophos
technosophos / config-mpb.sh
Created December 15, 2015 21:20
Setting up a Kube config file for vagrant
# KUBE_CONFIG_FILE=config-mpb.sh
EXTRA_DOCKER_OPTS="--insecure-registry 10.0.0.0/8 --insecure-registry 192.168.0.0/16"
# Flag to tell the kubelet to enable CFS quota support
ENABLE_CPU_CFS_QUOTA="${KUBE_ENABLE_CPU_CFS_QUOTA:-true}"
# Optional: Install cluster DNS.
ENABLE_CLUSTER_DNS="${KUBE_ENABLE_CLUSTER_DNS:-true}"
DNS_SERVER_IP="10.247.0.10"
@technosophos
technosophos / chart-extractor.sh
Created November 29, 2016 20:11
Query a cluster to populate a Helm chart
#!/bin/bash
kinds="cs,cm,ds,deploy,ev,ep,hpa,ing,jobs,limits,po,pv,pvc,quota,rs,rc,secrets,sa,svc"
tpl="{{range .items}}{{.metadata.name}} {{end}}"
if [[ "" == $1 ]]; then
echo name of app is required
exit 1
fi