Skip to content

Instantly share code, notes, and snippets.

View moertel's full-sized avatar
🦜
Deploying canaries

Stefanie Grunwald moertel

🦜
Deploying canaries
View GitHub Profile
@moertel
moertel / assignment.tex
Last active December 23, 2015 15:59 — forked from matth/assignment.tex
LaTeX document class definition and example script for Open University assignments (TMA)
\documentclass{tma}
\student{My Name}
\email{me@example.net}
\identifier{B1234567}
\course{M248}
\tma{1}
\tmapart{1}
\date{January 20, 2011}

Keybase proof

I hereby claim:

  • I am moertel on github.
  • I am moertel (https://keybase.io/moertel) on keybase.
  • I have a public key whose fingerprint is 8913 A5D5 63A4 C542 23AC 3AA5 170B D551 B997 AB1B

To claim this, I am signing this object:

@moertel
moertel / chart.py
Last active July 16, 2016 12:33
Display a postgreSQL result set as bar chart
#!/usr/bin/env python
from optparse import OptionParser
import sys
import re
import colorama
# Original output:
# $ psql -c "select '2016-07-01'::date, 37483::int as value union select '2016-07-02'::date, 121782::int as value;"
# date | value
@moertel
moertel / Dockerfile
Last active September 20, 2019 08:20
cstore_fdw: ERROR: cache lookup failed for type 0 (Steps to reproduce)
FROM postgres:9.6.9
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
ca-certificates \
curl \
apt-transport-https \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
RUN curl --silent --show-error --fail 'https://repos.citusdata.com/community/config_file.list?os=debian&dist=stretch&source=script' > /etc/apt/sources.list.d/citusdata_community.list \
&& curl --silent --location-trusted https://repos.citusdata.com/community/gpgkey | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \
@moertel
moertel / INIT_VAULT.md
Last active January 8, 2023 08:49
Try Vault with MySQL storage backend (via Docker)

Initialise (will return keys and a token)

curl -X PUT http://0.0.0.0:8200/v1/sys/init --data '{"secret_shares":1, "secret_threshold":1}'

Use one of the keys to unseal

curl -X PUT http://0.0.0.0:8200/v1/sys/unseal --data '{"key":"a5e665962f544dd16471c120c5500a7906cfbaeb3f18ae0fc6c5c71d444f0a90"}'

Use the root token to store something

@moertel
moertel / deobfuscate_gclid.php
Created April 22, 2014 17:42
decode google click id
<?php
function gclid_decode($gclid, $splitTimestamp = true)
{
// Copyright 2013 Deed Poll Office Ltd, UK <https://deedpolloffice.com>
// Licensed under Apache Licence v2.0 <http://apache.org/licenses/LICENSE-2.0>
// http://blog.deedpolloffice.com/articles/decoding-gclid-parameter
preg_match_all('/
(?=[\x5\xd\x15\x1d%\-5=EMU\]emu}\x85\x8d\x95\x9d\xa5\xad\xb5\xbd\xc5\xcd\xd5
\xdd\xe5\xed\xf5\xfd]) # 32-bit wire type
([\x80-\xff]*[\0-\x7f])(.{4}) |
@moertel
moertel / main.py
Created August 23, 2023 16:40
Send OpenTelemetry traces via OTLP to Grafana Cloud directly from Google Cloud Function
from firebase_functions import https_fn
from firebase_admin import initialize_app
from typing import Any
from opentelemetry import trace
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.resources import Resource
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
@moertel
moertel / suppress_ruby_output.rb
Last active March 21, 2024 08:54
Temporarily suppress STDOUT and STDERR (ruby)
# Temporarily redirects STDOUT and STDERR to /dev/null
# but does print exceptions should there occur any.
# Call as:
# suppress_output { puts 'never printed' }
#
def suppress_output
original_stderr = $stderr.clone
original_stdout = $stdout.clone
$stderr.reopen(File.new('/dev/null', 'w'))
$stdout.reopen(File.new('/dev/null', 'w'))