Skip to content

Instantly share code, notes, and snippets.

View M1ke's full-sized avatar

Mike Lehan M1ke

View GitHub Profile
@M1ke
M1ke / create-tunnel.sh
Last active December 24, 2015 13:49
A set of scripts to enable remote SSH tunnelling on a device. Originally written for a Raspberry Pi, so that when installed in a remote location inside a network it can easily be accessed for maintenance.
#!/bin/bash
# This sits on the device you want to be able to tunnel back into
# Replace USER and SERVER lines with your tunnel user (if different from local) and domain or IP
createTunnel() {
/usr/bin/ssh -N -R 2222:localhost:22 USER@SERVER
if [[ $? -eq 0 ]]; then
echo Tunnel created successfully
else
@M1ke
M1ke / .bash_aliases
Created October 11, 2013 07:42
Taken from https://github.com/NotBobTheBuilder/dotfiles/blob/9dfb79548eab93c5b048b7ac535c53cee8db47f0/.bash_aliases. I have altered the conditions for git to be considered "unclean" to having changes, rather than requiring "nothing to commit" to be present. I have also added an extra line to allow the title of the Xterm to change; this could be …
## Add this to the bottom of your aliases or join in another file
if [ -f ~/.bash_aliases_colors ]; then
. ~/.bash_aliases_colors
fi
if [ -f ~/.bash_git_branch ]; then
. ~/.bash_git_branch
fi
@M1ke
M1ke / README.md
Last active December 7, 2022 22:05
Quickly convert a markdown file into a nice looking PDF formatted in the same way GitHub formats Readme.md files

Markdown to PDF

Quickly convert a markdown file into a nice looking PDF formatted in the same way GitHub formats Readme.md files

  • Install grip $ pip install grip
  • Install wkhtmltopdf $ sudo apt-get install wkhtmltopdf
@M1ke
M1ke / random.sh
Last active December 29, 2015 14:09
Generate a random number within a range
#!/bin/bash
# Generate a random number within a range
from=$1
to=$2
$(( ( RANDOM % $to ) + $from ))
@M1ke
M1ke / README.md
Created July 3, 2014 12:00
NatWest Bankline CSV Template

These columns come from the spreadsheet template that can be downloaded from the Natwest website. On that page you can submit fake details to be able to download the zip file. Opening the xlt file in LibreOffice might make some weird macro stuff happen - so better to look at the column titles below!

The table columns are as follows:

  • Your Reference
  • *Debit Account Sort Code
  • *Debit Account Number
  • *Payment Amount
  • *Credit Date
  • *Beneficiary Account Sort Code
@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>
@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 / 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 / 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 / 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'"