Skip to content

Instantly share code, notes, and snippets.

Avatar

Adam Whitlock alloydwhitlock

View GitHub Profile
@alloydwhitlock
alloydwhitlock / nexartrel.sh
Created Jan 14, 2019
Retrieve a Maven artifact from Nexus without using Maven
View nexartrel.sh
#!/bin/bash
# Name: Nexus MVN Retrieval
# Script: nexartrel.sh
# Version: 0.0.3
# Author: Adam Whitlock [adam@adamwhitlock.com]
# Command line options to be passed
function options {
@alloydwhitlock
alloydwhitlock / airflow_virtenv.sh
Created Jan 3, 2019
Create a virtual environment for developers to use Airflow
View airflow_virtenv.sh
#!/bin/bash
# Purpose: Setup local Airflow Python development environment
# Author: Adam Whitlock (adam@adamwhitlock.com)
# Version: 0.0.1
# Specify major version of Python used for Airflow
PYTHON_VERSION="2"
AIRFLOW_VERSION="1.10.1"
@alloydwhitlock
alloydwhitlock / grafana_backup.sh
Created Dec 12, 2018
Simple Grafana backup script
View grafana_backup.sh
#!/bin/bash
#
# Name: Grafana dashboard backup script
# Version: 0.1
# Requires: jq
display_usage() {
echo "Usage: $0 HOSTNAME KEY DIR"
echo "Backup all Grafana dashboards using Grafana API key"
echo "Requires 'jq' to parse JSON"
@alloydwhitlock
alloydwhitlock / hash_check.sh
Created Dec 12, 2018
Simple Git branch hash visualizer thing
View hash_check.sh
#!/bin/bash
# This is a quick & dirty way of comparing a bunch of various repositories
# visually to understand divergence. Made this very relaxed so anyone with
# shell experience can modify it to their whim.
#
# Suggestions include having comparitive operations between branch names,
# maybe giving an error if ANY divergence is encountered, or maybe trying
# to automatically merge branches if doing something silly like Git flow.
View consul_healthcheck.go
package main
import (
"encoding/json"
"fmt"
"github.com/urfave/cli"
"io/ioutil"
"log"
"net/http"
"os"
@alloydwhitlock
alloydwhitlock / bastionssh.alias
Created Sep 13, 2017
Alias structure for opening a remote tmux session automatically on a remote host with SOCKS proxy
View bastionssh.alias
alias bastionssh='ssh -X -K -D 9999 targethost.example.com -t tmux attach -t session_name'
View check_anyconnect.sh
#!/bin/bash
#
# Clear SSH control master sockets if using Cisco AnyConnect on Mac OS X
$(command -v ifconfig) | $(command -v grep) 'tun3' > /dev/null 2>&1
[[ $? -eq 0 ]] && rm -f ~/.ssh/master-alloydwhitlock@* && echo "Cleared SSH control masters from prior connections..."
View keybase.md

Keybase proof

I hereby claim:

  • I am alloydwhitlock on github.
  • I am alloydwhitlock (https://keybase.io/alloydwhitlock) on keybase.
  • I have a public key whose fingerprint is 2260 8CFD 4C57 12F7 8EED 7514 AD0C DE08 F3C9 54FA

To claim this, I am signing this object:

@alloydwhitlock
alloydwhitlock / tmux.bashrc
Created Mar 10, 2015
Start & attach tmux session on SSH login
View tmux.bashrc
# Add this line to a user's ~/.bashrc to automatically attach a tmux session upon login.
# Credit goes to William Shallum for writing this gist (http://william.shallum.net/random-notes/automatically-start-tmux-on-ssh-login)
if [ "$PS1" != "" -a "${STARTED_TMUX:-x}" = x -a "${SSH_TTY:-x}" != x ]
then
STARTED_TMUX=1; export STARTED_TMUX
sleep 1
( (tmux has-session -t remote && tmux attach-session -t remote) || (tmux new-session -s remote) ) && exit 0
echo "tmux failed to start"
fi
View date_offset.sh
#!/usr/bin/env bash
# Name: date_offset.sh
# Description Subtract offset days from current epoch date
#
# Last Update: 11/04/2014
# How many days back
day_offset="49"