Skip to content

Instantly share code, notes, and snippets.

@xombiemp
xombiemp / check_and_failover_NAT.sh
Created August 22, 2012 21:57 — forked from j3tm0t0/check_and_failover_NAT.sh
Script to check Internet connectivity and fail-over route table to standby
#!/bin/sh
. /home/ec2-user/.bash_profile
. /etc/profile.d/aws-apitools-common.sh
region=us-east-1
# these should be configured for each NAT instance
target1=8.8.8.8
target2=8.8.4.4
active_rt=rtb-ACTIVE
standby_rt=rtb-STANDBY
@xombiemp
xombiemp / lndir.sh
Last active June 18, 2024 13:25
This script will allow you to effectively hard link a directory. It reproduces the directory structure of the source in the destination and then recursively hard links all the files from the source to the corresponding location in the destination. If you've ever wanted to hard link a folder, this produces the results you want.
#!/bin/bash
oldifs=$IFS
IFS='
'
[ $# -ne 2 ] && { echo "Usage: $0 sourceDirectory destinationDirectory" ; exit 1; }
[ ! -d "$1" ] && { echo "$1 is not a valid directory"; exit 1; }
[ ! -d "$2" ] && { mkdir -p "$2"; }
src=$(cd "$1" ; pwd)
dst=$(cd "$2" ; pwd)
find "$src" -type d |
@xombiemp
xombiemp / gist:7240238
Created October 30, 2013 21:03
Replacement for cp
rsync -ahvzP
@xombiemp
xombiemp / plex2pem.py
Created June 11, 2015 05:29
Convert the certificate.p12 that Plex provides to pem format.
#!/usr/bin/python
import sys
import hashlib
from OpenSSL.crypto import *
def main():
if(len(sys.argv) != 3):
print sys.argv[0] + " /path/to/file.p12 ProcessedMachineIdentifier"
sys.exit(0)