Skip to content

Instantly share code, notes, and snippets.

View M1ke's full-sized avatar

Mike Lehan M1ke

View GitHub Profile
@M1ke
M1ke / _AWS-AutoScaling.md
Last active July 12, 2021 14:04
Useful scripts to automate components of AWS EC2

AWS EC2 Python scripts

Using EC2 instances within an autoscaling group is the best way to guarantee redundancy, scalability and fault tolerance across your infrastrucutre.

This comes at the price of common paradigms such as being able to SSH into a known URL to manage configuration or logs, and the requirement that configurations must be applied to multiple machines.

DevOps provisioning tools such as Puppet can be used to manage configurations, but they

@M1ke
M1ke / .bashrc
Last active May 15, 2019 13:38
Handy stuff in my .bashrc
# Taken from https://github.com/NotBobTheBuilder/dotfiles/blob/9dfb79548eab93c5b048b7ac535c53cee8db47f0/.bash_aliases
# Relies on .bash_colors also from the same file
IRed="\[\033[0;91m\]" # Red
Green="\[\033[0;32m\]" # Green
Color_Off="\[\033[0m\]" # Text Reset
export PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(git branch &>/dev/null;\
if [ $? -eq 0 ]; then \
echo "$(echo `git status` | grep "Changes" > /dev/null 2>&1; \
@M1ke
M1ke / keybase.md
Last active January 25, 2017 14:10

Keybase proof

I hereby claim:

  • I am m1ke on github.
  • I am m1ke (https://keybase.io/m1ke) on keybase.
  • I have a public key ASDL9H7hQl69kVoA3M4_q95BAd9MkPqBY6p5Hz7N-redLwo

To claim this, I am signing this object:

@M1ke
M1ke / deploy-master
Created September 2, 2014 09:18
After accidentally pushing a development branch out to production (fortunately no problems, just unexpected new features for users) I decided to proactively prevent it happening again with a simple bit of bash and git.
#!/bin/bash
# We only run the deployment if we're already on master; we could do this directly in gulp but it allows for other commands to be added
if [ $(git rev-parse --abbrev-ref HEAD) == "master" ]; then
gulp deploy
else
echo "Must be on master"
@M1ke
M1ke / gulp-beep.js
Created August 11, 2014 16:16
A quick way to get a beep as part of a build process in gulpjs.
function beep(){
var exec = require('child_process').exec;
exec('canberra-gtk-play --file=/usr/share/sounds/gnome/default/alerts/glass.ogg');
}
@M1ke
M1ke / gulp-watch.bash
Last active August 29, 2015 14:05
Gnome terminal watch tabs. A quick way to open a new terminal with multiple tabs for watch commands (specifically used in this case because the ruby-sass plugin for gulp is really slow).
#!/bin/bash
gnome-terminal -t "watch" --tab -e "bash -c 'gulp watch'" --tab -e "bash -c 'compass watch'"
@M1ke
M1ke / gulp-bower-multiple.js
Last active August 29, 2015 14:04
A basic but repetitive way of having bower go to multiple directories.
var gulp = require('gulp');
var bower = require('gulp-bower');
gulp.task('bower', function() {
bower({ directory: '../../assets', cwd: './bower/assets/' });
bower({ directory: '../../js', cwd: './bower/js/' });
});
@M1ke
M1ke / README.md
Last active August 29, 2015 14:04
FPDI Extension

FPDI Template

This has now been added to the FPDI Extended repository.

@M1ke
M1ke / bower-multi.bash
Last active December 10, 2015 00:15
Bower multiple install directories. For those using `bower` but not grunt who want to take advantage of the multiple cwd values described in https://github.com/bower/bower/issues/212
#!/bin/bash
# Install bower `npm -g install bower`
# Create directory in project root:
# bower/
# Then create subdirectories for each bower setup
# bower/public/bower.json
# bower/compiled/bower.json
# The path installed into will be in the same directory as `bower` with the same name as the subdir
# ./public
@M1ke
M1ke / index.html
Last active August 29, 2015 14:03
Text reader
<html>
<head>
<title>Text Reader</title>
<style type="text/css">
h1 {text-align: center;}
p.text {display: none;}
</style>
</head>
<body>
<h1 class="read">The text will be read here</h1>