Skip to content

Instantly share code, notes, and snippets.

View technosophos's full-sized avatar

Matt Butcher technosophos

View GitHub Profile
@technosophos
technosophos / spin.service
Created July 30, 2024 20:33
Ubuntu service for running Spin as a daemon
# Put this file in: /etc/systemd/system/spin.service
# then run
# systemctl enable spin
# systemctl daemon-reload
# systemctl start spin
[Unit]
Description = Spin application
After = network.target
[Service]
@technosophos
technosophos / ftc-vscode-linux.md
Last active October 13, 2020 00:01
Installing a VS Code-based development environment for FTC on Linux

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 September 27, 2019 14:54
Rust Dockerfile hacks for faster builds
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 May 22, 2023 08:06
Open a Tab in Firefox on macOS with 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 December 19, 2017 21:29
Simple Kubernetes Brigade event generator.
#!/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 November 16, 2017 21:32
Generate a ULID on the commandline
package main
import (
"fmt"
"math/rand"
"strings"
"time"
"github.com/oklog/ulid"
)
@technosophos
technosophos / post-receive.sh
Created November 10, 2017 21:39
Git post-receive hook that creates Brigade event
#!/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 December 1, 2016 23:51
Helm User Interface Design Guidelines

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 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
@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"