Skip to content

Instantly share code, notes, and snippets.

View doctorallen's full-sized avatar

David Allen doctorallen

View GitHub Profile
@doctorallen
doctorallen / stored_procedure_parser.pl
Created May 7, 2013 17:16
Parses MySQL Dump files and creates individual stored procedure files for each procedure.
#!/usr/bin/perl
#Script written by David Allen on April 15th 2013
use warnings;
use Data::Dumper;
my @databases = ("TEST");
foreach( @databases )
{
$db = $_;
open(FD, $db . "_stored_procs.sql");
my @procedure;
@doctorallen
doctorallen / gittug.pl
Created May 17, 2013 15:57
Pulls latest git master branch and sources any stored procedures that may have been changed during the last commit.
#!/usr/bin/perl
use strict;
use warnings;
#set vars
my $file_names;
my @split_names;
#run the pull command
`git pull origin master`;
@doctorallen
doctorallen / pre-commit
Last active October 9, 2019 08:28
Git pre-commit hook to check staged files for console logs
#!/bin/sh
# pre-commit hook to check for console logs in staged files
# Authors: David Allen drallen1, Spencer Nowak spencernowak
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
@doctorallen
doctorallen / custom.ini
Created December 2, 2013 21:59
Updating Trac with custom fields
[ticket-custom]
progress = select
progress.label = Progress
progress.options = not started yet|started|ready for QA|tested but has bugs|testing passed|ready for staging|posted to staging|ready for production|posted to production|needs client approval|needs client feedback|needs PM clarification|can't replicate
estimate = text
estimate.format = plain
estimate.label = Hour Estimate
percent = select
percent.label = Percent Complete
percent.options = 0%|25%|50%|75%|100%
@doctorallen
doctorallen / starbound.sh
Last active July 30, 2016 21:53
Startup script for starbound server
#! /bin/sh
### BEGIN INIT INFO
# Provides: starbound
# Required-Start: networking
# Default-Start: 2 3 4 5
# Default-Stop: S 0 1 6
# Short-Description: Starbound Server Daemon
# Description: Starts/Stops/Restarts the Starbound Server Daemon
### END INIT INFO
@doctorallen
doctorallen / table-dump.sh
Created March 26, 2014 20:04
Handy script for deleting all tables in a remote database you do not have root access to. Modified from original at: http://www.cyberciti.biz/faq/how-do-i-empty-mysql-database/
#!/bin/bash
MUSER="$1"
MPASS="$2"
MSERVER="$3"
MPORT="$4"
MDB="$5"
# Detect paths
MYSQL=$(which mysql)
AWK=$(which awk)
@doctorallen
doctorallen / lstime.sh
Created April 17, 2014 14:14
List all directories by the timestamp of all files recursively
#!/bin/bash
for dir in */; do
timestamp=$(find ./$dir -type f -printf "%T@ %t\\n" | sort -nr -k 1,2 | head -n 1)
printf "%s %s\n" "$timestamp" "$dir"
done | sort -nr -k 1,2 | awk '{$1=""; print}'
@doctorallen
doctorallen / backup.sh
Created August 5, 2014 14:56
Rolling Backups
#!/bin/sh
MYSQLROOT=test
MYSQLPASS=test
S3BUCKET=TAG_Backups
FILENAME=test
DATABASE='--all-databases'
# the following line prefixes the backups with the defined directory. it must be blank or end with a /
S3PATH=mysql_backup/
# when running via cron, the PATHs MIGHT be different. If you have a custom/manual MYSQL install, you should set this manually like MYSQLDUMPPATH=/usr/local/mysql/bin/
@doctorallen
doctorallen / timereport.sh
Last active August 29, 2015 14:13
Run A Time Report
#!/usr/bin/env bash
# You will want to also add the git today command: https://github.com/doctorallen/dotfiles/blob/master/.gitconfig#L49
root=$1
if [ -n "$root"]
then
echo "Error: please define the root directory location for your report."
read root
fi
lastchar=${#root}-1
@doctorallen
doctorallen / filter.php
Created October 2, 2015 16:59
Project Switching Alfred Workflow
require_once('workflows.php');
$wf = new Workflows();
$query = "{query}";
$wf->search($query);
echo $wf->toxml();