Skip to content

Instantly share code, notes, and snippets.

Avatar

Dominik Siebel dsiebel

View GitHub Profile
@dsiebel
dsiebel / boostrap.sh
Created Jun 2, 2021
Minimal bash script template
View boostrap.sh
#!/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]}")
View build.sh
#!/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 / list_gcp_ipranges.sh
Last active May 7, 2018 — forked from n0531m/list_gcp_iprange.sh
Google Cloud Platform : ip address range
View list_gcp_ipranges.sh
#!/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 / calendar.html.twig
Created Oct 18, 2013
A Twig template rendering a calendar/datepicker.
View calendar.html.twig
{#
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 / gist:3098374
Created Jul 12, 2012
UK postcode regex
View gist:3098374
(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 / default-80
Created Jul 7, 2012
Apache2 dynamic user home vhosts
View default-80
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerAlias home.*.local
DocumentRoot /var/www/default-80
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
@dsiebel
dsiebel / template_store.html
Created Jun 21, 2012
JavaScript Micro-Templating (2008 by John Reisig, mirrored for easy access) http://ejohn.org/blog/javascript-micro-templating/
View template_store.html
<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 / gist:2894014
Created Jun 8, 2012
ZSH dotfile by GRML
View gist:2894014
# Filename: /etc/zsh/zshrc
# Purpose: config file for zsh (z shell)
# Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
# Bug-Reports: see http://grml.org/bugs/
# License: This file is licensed under the GPL v2.
################################################################################
# This file is sourced only for interactive shells. It
# should contain commands to set up aliases, functions,
# options, key bindings, etc.
#
@dsiebel
dsiebel / StreamingStatementCreator.java
Created Mar 5, 2012
PreparedStatementCreator for streaming java.sql.ResultSets to minimize Memory usage and avoid java.lang.OutOfMemoryErrors
View StreamingStatementCreator.java
package org.springframework.jdbc.core;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.springframework.jdbc.core.PreparedStatementCreator;
public class StreamingStatementCreator implements PreparedStatementCreator {
@dsiebel
dsiebel / Base64.java
Created Apr 1, 2011
Static encoding / decoding class for Base64
View Base64.java
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;
}