Skip to content

Instantly share code, notes, and snippets.

View dsiebel's full-sized avatar

Dominik Siebel dsiebel

View GitHub Profile
@dsiebel
dsiebel / Base64.java
Created April 1, 2011 14:47
Static encoding / decoding class for Base64
public class Base64 {
private final static char[] ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".toCharArray();
private static int[] toInt = new int[128];
static {
for(int i=0; i< ALPHABET.length; i++){
toInt[ALPHABET[i]]= i;
}
@dsiebel
dsiebel / template_store.html
Created June 21, 2012 12:39
JavaScript Micro-Templating (2008 by John Reisig, mirrored for easy access) http://ejohn.org/blog/javascript-micro-templating/
<script type="text/html" id="item_tmpl">
<div id="<%=id%>" class="<%=(i % 2 == 1 ? " even" : "")%>">
<div class="grid_1 alpha right">
<img class="righted" src="<%=profile_image_url%>"/>
</div>
<div class="grid_6 omega contents">
<p><b><a href="/<%=from_user%>"><%=from_user%></a>:</b> <%=text%></p>
</div>
</div>
</script>
@dsiebel
dsiebel / uk_postcode_regex.pl
Last active April 28, 2022 06:41
UK postcode regex
(GIR 0AA)|(((A[BL]|B[ABDHLNRSTX]?|C[ABFHMORTVW]|D[ADEGHLNTY]|E[HNX]?|F[KY]|G[LUY]?|H[ADGPRSUX]|I[GMPV]|JE|K[ATWY]|L[ADELNSU]?|M[EKL]?|N[EGNPRW]?|O[LX]|P[AEHLOR]|R[GHM]|S[AEGKLMNOPRSTY]?|T[ADFNQRSW]|UB|W[ADFNRSV]|YO|ZE)[1-9]?[0-9]|((E|N|NW|SE|SW|W)1|EC[1-4]|WC[12])[A-HJKMNPR-Y]|(SW|W)([2-9]|[1-9][0-9])|EC[1-9][0-9]) [0-9][ABD-HJLNP-UW-Z]{2})
@dsiebel
dsiebel / calendar.html.twig
Created October 18, 2013 06:41
A Twig template rendering a calendar/datepicker.
{#
time can be any string acceptable by http://www.php.net/strtotime, the
template will output that time's month.
If you don't want to pass in a date you can set time like this:
{% set time = "now"|date("U") %}
{% set time = "December 2012"|date("U") %}
How ever you want to output items onto the calendar is a different issue,
but I'd assume pushing everything into an array numerically indexed by that day:
@dsiebel
dsiebel / list_gcp_ipranges.sh
Last active May 7, 2018 15:16 — forked from n0531m/list_gcp_iprange.sh
Google Cloud Platform : ip address range
#!/usr/bin/env bash
[[ -v VERBOSE ]] && set -x
set -eu
# This script lists all ip ranges currently used by
# the google cloud platform, according to ns-lookup / dig
# TXT _cloud-netblocks.googleusercontent.com
#
# https://cloud.google.com/compute/docs/faq#ipranges
#
@dsiebel
dsiebel / build.sh
Last active April 9, 2020 08:30
A Dockerfile for https://octant.dev/
#!/usr/bin/env bash
OCTANT_IMAGE=dsiebel/octant
OCTANT_VERSION=0.11.1
docker build \
--tag ${OCTANT_IMAGE}:${OCTANT_VERSION} \
--build-arg OCTANT_VERSION=${OCTANT_VERSION} \
--file ./octant.Dockerfile \
.
@dsiebel
dsiebel / boostrap.sh
Created June 2, 2021 07:30
Minimal bash script template
#!/usr/bin/env bash
# Original version: https://betterdev.blog/minimal-safe-bash-script-template/
# Minor adjustments for positional arguments, debug output, remove colors and such.
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
#script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
script_name=$(basename "${BASH_SOURCE[0]}")
# TF_LOG=debug output for Github issue hashicorp/terraform-provider-googleworkspace#259
2022-02-11T08:59:13.699+0100 [INFO] Terraform version: 1.1.5
2022-02-11T08:59:13.699+0100 [INFO] Go runtime version: go1.17.2
2022-02-11T08:59:13.699+0100 [INFO] CLI args: []string{"/usr/local/Cellar/tfenv/2.2.2/versions/1.1.5/terraform", "apply", "out.tfplan"}
2022-02-11T08:59:13.699+0100 [DEBUG] Attempting to open CLI config file: /Users/dsiebel/.terraformrc
2022-02-11T08:59:13.699+0100 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2022-02-11T08:59:13.700+0100 [INFO] Loading CLI configuration from /Users/dsiebel/.terraform.d/credentials.tfrc.json
2022-02-11T08:59:13.702+0100 [DEBUG] checking for credentials in "/Users/dsiebel/.terraform.d/plugins"
2022-02-11T08:59:13.703+0100 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
@dsiebel
dsiebel / skaffold.yaml
Created February 10, 2023 16:06
skaffold#8380
apiVersion: skaffold/v3
kind: Config
metadata:
name: skaffold-8380
build:
artifacts:
- image: $REPO_URL/my-image
context: .
docker:
buildArgs: