Skip to content

Instantly share code, notes, and snippets.

View project0's full-sized avatar
:octocat:

Richard Hillmann project0

:octocat:
View GitHub Profile
@project0
project0 / debug.log
Created March 8, 2023 14:26
[Bug] grafana/terraform-provider-grafana: on-call team id
2023-03-08T15:25:47.777+0100 [INFO] Terraform version: 1.3.9
2023-03-08T15:25:47.777+0100 [DEBUG] using github.com/hashicorp/go-tfe v1.9.0
2023-03-08T15:25:47.777+0100 [DEBUG] using github.com/hashicorp/hcl/v2 v2.16.0
2023-03-08T15:25:47.777+0100 [DEBUG] using github.com/hashicorp/terraform-config-inspect v0.0.0-20210209133302-4fd17a0faac2
2023-03-08T15:25:47.777+0100 [DEBUG] using github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734
2023-03-08T15:25:47.777+0100 [DEBUG] using github.com/zclconf/go-cty v1.12.1
2023-03-08T15:25:47.777+0100 [INFO] Go runtime version: go1.19.6
2023-03-08T15:25:47.777+0100 [INFO] CLI args: []string{"terraform", "apply", "-var-file", "main.tfvars.json", "-lock=false"}
2023-03-08T15:25:47.777+0100 [DEBUG] Attempting to open CLI config file: /home/rhillmann/.terraformrc
2023-03-08T15:25:47.777+0100 [INFO] Loading CLI configuration from /home/rhillmann/.terraformrc
@project0
project0 / aws_sso.sh
Last active April 20, 2023 07:26
AWS SSO shell login refresh script
#!/bin/bash
function awsssologin() {
local envexport="$1" isretry="$2"
local cache expires login=false
local awsbin=/usr/bin/aws
if [[ -d "$HOME/.aws/sso/cache" ]]; then
for cache in "$HOME"/.aws/sso/cache/*.json; do
if ! grep -q "startUrl" "$cache" || ! grep -q "expiresAt" "$cache"; then
@project0
project0 / keybase.md
Created September 29, 2022 07:22
keybase.md

Keybase proof

I hereby claim:

  • I am project0 on github.
  • I am project0de (https://keybase.io/project0de) on keybase.
  • I have a public key ASBMfyNXnIQJRhj8GIDZ41EQWIdtNC1KRUZv2X4tKAQfvAo

To claim this, I am signing this object:

@project0
project0 / main.go
Created August 31, 2022 15:26
yeagi waitgroups
package main
import (
"github.com/traefik/yaegi/interp"
"github.com/traefik/yaegi/stdlib"
)
const code = `
package main
@project0
project0 / eth1.network
Last active April 5, 2022 19:22
Systemd networkd TunnelBroker Hurricane Electric 6in4
# This can be any public reachable interface
# basically the one connected to the internet (native or bridged)
[Match]
Name=eth1
[Network]
# your normal interface address example: 10.1.1.2/24
Address=<LOCAL_IPV4>/<NETMASK>
Gateway=<LOCAL_IPV4_GW> # local ip gw e.g 10.1.1.1
@project0
project0 / kms.sh
Created November 2, 2020 17:34
AWS KMS encryption/decryption
#!/bin/bash
function awskmsencrypt() {
key="$1"
text="$2"
aws kms encrypt --key-id "$key" --plaintext fileb://<(echo "$text") --output text --query CiphertextBlob
}
function awskmsdecrypt() {
crypt="$1" #base64
@project0
project0 / cf-s2s-vpn.yaml
Created August 10, 2020 07:49
Cloudformation template to create a site to site ipsec VPN
AWSTemplateFormatVersion: '2010-09-09'
Description: Site to Site VPN
Parameters:
RemoteIP:
Description: Remote IP for the ipsec connection
Type: String
RemoteCIDR:
Description: The destination network CIDR
Type: String
AWS_INSTANCE_ID=$(curl http://169.254.169.254/latest/meta-data/instance-id)
ROOT_VOLUME_IDS=$(aws ec2 describe-instances --region ${AWS::Region} --instance-id $AWS_INSTANCE_ID --output text --query Reservations[0].Instances[0].BlockDeviceMappings[0].Ebs.VolumeId)
TAG_LIST=$(aws ec2 describe-instances --region ${AWS::Region} --instance-id $AWS_INSTANCE_ID --output text --query "Reservations[0].Instances[0].Tags" | grep -v "aws:" | awk '{split($0,a,"\t"); printf "Key=\"%s\",Value=\"%s\" ", a[1], a[2]}')
aws ec2 create-tags --resources $ROOT_VOLUME_IDS --region ${AWS::Region} --tags $TAG_LIST
@project0
project0 / req.conf
Created February 2, 2020 18:03
openssl create certificate req
[req]
distinguished_name = req_distinguished_name
req_extensions = v3_req
prompt = no
[req_distinguished_name]
C = DE
ST = BY
L = Munich
O = Corp
OU = IT
@project0
project0 / ad_password_reset.go
Last active May 6, 2024 09:47
Go AD password reset
package passwordresetservice
import (
"crypto/tls"
"fmt"
ldap "github.com/go-ldap/ldap"
"golang.org/x/text/encoding/unicode"
ber "gopkg.in/asn1-ber.v1"
)