Skip to content

Instantly share code, notes, and snippets.

💭
Rust

Matt Butcher technosophos

💭
Rust
View GitHub Profile
@technosophos
technosophos / ftc-vscode-linux.md
Last active Dec 12, 2019
Installing a VS Code-based development environment for FTC on Linux
View ftc-vscode-linux.md

Installing a Development Environment for FTC on Linux with VS Code

This documents my attempts to get the First Tech Challenge (FTC) base code running on Linux using VS Code instead of Android Studio. Android Studio is a little too slow and hefty for my liking.

Prerequisites

I am running Ubuntu 18.04. Package names and installation methods will vary on other platforms.

Install JDK

@technosophos
technosophos / Dockerfile
Created Sep 27, 2019
Rust Dockerfile hacks for faster builds
View Dockerfile
FROM rust:1.37 AS builder
WORKDIR /usr/src/buck
COPY Cargo.toml .
COPY Cargo.lock .
# Layer hack: Build an empty program to compile dependencies and place on their own layer.
# This cuts down build time
RUN mkdir -p ./src/ && \
echo 'fn main() {}' > ./src/main.rs && \
@technosophos
technosophos / firefox-open-tab.applescript
Last active Dec 21, 2019
Open a Tab in Firefox on macOS with AppleScript
View firefox-open-tab.applescript
# To run:
# osascript firefox-open-tab.applescript http://technosophos.com
#
# References:
# https://support.mozilla.org/en-US/questions/1130718
# https://stackoverflow.com/questions/3645763/how-do-i-instruct-applescript-to-open-a-new-firefox-window-with-a-link
on firefoxRunning()
tell application "System Events" to (name of processes) contains "firefox"
end firefoxRunning
@technosophos
technosophos / simple-event.sh
Created Dec 19, 2017
Simple Kubernetes Brigade event generator.
View simple-event.sh
#!/usr/bin/env bash
set -euo pipefail
# The Kubernetes namespace in which Brigade is running.
namespace="default"
event_provider="simple-event"
event_type="my_event"
# This is github.com/deis/empty-testbed
@technosophos
technosophos / ulid.go
Created Nov 16, 2017
Generate a ULID on the commandline
View ulid.go
package main
import (
"fmt"
"math/rand"
"strings"
"time"
"github.com/oklog/ulid"
)
@technosophos
technosophos / post-receive.sh
Created Nov 10, 2017
Git post-receive hook that creates Brigade event
View post-receive.sh
#!/bin/bash
while read oldrev newrev refname
do
short_sha=${newrev:0:8}
ulid=$(/usr/local/bin/ulid)
build_id="acid-worker-${ulid}-${short_sha}"
e_build_id=$(echo "$build_id" | base64 -w 0)
e_project_id=$(echo "$ACID_PROJECT_ID" | base64 -w 0)
e_acidjs=$(git show ${newrev}:acid.js | base64 -w 0)
@technosophos
technosophos / helm-ui-guidelines.md
Last active Dec 1, 2016
Helm User Interface Design Guidelines
View helm-ui-guidelines.md

Helm User Interface Guidelines

DRAFT DRAFT DRAFT

This document specifies how to write build a consistent and useable command line client (CLI) that follows the conventions already established in the Helm project.

The Goal Is Obvious

The goal of a good user interface is to make it obvious to the user. This is achieved in three ways:

@technosophos
technosophos / chart-extractor.sh
Created Nov 29, 2016
Query a cluster to populate a Helm chart
View chart-extractor.sh
#!/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
@technosophos
technosophos / config-mpb.sh
Created Dec 15, 2015
Setting up a Kube config file for vagrant
View config-mpb.sh
# 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 / 3-reasons-not-to-check-in.md
Last active Dec 8, 2015
Three Reasons Not to Check Vendor Into VCS
View 3-reasons-not-to-check-in.md

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

You can’t perform that action at this time.