Skip to content

Instantly share code, notes, and snippets.

Avatar
🦜
Deploying canaries

Stefanie Grunwald moertel

🦜
Deploying canaries
View GitHub Profile
@moertel
moertel / Dockerfile
Last active Sep 20, 2019
cstore_fdw: ERROR: cache lookup failed for type 0 (Steps to reproduce)
View Dockerfile
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 Nov 24, 2020
Try Vault with MySQL storage backend (via Docker)
View INIT_VAULT.md

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 / chart.py
Last active Jul 16, 2016
Display a postgreSQL result set as bar chart
View chart.py
#!/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
View keybase.md

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 / deobfuscate_gclid.php
Created Apr 22, 2014
decode google click id
View deobfuscate_gclid.php
<?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 / suppress_ruby_output.rb
Last active Feb 2, 2021
Temporarily suppress STDOUT and STDERR (ruby)
View suppress_ruby_output.rb
# 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'))
@moertel
moertel / assignment.tex
Last active Dec 23, 2015 — forked from matth/assignment.tex
LaTeX document class definition and example script for Open University assignments (TMA)
View assignment.tex
\documentclass{tma}
\student{My Name}
\email{me@example.net}
\identifier{B1234567}
\course{M248}
\tma{1}
\tmapart{1}
\date{January 20, 2011}