Skip to content

Instantly share code, notes, and snippets.

View thpham's full-sized avatar

Thomas Kim Pham thpham

View GitHub Profile
@joerocklin
joerocklin / safe_reset_haproxy.sh
Created January 6, 2015 21:35
safe haproxy reload
#!/bin/bash
# This checks which ports haproxy currently is listening on, temporarily drops SYN packets
# to prevent new connections, reloads haproxy, then allows SYNs again.
#
# Based on info from here:
# * https://github.com/aws/opsworks-cookbooks/pull/40
# * http://www.mail-archive.com/haproxy@formilux.org/msg06885.html
#set -x
#!/usr/bin/env python
from xivo_auth_client import Client as Auth
from xivo_confd_client import Client as Confd
auth = Auth('127.0.0.1', username='sylvain', password='sylvain', verify_certificate=False)
token_data = auth.token.new('xivo_user', expiration=10)
token = token_data['token']
uuid = token_data['xivo_user_uuid']
To get started with Docker/Marathon/Mesos, you need to install a
new Mesos, a new Marathon, and Deimos, the bridge to Docker.
You'll also need Docker and the JVM. These instructions are for
Ubuntu 13.10.
## Install Mesos prerequisites
:; sudo apt-get update
:; sudo apt-get install zookeeperd default-jre python-setuptools python-protobuf curl pip
## Install recent Mesos
@thpham
thpham / docker-compose.yaml
Last active December 20, 2018 23:09
Kafka stream data pipeline
version: "3.2"
services:
zk:
image: confluentinc/cp-zookeeper:5.1.0
hostname: zk
container_name: zk
restart: unless-stopped
ports:
- "2181:2181"
environment:
@fadenb
fadenb / configuration-snippet.nix
Created December 15, 2016 10:34
Change wireless network interface MAC at boot using macchanger on NixOS
systemd = {
services = {
"macchanger-wireless" = {
description = "Changes MAC of my wireless interface for privacy reasons";
wants = [ "network-pre.target" ];
wantedBy = [ "multi-user.target" ];
before = [ "network-pre.target" ];
bindsTo = [ "sys-subsystem-net-devices-wlp3s0.device" ];
after = [ "sys-subsystem-net-devices-wlp3s0.device" ];
script = ''
# This isn't meant to be ran as a script, but line-by-line
# Props to Binary (benary.org) for helping me with this
# 0: Create a Scaleway instance and SSH into it
ssh root@...
# 1: Install Nix
adduser user # set a password, doesn't matter what because it's not staying long
adduser user sudo
su -l user
@yaronr
yaronr / bootstrap-consul.sh
Last active September 27, 2020 17:54
Bootstrap Consul on CoreOS
#!/bin/bash
source /etc/environment
hostname=$(cat /etc/machine-id)
machines=$(etcdctl ls /consul.io/bootstrap/machines)
#If there are 'machines' then the cluster has been initialised.
if [ -z "$machines" ]
then
flags="${flags} -bootstrap"
@JohnMorales
JohnMorales / close_docker_files.sh
Last active January 5, 2021 11:43
Closes leaked deleted and eventfd left by docker
#!/bin/bash
export PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin
docker_pid=$(cat /var/run/docker.pid)
gdb -p $docker_pid <<< "$( ls /proc/$docker_pid/fd -l --time-style=+'%s' | grep -E 'deleted' | awk '{ printf("p close(%s)\n", $7)}')" >/dev/null
#closing evenfds that do not have a corresponding memory.oom_control
eventfds="$(for eventfd in $(ls /proc/$docker_pid/fd -l --time-style=+'%s' | grep -E 'eventfd'| awk '{print $7}'); do
memory_pid=$((eventfd - 1))
# Source: https://gist.github.com/f11e690295311d8d7dd53b5128bd6d3e
#####################################
# Tekton vs. Argo Workflows #
# Kubernetes-Native CI/CD Pipelines #
# https://youtu.be/dAUpAq7hfeA #
#####################################
# Referenced videos:
# - Tekton - Kubernetes Cloud-Native CI/CD Pipelines And Workflows: https://youtu.be/7mvrpxz_BfE
@vrischmann
vrischmann / .credentials
Last active January 20, 2023 11:57
Running SBT with a Nexus proxy with authentication
realm=Sonatype Nexus Repository Manager
host=nexus.company.com
user=admin
password=admin123