Skip to content

Instantly share code, notes, and snippets.

View wilcollins's full-sized avatar

Wil Collins wilcollins

View GitHub Profile
@wilcollins
wilcollins / flag-parser.sh
Created February 4, 2018 05:21
Parses long & short flags in a single block
#!/bin/bash
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd )"
# ----- defaults -----
SOME_FLAG=false
# ----- arg parsing -----
show_help(){
#!/bin/bash
# This script monitors an ENV specified log file for the provided TRIGGER_STRING,
# at which point, the final command is executed.
# TODO: USAGE:
TRIGGER_STRING=$1
FINAL_CMD=$2
# Where the host compose log file will be mounted within the container asynchronously waiting
CONTAINER_COMPOSE_LOG="$CONTAINER_LOG_DIR/$COMPOSE_LOG_FILE"
@wilcollins
wilcollins / sshKeyGen.sh
Last active June 30, 2018 21:22
SSH KeyGen+Copy Bash Script (quick ssh key setup)
#!/bin/bash
#
# Creates an SSH key on a client machine, applies the appropriate file permissions,
# copies to the local ~/.ssh directory, & copies to specified server
#
# parameters:
# ..1 newKeyFileName
# ..2 user@server
#
# usage :
@wilcollins
wilcollins / Git-precommit-hook-mysqldump
Last active April 28, 2023 10:45
Git pre-commit hook for MySQL database backup ( remote mysqldump + Git push )
#!/bin/bash -e
# -e means exit if any command fails
DBHOST=address.to.your.server
DBUSER=username
DBPASS=password # do this in a more secure fashion
DBNAME=DBNAME
GITREPO=/where/is/your/repo
DUMP=$GITREPO/where/you/store/dumps
NEW=$DUMP/schema.sql
OLD=$NEW.old
@wilcollins
wilcollins / AWS-node-setup
Created February 11, 2015 08:16
Quick setup for Node.js && npm on AWS micro instance
// env setup
sudo su
yum update
yum groupinstall 'Development Tools'
yum install openssl-devel
yum install git
// node install
git clone https://github.com/joyent/node.git
cd node