Skip to content

Instantly share code, notes, and snippets.

View deanrather's full-sized avatar

Dean Rather deanrather

View GitHub Profile
@deanrather
deanrather / db-backup-script.sh
Last active October 5, 2015 16:48
Automated MySQL Backup & Revision with Git
#!/bin/bash -e
# This script will sqldump your database into a git repo
# If the sqldump is different from the existing one, it will git-push to the remote origin
# Replace <user>, <pass>, <db>, <git-repo> below with your database' details
# If you want this to automatically run every minute:
#
# crontab -e
# * * * * * /dir/to/script/db-backup-script.sh
#
DBHOST=localhost
{
"installed_packages":
[
"Alignment",
"All Autocomplete",
"Case Conversion",
"DocBlockr",
"Function Name Display",
"GitGutter",
"Google Search",
@deanrather
deanrather / Keyboard Shortcuts.md
Last active October 10, 2017 00:47
Keyboard Shortcuts (Sublime, Gmail, Chrome, Bash)

Sublime Text

ctrl+shift          Search for command
    reindent        Reindent Selection
    sort            Sort Lines
    space           Convert indentation to spaces
ctrl+p              Jump to file ( `:<n>` jump to line)
ctrl+;              Jump to keyword in file
ctrl+k,b            Hide/show Sidebar

alt+shift+ Split window into views

@deanrather
deanrather / DNS Setup.md
Last active October 6, 2015 11:27
DNS Setup

DNS Setup

install webmin (wget from site and dpkg)
change root password
alter AWS security to open port
login with new user/pass
go to 'un-ised modules' -> BIND DNS -> download / install using webmin
go to BIND
create new master zone ->

enter into 'domain name / network' the domain name, eg. deanrather.com

@deanrather
deanrather / InstanceTracker.js
Created July 3, 2012 03:40
JSKK Instance Tracker
$JSKK.Class.create
(
{
$namespace: 'helper',
$name: 'InstanceTracker'
}
)
(
// Static Block
{
@deanrather
deanrather / BaseClass.js
Created July 3, 2012 03:46
JSKK Base Class
/**
* Provides get and set functions, which store properties into the _properties object.
*/
$JSKK.Class.create
(
{
$namespace: 'helper',
$name: 'BaseClass'
}
)
_ = require('underscore');
/**
* Changes a string like "hello world" to "Hello world"
*/
_.ucFirst = function(str)
{
if(typeof str != 'string') throw new Error("Non-string provided");
@deanrather
deanrather / configure-website.sh
Created July 12, 2012 03:55
NginX -- Add site to configuration script
#!/bin/bash
#
# usage: sudo configure-website.sh mydomain.com
# Creates the folder to put your site in, creates a nginx config (from a template),
# links it, and restarts nginx
#
# This script makes some assumptions, check / modify before using!!
# - Your websites are stored in /var/www/ and each contain a public/ folder
# - you have a 'template' file in /etc/nginx/sites-available
# - the 'template' file has the key word 'DOMAIN' (which is to be replaced by this script)
@deanrather
deanrather / post-receive.sh
Created September 11, 2012 10:45
example git post-receive hook determining which branch was pushed
#!/bin/bash
echo "determining branch"
if ! [ -t 0 ]; then
read -a ref
fi
IFS='/' read -ra REF <<< "${ref[2]}"
branch="${REF[2]}"
@deanrather
deanrather / nutshell.php
Created September 11, 2012 12:59
redPHP Nutshell Plugin
<?php
// Nutshell Bootstrap
if(!defined('NUTSHELL_DIR'))
{
define('NUTSHELL_DIR', APP_DIR.'/../lib/nutshell/');
define('NUTSHELL_APP_DIR', APP_DIR.'/../nutshell-application');
function bootstrap()
{