Skip to content

Instantly share code, notes, and snippets.

View dobesv's full-sized avatar

Dobes Vandermeer dobesv

View GitHub Profile
@dobesv
dobesv / Dockerfile
Last active March 24, 2020 17:07
Example kustomize configs for deploying apache drill on kubernetes
FROM apache/drill:1.17.0
# Disable Java's built-in DNS cache
RUN sed -i 's/#networkaddress\.cache\.ttl=-1$/networkaddress.cache.ttl=0/' "/usr/lib/jvm/jre/lib/security/java.security"
# Install JMX Prometheus Exporter
RUN mkdir -p /opt/jmx-exporter && \
curl -o "/opt/jmx-exporter/jmx-exporter.jar" "https://repo1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/0.12.0/jmx_prometheus_javaagent-0.12.0.jar"
COPY drill-jmx-exporter-rules.yaml /opt/jmx-exporter/drill-jmx-exporter-rules.yaml
$ curl -v "https://api.xero.com/api.xro/2.0/Accounts"
> GET /api.xro/2.0/Accounts HTTP/1.1
> Host: api.xero.com
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 401 Unauthorized
< Content-Type: text/html; charset=utf-8
< Strict-Transport-Security: max-age=31536000
< WWW-Authenticate: OAuth Realm="api.xero.com"
$ curl -vH "Authorization: Bearer eyJhbGc" "https://api.xero.com/api.xro/2.0/Accounts"
> GET /api.xro/2.0/Accounts HTTP/1.1
> Authorization: Bearer eyJhbGc
>
< HTTP/1.1 401 Unauthorized
< Server: Kestrel
< WWW-Authenticate: Bearer error=invalid_token
< Xero-Correlation-Id: e3ec736b-3932-4630-a701-89098e09d5c9
< Content-Length: 125
< Expires: Wed, 22 Jan 2020 05:53:57 GMT
@dobesv
dobesv / gist:4f76a2095a3aa8bc20eda6b3a8e455b3
Created December 20, 2019 06:11
Example of a kubernetes cron job that dumps a postgres database and copies it to s3
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: postgres-backup
spec:
schedule: "0 12 * * *"
jobTemplate:
spec:
backoffLimit: 0
template:
@dobesv
dobesv / open-tunnel-and-browser.sh
Last active November 4, 2019 22:07
Helper scripts to open a tunnel to a service in kubernetes and launch the browser to the given service.
#!/usr/bin/env bash
ENVIRONMENT=$1
NAMESPACE=$2
SERVICE_NAME=$3
DEFAULT_LOCAL_PORT=4000
DEFAULT_TARGET_PORT=80
case $ENVIRONMENT in
@dobesv
dobesv / es-config.txt
Created July 24, 2019 23:22
Example configuration for fluentd-es namespace per index using record_modifier and elasticsearch
<filter kubernetes.**>
@type kubernetes_metadata
</filter>
# Use tag as index name prefix by default
<filter **>
@type record_modifier
<record>
_es_index ${tag_parts[0]}.${Time.at(time).strftime('%F')}
</record>
{
"presets": [
"@babel/preset-typescript",
[
"@babel/preset-env",
{ "ignoreBrowserslistConfig": true, "targets": { "node": true } }
],
"@babel/react"
]
}
@dobesv
dobesv / babel-generic-func-bug_.babelrc
Last active March 6, 2019 19:23
Reproduce babel typescript bug
{
"presets": [
"@babel/preset-typescript",
[
"@babel/preset-env",
{ "ignoreBrowserslistConfig": true, "targets": { "node": true } }
],
"@babel/react"
]
}
@dobesv
dobesv / csvAsyncIterator.ts
Created February 20, 2019 19:43
Async iterator wrapper for papaparse
import Papa, { ParseConfig, Parser } from 'papaparse';
export type CsvAsyncIteratorOptions = Exclude<
ParseConfig,
'step' | 'chunk' | 'complete' | 'error'
>;
/**
* Helper to allow async iteration over the contents of
* a CSV input.
@dobesv
dobesv / dev_cert.sh
Created May 28, 2018 17:38
Script to create a local certificate authority and TLS certificate for a given domain name.
#!/usr/bin/env bash
set -x
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
NAME=${1:-localhost}
CA_KEY=$DIR/dev_cert_ca.key.pem
[ -f $CA_KEY ] || openssl genrsa -des3 -out $CA_KEY 2048