Skip to content

Instantly share code, notes, and snippets.

View AndresPineros's full-sized avatar

Andrés Felipe Piñeros AndresPineros

View GitHub Profile
@AndresPineros
AndresPineros / Compose wait-for-it
Created October 4, 2017 15:57
usage: wait.sh 30 google.com:80 yahoo.com:80
#!/bin/bash
# Use this script to test if a given TCP host/port are available
cmdname=$(basename $0)
timeout=30
if [[ $1 =~ ^[0-9]+$ ]]; then
timeout=$1
shift 1
fi
while [[ $# -gt 0 ]]; do
@AndresPineros
AndresPineros / dockerbackup.sh
Last active January 2, 2018 21:02
Docker Named Volume Backup tool
#!/bin/bash
action=$1 #Backup or restore
volume_name=$2 #The name of the docker-compose volume to restore or backup.
output_dir=$3 #Where to read from (if restore) or to write to (if backup) the backup.
file_name=$4 #How the backup is (if restore) or will (if backup) be named.
function usage() {
echo "Usage: db (backup|restore) volume_name output_input_dir file_name"
exit
@AndresPineros
AndresPineros / developmentEnv.sh
Last active September 12, 2018 20:17
Dependencies for development environment
#!/bin/bash
# System dependencies
sudo apt-get update -y
# System tools
sudo apt-get install terminator tree vim wget curl -y
sudo apt-get install --no-install-recommends gnome-panel -y
sudo apt-get install nautilus-open-terminal -y
@AndresPineros
AndresPineros / wait-centos.sh
Last active March 11, 2018 06:31
Wait for it for Centos
#!/bin/bash
HOST=$1
PORT=$2
TIMEOUT=$3
INITIAL_WAIT=$4
if [ -z "$TIMEOUT" ]; then TIMEOUT=15; fi
if [ ! -z "$INITIAL_WAIT" ]; then sleep $INITIAL_WAIT; fi
currentSeconds=0
@AndresPineros
AndresPineros / tcpdump-kubernetes
Created August 29, 2022 23:01 — forked from dcasati/tcpdump-kubernetes
visualize a tcpdump capture from a Kubernetes POD on Wireshark in real time
run tcpdump on a POD and then (live) see that information through wireshark locally on my machine. the magic of ssh and fifo 
Topology
--------
[laptop with wireshark] ------> [AKS Node] ----> [POD (tcpdump is here)]. 
1. create the fifo on your local machine (where wireshark will run)
mkfifo /tmp/remote-capture.fifo
2. execute the following command to send traffic from within a POD to the stdout. This will then be redirected to the fifo locally