Skip to content

Instantly share code, notes, and snippets.

@asanchez75
asanchez75 / haproxy.cfg
Created May 18, 2019 19:28 — forked from BartKrol/haproxy.cfg
HAProxy Websockets config
global
maxconn 4096
defaults
mode http
balance roundrobin
option redispatch
option forwardfor
timeout connect 5s
@asanchez75
asanchez75 / postgres-outage.md
Created May 7, 2019 12:40 — forked from andywer/postgres-outage.md
Post Mortem: Postgres outage on 2018-08-20

2018-08-20: Postgres failure

What happened

The PostgreSQL container stopped unexpectedly, was automatically restarted, but suddenly didn't accept any connections anymore. Neither from the API service containers nor from the Macbook over the internet.

Error in logs:

FATAL:  pg_hba.conf rejects connection for host "10.0.1.2", user "postgres", database "******", SSL off
@asanchez75
asanchez75 / Dockerfile
Created April 2, 2019 14:33 — forked from orenitamar/Dockerfile
Installing numpy, scipy, pandas and matplotlib in Alpine (Docker)
# Below are the dependencies required for installing the common combination of numpy, scipy, pandas and matplotlib
# in an Alpine based Docker image.
FROM alpine:3.4
RUN echo "http://dl-8.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories
RUN apk --no-cache --update-cache add gcc gfortran python python-dev py-pip build-base wget freetype-dev libpng-dev openblas-dev
RUN ln -s /usr/include/locale.h /usr/include/xlocale.h
RUN pip install numpy scipy pandas matplotlib
@asanchez75
asanchez75 / docker-heredoc-snippet
Created April 2, 2019 13:55 — forked from mbreese/docker-heredoc-snippet
Running docker with a HEREDOC to script the commands to run inside the container.
docker run -v /Users/mbreese/tmp:/tmp1 -w /tmp1 -i centos:7 /bin/bash -s <<EOF
date > foo
echo 'foo' >> foo
cat /etc/redhat-release >> foo
whoami >> foo
EOF
CREATE OR REPLACE FUNCTION ontosides.group_enrolment_date(name text, alias text, createdat date, updatedat date) RETURNS text as
$$
DECLARE result text;
BEGIN
IF name ~ '.*([0-9]{4}).*([0-9]{4}).*' THEN
IF name like '%2013%' and name like '%2014%'THEN
result := '2013-2014';
END IF;
IF name like '%2014%' and name like '%2015%'THEN
@asanchez75
asanchez75 / tmux_build_from_source_ubuntu.sh
Last active November 14, 2019 11:47 — forked from indrayam/tmux_build_from_source_ubuntu.sh
Install latest version of tmux in Ubuntu 16.04
#!/bin/bash
# Steps to build and install tmux from source on Ubuntu.
# Takes < 25 seconds on EC2 env [even on a low-end config instance].
export VERSION=2.5
sudo apt-get -y remove tmux && \
sudo apt-get -y install wget tar libevent-dev libncurses-dev && \
wget https://github.com/tmux/tmux/releases/download/${VERSION}/tmux-${VERSION}.tar.gz && \
tar xf tmux-${VERSION}.tar.gz && \
rm -f tmux-${VERSION}.tar.gz && \
cd tmux-${VERSION} && \
@asanchez75
asanchez75 / .tmux_theme
Last active December 7, 2018 20:46 — forked from meskarune/.tmux_theme
simple tmux theme
set -g pane-active-border-bg default
set -g pane-active-border-fg "colour14"
set -g pane-border-fg "colour239"
set -g message-fg black
set -g message-bg "colour14"
set -g status-justify left
set -g status-bg "colour236"
set -g status-fg "colour14"
@asanchez75
asanchez75 / deploy_minikube.sh
Created November 26, 2018 23:44 — forked from waja/deploy_minikube.sh
Install minikube on Debian / Ubuntu
#!/bin/sh
# install needed curl package
sudo apt install --no-install-recommends curl -y
# install kubectl
curl -Lo /tmp/kubectl https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && \
chmod +x /tmp/kubectl && \
sudo mv /tmp/kubectl /usr/local/bin/kubectl
# kubectl tab completion
sudo sh -c 'echo "source <(kubectl completion bash)" > /etc/bash_completion.d/kubectl'
# install needed packages for kvm (see https://github.com/kubernetes/minikube/blob/master/docs/drivers.md#kvm2-driver)
@asanchez75
asanchez75 / pd.sh
Created November 16, 2018 04:31 — forked from dlanger/pd.sh
Tmux start-up script
#!/bin/sh
cd ~/proj/root
tmux new-session -d -s pdev
tmux new-window -t pdev:1 -n shell
tmux rename-window -t pdev:1 "shell"
tmux send-keys -t pdev:1 "workon pdev" Enter "PS1=\$_OLD_VIRTUAL_PS1" Enter "clear" Enter
@asanchez75
asanchez75 / install-docker.sh
Created August 16, 2018 12:39 — forked from dweldon/install-docker.sh
Install docker CE on Linux Mint 18.3
#!/usr/bin/env bash
# https://docs.docker.com/install/linux/docker-ce/ubuntu/
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable"
sudo apt-get update
sudo apt-get install docker-ce
# https://docs.docker.com/compose/install/