Skip to content

Instantly share code, notes, and snippets.

@brianpursley
brianpursley / test-output.txt
Created May 12, 2020 16:01
make test-integration WHAT=./test/integration/scheduler GOFLAGS="-v" KUBE_TEST_ARGS='-run ^TestNominatedNodeCleanUp$$$$'
+++ [0512 12:00:54] Checking etcd is on PATH
/usr/bin/etcd
+++ [0512 12:00:54] Starting etcd instance
/home/bpursley/go/src/k8s.io/kubernetes/third_party/etcd:/home/bpursley/gems/bin:/home/bpursley/.nvm/versions/node/v12.14.0/bin:/usr/lib/jvm/jdk-13.0.1/bin:/home/bpursley/.local/bin:/home/bpursley/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/bpursley/.dotnet/tools:/usr/share/rvm/bin:/home/bpursley/bin:/usr/local/go/bin:/home/bpursley/go/bin:/home/bpursley/.krew/bin:/home/bpursley/kubectl-plugins
etcd --advertise-client-urls http://127.0.0.1:2379 --data-dir /tmp/tmp.hFmwtBV9wu --listen-client-urls http://127.0.0.1:2379 --debug > "/dev/null" 2>/dev/null
Waiting for etcd to come up.
+++ [0512 12:00:55] On try 1, etcd: : {"health":"true"}
{"header":{"cluster_id":"14841639068965178418","member_id":"10276657743932975437","revision":"2","raft_term":"2"}}+++ [0512 12:00:55] Running integration test cases
+++ [0512 12:00:58] Running tests without code cov
@brianpursley
brianpursley / git-commands.sh
Last active August 26, 2021 12:27
Git commands
# Function to squash last N commits
squash() { git reset --soft HEAD~$1; git commit --edit -m"$(git log --format=%B --reverse HEAD..HEAD@{1})"; }
# Merge changes from upstream into current branch
git fetch upstream && git merge upstream/master
@brianpursley
brianpursley / install-metrics-server.sh
Last active January 23, 2020 22:48
Download and install metrics-server into a kind kubernetes cluster
wget -O /tmp/metrics-server-master.zip https://github.com/kubernetes-sigs/metrics-server/archive/master.zip
unzip -u /tmp/metrics-server-master.zip -d /tmp
rm /tmp/metrics-server-master.zip
kubectl apply -f /tmp/metrics-server-master/deploy/1.8+/
rm -rf /tmp/metrics-server-master
kubectl patch deploy metrics-server -n kube-system --type json --patch '[{"op":"add","path":"/spec/template/spec/containers/0/args/-","value":"--kubelet-insecure-tls"},{"op":"add","path":"/spec/template/spec/containers/0/args/-","value":"--kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname"}]'
@brianpursley
brianpursley / get-nodeport-url.sh
Last active February 6, 2020 02:06
Script to get address of kubernetes nodeport service when running locally using (using kind for example)
#!/bin/sh
nodeport=$(kubectl get services -o jsonpath="{..nodePort}") && kubectl get node -o jsonpath="{..addresses[0].address}" | xargs -n1 printf -- "http://%s:$nodeport\n"
@brianpursley
brianpursley / docker-compose.yml
Created August 30, 2018 02:18
Docker compose config for running Elastic Search and Kibana locally in docker containers
version: '3'
services:
elasticsearch:
container_name: elasticsearch
image: docker.elastic.co/elasticsearch/elasticsearch:6.4.0
volumes:
- esdata:/usr/share/elasticsearch/data
ports:
@brianpursley
brianpursley / backup.sh
Created April 10, 2017 19:54
Script to backup a folder (/share) and capture incremental changes since the last backup in a timestamp-named folder
#!/bin/bash
ts=`date +%Y%m%d_%H%M%S`
rsync -rtm --compare-dest=/mnt/usb1/backups/snapshot --modify-window=2 /share /mnt/usb1/backups/$ts
find /mnt/usb1/backups/$ts -type d -empty -delete
rsync -rt --delete --modify-window=2 /share /mnt/usb1/backups/snapshot
@brianpursley
brianpursley / lambda.js
Last active March 11, 2017 02:53
AWS Lambda function that publishes to SNS
var AWS = require("aws-sdk");
exports.handler = (event, context, callback) => {
var sns = new AWS.SNS();
sns.publish({
Message: 'YOUR MESSAGE HERE',
Subject: 'YOUR SUBJECT HERE',
TopicArn: 'YOUR SNS TOPIC ARN HERE'
}, function() {
callback(null, {
@brianpursley
brianpursley / Example.pubxml
Created March 9, 2017 15:08
An example Visual Studio pubxml file to zip the output when publishing an ASP.NET web application to file system
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<publishUrl>C:\Publish\SimpleExample</publishUrl>
@brianpursley
brianpursley / iBeacon-Windows10-C#-Program.cs
Created February 2, 2017 13:50
iBeacon Windows 10 Console Application using C#
using System;
using System.Linq;
using Windows.Devices.Bluetooth.Advertisement;
using Windows.Storage.Streams;
namespace BeaconExample
{
class Program
{
private class BeaconData
@brianpursley
brianpursley / example-scrape-target.html
Created November 20, 2015 15:35
Example HTML file for scraping
<html>
<head>
<title>Example Web Page</title>
<style>
.container {
display: table;
}
.row {
display: table-row;
}