Skip to content

Instantly share code, notes, and snippets.

View alxschwarz's full-sized avatar

Alexander Feller alxschwarz

View GitHub Profile
@firthh
firthh / lazy_gzipped_tar.clj
Last active April 16, 2019 13:46
Lazily read a gzipped tar archive
(require [clojure.data.xml :as xml])
(import [java.io FileInputStream]
[java.util.zip GZIPInputStream]
[org.apache.commons.compress.compressors.gzip GzipCompressorInputStream]
[org.apache.commons.compress.archivers.tar TarArchiveInputStream TarArchiveEntry])
(defn get-s3-file-stream [bucket key]
(-> (s3/get-object {:endpoint "eu-west-1"}
:bucket-name bucket
:key key)
@dotmanila
dotmanila / proxy-oc-tool.sh
Last active December 16, 2023 06:08
Orchestrator STONITH via ProxySQL
#!/bin/bash
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
export ORCHESTRATOR_API="$1"
OC=orchestrator-client
PSQL='mysql --defaults-file=/etc/proxysql/user.cnf -P6032 -h127.1'
VER=$(date +%s)
$OC -c raft-leader > /dev/null 2>&1
@thomaslarsen
thomaslarsen / README.md
Last active October 25, 2024 18:08
Convert PEM certificate to JSON format
@ludoo
ludoo / !Simple Stackdriver custom metrics
Last active February 6, 2022 15:25
Simple Stackdriver custom metrics
foo! spam! eggs! name this gist!
(ns switch
(:require [clojure.pprint :as pprint]))
(defn project-clj-map [filename]
(->> (slurp filename)
(read-string)
(drop 1)
(partition 2)
(map vec)
(into {})))
@juris
juris / redis-cluster-backup.sh
Last active October 22, 2024 18:45
Redis Cluster backup script
#!/bin/sh
readonly cluster_topology=$(redis-cli -h redis-cluster cluster nodes)
readonly slaves=$(echo "${cluster_topology}" | grep slave | cut -d' ' -f2,4 | tr ' ' ',')
readonly backup_dir="/opt/redis-backup"
mkdir -p ${backup_dir}
for slave in ${slaves}; do
master_id=$(echo "${slave}" | cut -d',' -f2)
@mcastilho
mcastilho / Makefile
Last active November 11, 2022 14:59
Makefile for Medium article
.PHONY: all tags clean test build install generate image release
REGISTRY_REPO = <..redacted..>
OK_COLOR=\033[32;01m
NO_COLOR=\033[0m
ERROR_COLOR=\033[31;01m
WARN_COLOR=\033[33;01m
# Build Flags
@excavador
excavador / README.md
Last active November 6, 2022 21:48
automatically add alias ip address to loopback

Motivation

You often have several docker containers and applications which work together in the locel development environment. You need the following communications:

  • docker container to localhost
  • localhost to docker container
  • docker container to docker container

You have a way to connect localhost-to-docker using -p (port-mapping) docker option. For instance, you can start PostgreSQL container using -p 0.0.0.0:5432:5432 and then connect like to normal PostgreSQL

// grab time spent
sum := Agg("duration_sum", Sum("duration"))
// grab time spent per label
labels := Agg("labels",
Terms("issue.labels.keyword", 100),
Aggs(sum))
// grab time spent per day, and per label
@chiragnayyar
chiragnayyar / cloud_sql_flags.md
Created May 27, 2017 14:29
Cloud SQL Second Generation Tuned Flags for MySQL InnoDB

Important Notice

  • ❗ All flags and settings described here are subject to change without any notice.
  • Last update: March 2017

Introduction

This document describes a set of MySQL flags that have been tuned in Google Cloud SQL (Second Generation) to make the out-of-box experience better on Google Cloud. This is for your reference only, with the hope that some of the settings might also be useful outside the Google Cloud environment.

innodb_buffer_pool_size