Skip to content

Instantly share code, notes, and snippets.

View nedmas's full-sized avatar

Tom Densham nedmas

View GitHub Profile
@nedmas
nedmas / gist:44308410d4f643ea1739
Created January 15, 2016 12:31
SilverStripe SecureAssets Nginx Configuration
location ^~ /assets/ {
sendfile on;
rewrite ^(.*)$ /framework/main.php?url=$1 last;
}
@nedmas
nedmas / secure-silverstripe
Created December 12, 2013 14:27
Simple shell script to set file permissions for a SilverStripe installation.
#!/bin/bash
if [ $# -lt 1 ]
then
echo "Usage : $0 [dir]"
exit
fi
chown -R dev:dev $1
@nedmas
nedmas / gist:6668968
Created September 23, 2013 10:52
Simple bash script to list out the current branch and status of all git repos in sub directories.
#!/bin/bash
GIT=$(which git)
SED=$(which sed)
PATH=${1:-$(pwd)}
for DIR in $PATH/*
do
if [ -d $DIR ]
then
@nedmas
nedmas / secure-magento
Last active December 19, 2015 21:19
Simple shell script to set file permissions for a Magento installation.
#!/bin/bash
if [ $# -lt 1 ]
then
echo "Usage : $0 [dir]"
exit
fi
chown -R dev:dev $1
@nedmas
nedmas / gist:5803636
Created June 18, 2013 08:33
Fix MongoDb on Ubuntu
# Manually remove the lockfile:
sudo rm /var/lib/mongodb/mongod.lock
# Run the repair script:
sudo -u mongodb mongod -f /etc/mongodb.conf --repair
# Run the MongoDb server:
sudo service mongodb start
# Check the MongoDb server status:
@nedmas
nedmas / gist:3275932
Created August 6, 2012 15:59
Manually create Silverstripe 3 site
git clone https://github.com/silverstripe/silverstripe-installer.git public
git checkout 3.0
rm -rf .git/
git remote add upstream https://github.com/silverstripe/silverstripe-installer.git
git flow init -d
@nedmas
nedmas / .gitignore
Created July 12, 2012 15:15
Git Ignore List for a Silverstripe 2.4 Install
assets/*
!assets/.htaccess
!assets/error-404.html
!assets/error-500.html
!assets/web.config
_ss_environment.php
tools/phing-metadata
@nedmas
nedmas / gist:3060155
Created July 6, 2012 13:30
Script to force enable color prompt on Ubuntu and other Linux distros.
#!/bin/bash
# Get the path for the .bashrc file from the prompt or set it as being in the users home dir.
BASHRC="${1:=~/.bashrc}"
# Use sed to remove the comment from the force color line in the .bashrc file.
sed -i 's/#force_color_prompt=yes/force_color_prompt=yes/g' $BASHRC
# BONUS: Uncomment to change the default color of the prompt.
#sed -i 's/1;32m/1;31m/g'
@nedmas
nedmas / gist:3054247
Created July 5, 2012 15:08
Sql script for removing all sales and customer data from a Magento site.
# Magento CE 1.4.1.1
# Be sure to replace "" with your table prefix
SET FOREIGN_KEY_CHECKS=0;
##############################
# SALES RELATED TABLES
##############################
TRUNCATE `sales_flat_creditmemo`;
TRUNCATE `sales_flat_creditmemo_comment`;
@nedmas
nedmas / Message.php
Created June 20, 2012 15:23
Message class for FuelPHP by Frank de Jonge (FrenkyNet)
<?php
abstract class Message
{
protected static $messages = array();
public static function get($key, $default = null)
{
$return = \Arr::get(static::$messages, $key, $default);
\Arr::delete(static::$messages, $key);