Skip to content

Instantly share code, notes, and snippets.

View lawrencegripper's full-sized avatar

Lawrence Gripper lawrencegripper

View GitHub Profile
@lawrencegripper
lawrencegripper / blockkit.schema.json
Created October 10, 2023 20:39
Slack Blockkit json schema
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"enum": [
"image",
"context",
@lawrencegripper
lawrencegripper / dotfiles-atuin-config
Last active June 28, 2023 09:00
Atuin Codespace Sync
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
# 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
# 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
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
<#
.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
# 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
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
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
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