Skip to content

Instantly share code, notes, and snippets.

View Spazzy757's full-sized avatar
🍃
Keeping it green

Brendan Kamp Spazzy757

🍃
Keeping it green
View GitHub Profile
name: stg
on:
push:
branches:
- main
pull_request:
branches:
- main
@Spazzy757
Spazzy757 / merge.go
Last active June 11, 2021 07:27
Takes two map[string]interface{} types and recursively merges them. The second object will take precedence in case of clashes
//mergeObjects will take two interfaces
//and add them together
//NOTE: if keys clash, object two will overwite
//object ones key
func mergeObjects(
objectOne map[string]interface{},
objectTwo map[string]interface{},
) map[string]interface{} {
data := make(map[string]interface{})
// loop through first object adding
@Spazzy757
Spazzy757 / templater.go
Last active June 2, 2021 13:40
example code used to take in yaml and template out in a file
package main
/*
* A simple templating cli that takes a yaml file and template
* and templates out to stdout
* Uses Gotemplating syntax for a more comprehensive
* understanding of the different functionalities of go templates
* visit:
* - https://docs.gomplate.ca/syntax/
* - https://golang.org/pkg/html/template/
@Spazzy757
Spazzy757 / get-certs.sh
Created March 15, 2021 06:41
Get the certificate CA for a domain
!#/bin/bash
site=$1
openssl s_client -showcerts -verify 5 -connect $site:443 < /dev/null
@Spazzy757
Spazzy757 / envoy-filter.yaml
Created February 15, 2021 12:56
GZIP compressor Envoy Proxy Filter
---
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: gzip
spec:
workloadSelector:
labels:
# Put same labels that will identify your application
app: <app-name>
@Spazzy757
Spazzy757 / destinationrule.yaml
Last active February 15, 2021 12:54
This is a very simple example of how to create a sticky session configuration for a application running behind istio
---
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: <app-name>
spec:
host: <app-name>.<app-namespace>.svc.cluster.local
trafficPolicy:
loadBalancer:
consistentHash:

Keybase proof

I hereby claim:

  • I am spazzy757 on github.
  • I am spazzy757 (https://keybase.io/spazzy757) on keybase.
  • I have a public key ASAKYATBHoY416DS_fMFuJikrp8Dosk9q-J5v6VHcbrJcgo

To claim this, I am signing this object:

#!ipxe
set base - url http: //stable.release.flatcar-linux.net/amd64-usr/current
kernel ${base - url}/flatcar_production_pxe.vmlinuz initrd=flatcar_production_pxe_image.cpio.gz flatcar.first_boot=1 flatcar.config.url=https://example.com/pxe-config.ign
initrd $ {base - url}/flatcar_production_pxe_image.cpio.gz
boot
@Spazzy757
Spazzy757 / django-image-viewer.py
Last active May 19, 2018 10:15
These are views that will open different types of files in new tabs
# For displaying images in new tab:
def home(request):
image_data = open(“/path/to/my/image.png”, “rb”).read()
return HttpResponse(image_data, mimetype=”image/png”)
# For displaying pdf files in new tab:
def home(request):
image_data = open(“/path/to/my/image.pdf”, “rb”).read()