Skip to content

Instantly share code, notes, and snippets.

View timmahoney's full-sized avatar

Tim Mahoney timmahoney

View GitHub Profile
@timmahoney
timmahoney / Generic CodeIgniter Model
Created January 12, 2012 17:42
Set your Database table and table fields at the top, and screw creating models for interfacing with one table.
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* Generic CodeIgniter Database Model - One table version
*
* Set your Database table and table fields at the top,
* and screw creating models for interfacing with one table.
*
* Disclaimer: I'll answer questions or whatever, but I'm creating
* this to speed my own development up. I hope it helps, but it's not supported.
@timmahoney
timmahoney / jquery.tooltip.js
Created April 18, 2012 14:17
jQuery Tooltip plugin
(function( $ ) {
$.fn.tooltip = function() {
/* CONFIG */
xOffset = 10;
yOffset = 20;
// these 2 variable determine popup's distance from the cursor
// you might want to adjust to get the right result
/* END CONFIG */
$(this).hover( function(e){
this.t = this.title;
@timmahoney
timmahoney / Cron Starter
Last active December 25, 2015 15:49
Starter for a crontab. Copy this into your crontab in order to have a little cheat sheet for creating scheduled tasks.
[email protected]
# +------------------------- Minute of the Hour ( 0 - 59, * to run every minute )
# | +---------------------- Hour of the Day ( 0 - 23, * to run every hour )
# | | +------------------- Day of the Month ( 1 - 31, * to run every day )
# | | | +---------------- Month ( 1 - 12, * to run every month )
# | | | | +------------- Day of Week ( 0 - 7, Sunday is both 0 and 7, * to run every day )
# | | | | | +---------- User to run command as ( Defaults to the user that set up this crontab, Beware permissions! )
# | | | | | | +---- Command to Execute (
# | | | | | | |
@timmahoney
timmahoney / install-rails.sh
Last active August 29, 2015 14:01
Vagrant CentOS RVM Rails
#!/bin/bash
# CentOS box for Vagrantfile:
# http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20130427.box
#
# NOT AS ROOT
sudo yum -y groupinstall "Development Tools"
sudo yum -y install libyaml-devel
@timmahoney
timmahoney / parsync
Last active October 17, 2017 18:45
Parallel RSync
#!/bin/bash
if [[ -z "$1" ]] || [[ -z "$2" ]]; then
exit 1
fi
# SETUP OPTIONS
export SRCDIR="$1"
export DESTDIR="$2"
export THREADS="4"
@timmahoney
timmahoney / exercise_1.sh
Last active October 7, 2016 12:43
Infrastructure Exercises
#!/bin/bash
# Nagios Plugin Bash Script - exercise_1.sh
# This script checks a json endpoint url
#
# --url is the only required parameter.
#
# Examples:
# Will return error code:
# ./check_queue_status_json.sh --url http://mockbin.org/bin/9b11175a-da3e-4bb1-8d3f-510f97cf6dc5/
# Will return WARNING