Skip to content

Instantly share code, notes, and snippets.

View lawrencegripper's full-sized avatar

Lawrence Gripper lawrencegripper

View GitHub Profile
@lawrencegripper
lawrencegripper / main.tf
Last active December 11, 2024 13:48
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
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 / launch.json
Last active August 21, 2024 08:44
Golang debugging in VSCode with Arguments
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "go",
"request": "launch",
"mode": "debug",
"remotePath": "",
@lawrencegripper
lawrencegripper / invokeWithCookie.ps1
Last active January 18, 2024 06:34
Invoke-webrequest With Cookie
$downloadToPath = "c:\somewhere\on\disk\file.zip"
$remoteFileLocation = "http://somewhere/on/the/internet"
$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession
$cookie = New-Object System.Net.Cookie
$cookie.Name = "cookieName"
$cookie.Value = "valueOfCookie"
@lawrencegripper
lawrencegripper / make_writable.js
Last active July 12, 2023 23:00 — forked from moehlone/make_writable.js
Make JavaScript readonly propertys writable (example for overwriting navigator.userAgent; useful for unit tests -> browser detection)
/**
* Creates a read/writable property which returns a function set for write/set (assignment)
* and read/get access on a variable
*
* @param {Any} value initial value of the property
*/
function createProperty(value) {
var _value = value;
/**
@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 / keys.tf
Last active July 26, 2022 17:45
Terraform Azure functions keys
# Get the functions keys out of the app
resource "azurerm_template_deployment" "function_keys" {
name = "javafunckeys${var.random_name_ending}"
parameters = {
"functionApp" = "${azurerm_function_app.function-app.name}"
}
resource_group_name = "${var.resource_group_name}"
deployment_mode = "Incremental"
@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 / trap.sh
Last active September 21, 2021 19:25
Cleanup in Bash script
#!/bin/bash
set -e
function cleanup()
{
echo -e "----> Trap caught! Do cleanup here"
}
trap cleanup EXIT
# imagine some stuff happens here