Skip to content

Instantly share code, notes, and snippets.


Lawrence Gripper lawrencegripper

View GitHub Profile
View gist:63010c3024030f2f76f4c0b20becfb55
set service dns forwarding options "no-resolv"
set service dns forwarding options "server="
delete service dns forwarding options "server="
sudo /etc/init.d/dnsmasq force-reload
lawrencegripper / 1-rule.rego
Last active Nov 18, 2021
OPA Rego Conftest and GitHub Actions
View 1-rule.rego
# Here is the basic Rego rule
package main
# deny creating duplicate resource in the same namespace
deny_duplicate_resources[{"msg": msg, "details": details}] {
i != j
currentFilePath = input[i].path
input[i].contents.kind == input[j].contents.kind
input[i] == input[j]
sql_con = sqlite3.connect('medbot.db')
temp_regex = re.compile(r'[0-9]{2}[.][0-9]')
async def track_temp(ctx: ChatContext) -> None:
## or not is_med_group(ctx):
if ctx.message.empty():
name = get_name(ctx) # No included, just a regex to pull out the childs name from the msg
temp =
lawrencegripper / dsc_config.ps1
Last active Mar 17, 2021
Azure Windows Container in VNET Powershell DSC
View dsc_config.ps1
Uses PowerShell DSC to configure the machine to run the container
Docker Image to run complete with tag
Command to run in the docker image
.PARAMETER RegistryUrl
Azure container registry url
lawrencegripper / .Dockerfile
Last active Mar 15, 2021
Azure Devops Agent inside a DevContainer
View .Dockerfile
# Very basic devcontainer, see line 15 copying in build agent start script
# To make it easier for build and release pipelines to run apt-get,
# configure apt to not require confirmation (assume the -y argument by default)
ENV DEBIAN_FRONTEND=noninteractive
RUN echo "APT::Get::Assume-Yes \"true\";" > /etc/apt/apt.conf.d/90assumeyes
# Install system tools
lawrencegripper /
Last active Mar 9, 2021
Funcs Keys listing
terraform {
required_providers {
shell = {
source = "scottwinkler/shell"
version = "1.7.7"
resource "azurerm_function_app" "functions" {
lawrencegripper /
Created Feb 10, 2021
Enable Diagnostic logs on an Azure storage account with terraform
resource "random_string" "random" {
length = 5
special = false
upper = false
number = false
resource "azurerm_log_analytics_workspace" "core" {
name = "corelaw${random_string.random.result}"
location = "westeurope"
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 = """