Skip to content

Instantly share code, notes, and snippets.

View ethernetdan's full-sized avatar

Dan Gillespie ethernetdan

  • Indent
  • New York, NY
View GitHub Profile
@ethernetdan
ethernetdan / main.tf
Last active August 7, 2023 13:57
PolarSignals Agent Terraform
locals {
name = "parca-agent"
image = "ghcr.io/parca-dev/parca-agent@${var.image_digest}"
labels = merge(local.selector_labels, {
"app.kubernetes.io/version" : var.image_version
})
selector_labels = {
"app.kubernetes.io/component" : "observability"
"app.kubernetes.io/instance" : local.name
@ethernetdan
ethernetdan / 20-wifi-dock-toggle.sh
Last active August 31, 2021 15:22
Disables the WiFi device when the computer is docked and reenables it when it's undocked.
#!/bin/sh
# This script disables the WiFi device when the computer is docked and
# reenables it when it's undocked.
DOCK_DEVICE="enp0s31f6"
if [ "$1" != "$DOCK_DEVICE" ]; then
exit 0
fi
@ethernetdan
ethernetdan / door.py
Created October 17, 2018 21:16
Application to open door with WebSockets
#!/usr/bin/env python
import asyncio
from contextlib import contextmanager
import datetime
import RPi.GPIO as GPIO
import http
import random
import signal
import socket
@ethernetdan
ethernetdan / kubeconfig.tf
Created July 31, 2018 13:31
Terraform Kubeconfig
# Create Kubeconfig to access cluster.
output "kubeconfig" {
value = <<EOF
apiVersion: v1
kind: Config
clusters:
- name: huv-cluster
cluster:
api-version: v1
server: "https://${google_container_cluster.huv_cluster.endpoint}"
@ethernetdan
ethernetdan / google-cloud.repo
Last active June 6, 2018 18:40
Google Cloud RHEL Repo
[google-cloud-sdk]
name=Google Cloud SDK
baseurl=https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
#!/bin/bash
# Setup host
hostnamectl set-hostname foreman-1.lab.coreos.systems
# Configure repos
yum -y install yum-utils
yum-config-manager -y --enable rhel-7-server-optional-rpms
rpm --import https://www.centos.org/keys/RPM-GPG-KEY-CentOS-7
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
@ethernetdan
ethernetdan / build-kube-e2e.sh
Created September 21, 2017 17:06
Build Docker image of Kubernetes E2E tests
#!/bin/bash -x
set -euo pipefail
echo "Building conformance image..."
echo
APT_PACKAGES="rsync"
# build docker image of repository
docker build -t "${IMAGE_NAME}:${IMAGE_TAG}" - <<EOF
FROM golang:1.8
1. Create [][]*Variant the size of the number of scenarios.
1. Sort scenarios by number of variants
2. Descending from highest variant, iterate through each scenario (greedy)
a. Create []*Variant array (size of number of variants)
b. Iterate through each variant:
i. Iterate through machines, attempting to add variant constrained by:
a) scenarios are mutually exclusive
b) scenario exclusion list
ii. Create machine if no acceptable machine can be found.
iii. Add pointer to variant to []*Variant array for scenario
Flag --address has been deprecated, see --insecure-bind-address instead.
I0326 17:18:39.285185 5 feature_gate.go:189] feature gates: map[ExperimentalCriticalPodAnnotation:true]
I0326 17:18:39.461281 5 config.go:527] Will report 10.128.0.2 as public IP address.
I0326 17:18:39.469747 5 gce.go:291] Using GCE provider config {Global:{TokenURL: TokenBody: ProjectID: NetworkName: NodeTags:[kube-up-down-test-minion] NodeInstancePrefix:kube-up-down-test-minion Multizone:false}}
I0326 17:18:39.469783 5 gce.go:331] Using existing Token Source &oauth2.reuseTokenSource{new:google.computeSource{account:""}, mu:sync.Mutex{state:0, sema:0x0}, t:(*oauth2.Token)(nil)}
I0326 17:18:39.484635 5 server.go:148] Initalizing deserialization cache size based on 180MB limit
E0326 17:18:39.505123 5 reflector.go:199] k8s.io/kubernetes/plugin/pkg/admission/serviceaccount/admission.go:103: Failed to list *api.ServiceAccount: Get http://127.0.0.1:8080/api/v1/serviceaccounts?resourceVersion=0: dial tcp 12
function getRCPods() {
ARGS=$2
selector=$(kubectl get rc/$1 --template='{{range $k, $v := .spec.selector}}{{printf "%s=%s" $k $v}}{{end}}' $ARGS)
kubectl get pods --selector="$selector" --template='{{range .items}}{{printf "%s\n" .metadata.name}}{{end}}' $ARGS
}
alias pods=getRCPods