Skip to content

Instantly share code, notes, and snippets.

View iainsproat's full-sized avatar
🏠
Working from home

Iain Sproat iainsproat

🏠
Working from home
View GitHub Profile
@iainsproat
iainsproat / mocha.spec.ts
Last active March 3, 2023 20:34
Understanding mocha's nested before and after hooks
'use strict';
describe('mocha before and after hooks', function () {
before(() => console.log('*** top-level before()'))
beforeEach(() => console.log('*** top-level beforeEach()'))
after(() => console.log('*** top-level after()'))
afterEach(() => console.log('*** top-level afterEach()'))
describe('nesting', function () {
before(() => console.log('*** nested before()'))
beforeEach(() => console.log('*** nested beforeEach()'))
@iainsproat
iainsproat / kustomization.yaml
Created December 15, 2022 15:42
Kustomize delete a single key from a map. The key includes a backslash / character
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- namespace.yaml
patchesJson6902:
# deletes a single label from a kubernetes resource.
# the label includes a slash '/' character
# we replace the '/' character with '~1'.
- target:
version: v1
@iainsproat
iainsproat / app.js
Created September 2, 2022 10:50
reach an http endpoint in a node container without curl
require('http').get({host: '<REPLACE_ME>.<REPLACE_ME>.svc.cluster.local.', path:'/graphql', port:3000}, (resp) => { console.log(resp.statusCode); }).on("error", (err) => { console.log("error: " + err.message);});
@iainsproat
iainsproat / dotnet_info.md
Created January 15, 2022 16:24
Hypar sign-in bug
dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.1.416
 Commit:    8d3765c609

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  20.04
 OS Platform: Linux
@iainsproat
iainsproat / README.md
Created April 24, 2018 22:56
Instructions to create a SSTP VPN in a docker container running on a GCP VM

Creating an SSTP server on GCP


Local command line

  1. ssh-keygen -t rsa -b 4096 -C "YOUR EMAIL ADDRESS"
  2. write ssh key to ~/.ssh/gcp-sstp-box
  3. also save the key to an encrypted location, e.g. Lastpass
  4. gcloud config set project YOURGCPPROJECTNAME
  5. gcloud config compute/region set europe-west1 (or wherever you wish to host it)
  6. gcloud config compute/zone set europe-west1-b (or wherever)
---
apiVersion: v1
kind: Namespace
metadata:
name: sonobuoy
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:

Daily Pre-flight

  • pushd ~/workspace/kubo-home && git fetch && git pull -r && ~/workspace/kubo-home/setup && popd
  • git pull -r all the repositories
  • set-story \
  • git duet
  • fly -t kubo login
@iainsproat
iainsproat / Instructions.md
Last active December 8, 2017 10:01
Clean up Bosh Director locks (with bbl)
  1. bbl director-ssh-key > director-ssh-key.pem
  2. Open director-ssh-key.pem and copy contents into buffer
  3. bbl ssh-key > jumpbox-ssh-key.pem
  4. chmod 600 jumpbox-ssh-key.pem
  5. ssh -i jumpbox-ssh-key.pem -t jumpbox@$(bbl jumpbox-address) bash
  6. You should now be on the jumpbox
  7. vi director-ssh-key.pem
  8. paste the director key contents (which you copied earlier) into the file and save
  9. chmod 600 director-ssh-key.pem
  10. ssh -vvv 10.0.0.6 -i director-ssh-key.pem #Replace 10.0.0.6 with the internal IP address of your bosh director
@iainsproat
iainsproat / gist:8378720
Created January 12, 2014 00:11
Git: stash work in progress and move it to a new branch
  • make changes
  • git stash save
  • git checkout -b xxx
  • git stash pop

where xxx is the new branch name

@iainsproat
iainsproat / couchapp_windows.md
Created March 15, 2012 20:11
Using couchapp on node in Windows

Get node.couchapp:

git clone https://github.com/mikeal/node.couchapp.js.git
cd node.couchapp.js

install globally:

npm install -g

install locally, where test is the directory name which will contain your app: