Skip to content

Instantly share code, notes, and snippets.

View Johannestegner's full-sized avatar
🐇

Johannes Johannestegner

🐇
View GitHub Profile
@Johannestegner
Johannestegner / _txt
Created March 3, 2024 17:08
Ingress Controller manifest example.
This is a bit simplified, so don't copy this straight of, it's just an example.
The important parts is to show that the LB service exposes port 443 and 80 and selects the `traefik` daemonset.
When a request is sent in through the loadbalancer (LB machine will send request straight to the service), the ingress controller will handle the request
it then looks for a service which an ingress resource points to and forward the request to that one.
So, LB => Ingress => App
Doing it this way will make it so that when you expose a service to the internet, you will always go through the ingress controller
rather than exposing a new service as a LB each time.
@Johannestegner
Johannestegner / jack.md
Last active May 17, 2023 12:27
A pumkin as imagined by ChatGPT.
,-.
___,---'---`---.__
_,-'` `-._
,-` `-.
,' `.
| __ |
| ,' `---._ |
| / `-. .
| . `-. |
| | `, |
@Johannestegner
Johannestegner / README.md
Last active March 25, 2023 11:03
dockerhub readme footer
@Johannestegner
Johannestegner / Program.cs
Last active January 23, 2023 09:57
Crypto JS vs C# with AES256CBC
using System.Security.Cryptography;
using System.Text;
Console.WriteLine(Crypto.Encrypt("ABC123"));
Console.WriteLine(Crypto.Decrypt("23YByDj8nb3FCZAyiV1DMifqCTCGII51EM9BfKU3qIc="));
public static class Crypto
{
private const string AesKey = "QmYHLtarGbVtmjDyesF7BI0GcJ6J+eMOu3pZOsJMSq0=";
@Johannestegner
Johannestegner / README
Created May 16, 2021 12:42
Revive "real" async js file.
Not built for older browsers, expects to have arrow functions and template strings available to work.
File is derived from the original async.js file in the revive adserver repository, whilst edited to check for new <ins> elements during runtime, i.e., making it more fitting for a SPA with dynamic dom.
kind: CustomResourceDefinition
apiVersion: apiextensions.k8s.io/v1
metadata:
name: plans.upgrade.cattle.io
spec:
group: upgrade.cattle.io
names:
plural: plans
singular: plan
kind: Plan
@Johannestegner
Johannestegner / auto-pass
Created January 21, 2021 12:13
ssh-askpass-cli
#!/bin/sh
echo "${AUTO_SSH_PASSWORD}"
@Johannestegner
Johannestegner / latest_tags.py
Last active November 12, 2020 13:56
A small script to fetch latest pushed tags from docker hub.
#!/usr/bin/env python
# LICENSE: MIT
# (c) - Johannes Tegner
import json, sys, urllib.request
help_str = """Docker image tag fetcher.
Fetches latest tags from a public docker v2 registry api such as docker hub.
@Johannestegner
Johannestegner / semver.js
Last active October 8, 2020 08:23
SEMVER diff with pre-release.
const test = /(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:[.+~-](?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
const prerelease = /(?<type>[a-zA-Z]+)(?:[+~.-]?)(?<version>.*)/;
const groups = ['major', 'minor', 'patch'];
const preReleases = ['alpha', 'beta', 'rc', ''];
/**
* Test semver package versions.
*
* If v1 is higher version than v2, a positive integer will be returned.
* If v2 is higher version than v1, a negative integer will be returned.
@Johannestegner
Johannestegner / cert.yml
Created October 7, 2020 06:49
CertManagerExample
apiVersion: cert-manager.io/v1alpha2
kind: Certificate
metadata:
name: eu.jite.wildcard.crt
namespace: default
spec:
secretName: eu.jite.wildcard.tls
dnsNames:
- "jite.eu"
- "*.jite.eu"