Skip to content

Instantly share code, notes, and snippets.


Lawrence Gripper lawrencegripper

View GitHub Profile
lawrencegripper / run.ps1
Created Nov 12, 2020
Parallel Pester Tests
View run.ps1
Install-Module -Name Pester -RequiredVersion 4.6.0 -force
$testFilePath = "./tests"
# Start a jobs running each of the test files
$testFiles = Get-ChildItem $testFilePath
$resultFileNumber = 0
foreach ($testFile in $testFiles)
$testName = Split-Path $testFile -leaf
lawrencegripper / buildyamlsnippet.yaml
Last active Nov 22, 2020
Trigger Job on file changes in Azure Devops
View buildyamlsnippet.yaml
- job: ciml
displayName: "Machine Learning CI"
vmImage: 'Ubuntu 20.04'
- task: PowerShell@2
displayName: 'Run CI Task from make.ps1 in Devcontainer'
targetType: 'inline'
script: 'Install-Module -Name PSake -Force && Invoke-psake ./make.ps1 ciml'
View starship.toml
# Which is equivalent to
format = """
lawrencegripper /
Created Jul 20, 2020
Azure VPN Gateway OpenVPN
resource "random_string" "random" {
length = 8
special = false
upper = false
number = false
resource "azurerm_public_ip" "vpn_ip" {
name = "vpn-ip"
lawrencegripper /
Last active May 11, 2020
Cleanup in Bash script
set -e
function cleanup()
echo -e "----> Trap caught! Do cleanup here"
trap cleanup EXIT
# imagine some stuff happens here
lawrencegripper /
Created Apr 12, 2020
Mute and unmute mic Ubuntu
pacmd list-sources | \
grep -oP 'index: \d+' | \
awk '{ print $2 }' | \
xargs -I{} pactl set-source-mute {} toggle
MUTED=$(pacmd list-sources | grep "muted: no" | wc -l)
if (( $MUTED > 0 )); then
lawrencegripper /
Last active Feb 24, 2020
Generate docker images of specific size
set -e
set -x
# Push 200mb image
dd if=/dev/urandom of=./file.bin bs=1M count=200
docker build -t lawrencegripper/big:200mb .
docker push lawrencegripper/big:200mb
rm ./file.bin
View 1_devcontainer.json
// For format details, see or the definition README at
"name": "Go",
"dockerFile": "Dockerfile",
"runArgs": [
// Uncomment the next line to use a non-root user. On Linux, this will prevent
// new files getting created as root, but you may need to update the USER_UID
// and USER_GID in .devcontainer/Dockerfile to match your user if not 1000.
// "-u", "vscode",
View Makefile
KIND_CLUSTER_NAME ?= "opa-rego-teammapping"
WAIT_FOR_KIND_READY = '{range .items[*]}{}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'
WAIT_FOR_OPA_READY = '{range .items[*]}{}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'
.PHONY: all build test integration
all: test kind-integration
build: test
View test.rego
# patch we expect to be generated
expectedPatch = {
"op": "add",
"path": "spec/nodeSelector",
"value": {
"agentpool": "pool1"
# Helper to check patch is set
You can’t perform that action at this time.