Skip to content

Instantly share code, notes, and snippets.

View full-sized avatar

Lawrence Gripper lawrencegripper

View GitHub Profile
@lawrencegripper
lawrencegripper / dotfiles-atuin-config
Last active June 28, 2023 09:00
Atuin Codespace Sync
View dotfiles-atuin-config
db_path = "~/.config/atuin/history.db"
dialect = "uk"
style = "compact"
inline_height = 25
invert = true
update_check = false
sync_frequency = "5m"
{{- if eq (env "CODESPACES") "true" }}
auto_sync = true
View gist:63010c3024030f2f76f4c0b20becfb55
# https://bendews.com/posts/implement-dns-over-https
configure
set service dns forwarding options "no-resolv"
set service dns forwarding options "server=127.0.0.1#5053"
delete service dns forwarding options "server=1.1.1.1"
commit
save
exit
sudo /etc/init.d/dnsmasq force-reload
@lawrencegripper
lawrencegripper / 1-rule.rego
Last active November 18, 2021 13:14
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].contents.metadata.name == input[j].contents.metadata.name
@lawrencegripper
lawrencegripper / temp_handler.py
Last active June 21, 2021 14:15
temp_handler.py
View temp_handler.py
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():
return
name = get_name(ctx) # No included, just a regex to pull out the childs name from the msg
temp = temp_regex.search(ctx.message.get_body().lower()).group()
@lawrencegripper
lawrencegripper / dsc_config.ps1
Last active March 17, 2021 16:03
Azure Windows Container in VNET Powershell DSC
View dsc_config.ps1
<#
.SYNOPSIS
Uses PowerShell DSC to configure the machine to run the container
.PARAMETER Image
Docker Image to run complete with tag
.PARAMETER Command
Command to run in the docker image
.PARAMETER RegistryUrl
Azure container registry url
@lawrencegripper
lawrencegripper / .Dockerfile
Last active March 15, 2021 15:08
Azure Devops Agent inside a DevContainer
View .Dockerfile
# Very basic devcontainer, see line 15 copying in build agent start script
# https://github.com/Azure/azure-functions-docker/blob/master/host/3.0/buster/amd64/dotnet/dotnet-core-tools.Dockerfile
FROM mcr.microsoft.com/azure-functions/dotnet:3.0-dotnet3-core-tools
# 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
lawrencegripper / main.tf
Last active March 9, 2021 22:07
Funcs Keys listing
View main.tf
terraform {
required_providers {
shell = {
source = "scottwinkler/shell"
version = "1.7.7"
}
}
}
resource "azurerm_function_app" "functions" {
@lawrencegripper
lawrencegripper / storagediagnosticlogs.tf
Created February 10, 2021 11:52
Enable Diagnostic logs on an Azure storage account with terraform
View storagediagnosticlogs.tf
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
lawrencegripper / run.ps1
Created November 12, 2020 16:57
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)
{
$resultFileNumber++
$testName = Split-Path $testFile -leaf
@lawrencegripper
lawrencegripper / buildyamlsnippet.yaml
Last active November 22, 2020 10:50
Trigger Job on file changes in Azure Devops
View buildyamlsnippet.yaml
- job: ciml
displayName: "Machine Learning CI"
pool:
vmImage: 'Ubuntu 20.04'
steps:
- task: PowerShell@2
displayName: 'Run CI Task from make.ps1 in Devcontainer'
inputs:
targetType: 'inline'
script: 'Install-Module -Name PSake -Force && Invoke-psake ./make.ps1 ciml'