Skip to content

Instantly share code, notes, and snippets.

View nicka101's full-sized avatar

Nick Anstee nicka101

  • Anstee Development
  • Norway
View GitHub Profile
@nicka101
nicka101 / nginx
Created June 16, 2015 09:24
Nginx init script
#!/bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $local_fs $remote_fs $network $syslog $named
# Required-Stop: $local_fs $remote_fs $network $syslog $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
@nicka101
nicka101 / backup-orders.php
Last active September 10, 2015 09:36
Backup utilities for Magento
<?php
if(count($argv) < 4){
echo "No database credentials supplied\n";
exit(1);
}
$username = $argv[1];
$password = $argv[2];
$db = $argv[3];
@nicka101
nicka101 / table_dependents.sql
Last active August 29, 2015 14:08
Return a list of tables which depend on the specified table
CREATE PROCEDURE table_dependents
(
IN tbl_name varchar(255)
)
BEGIN
CREATE TEMPORARY TABLE tbl_dependents_processing(
table_name varchar(255) PRIMARY KEY NOT NULL
)ENGINE=MEMORY;
INSERT INTO tbl_dependents_processing SELECT DISTINCT TABLE_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE REFERENCED_TABLE_NAME = tbl_name;