Skip to content

Instantly share code, notes, and snippets.

View bajanReece's full-sized avatar

Maurice Roach bajanReece

View GitHub Profile
@bajanReece
bajanReece / wget_file_downloader.sh
Created August 20, 2016 22:53
WGET for downloading specific file types
wget -A gif,jpeg,jpg -r --random-wait -t 5 -T 20 -nc -m -p -E -k -K -H http://www.website.com/
@bajanReece
bajanReece / Site downloader
Last active August 29, 2015 14:04
A bash script to download entire web paths using wget and sed.
#!/bin/bash
# First up let's create the save path if it doesn't exist
LOCAL_PATH=~
SAVE_PATH="$LOCAL_PATH/downloaded_sites"
# Next we need to sanitize our input. We want the user to be able to add
# naturally formated URLs, this means we need to be able to accept:
# http://www.somedomain.com
# www.somedomain.com
# somedomain.com
# If the user does not supply www. we should not assume www. we should accept the
@bajanReece
bajanReece / cron task for mysqldump with file name as day number
Created June 1, 2014 21:23
Cron task to do a mysqldump and then name the output as the day (number) of the week
10 23 * * * /usr/local/mysql/bin/mysqldump --add-drop-table -u My_User_Name -pSuperDuperPassword myAwesomDB > "/path/to/database_backups/myAwesomDB_"`date +\%u`.sql
@bajanReece
bajanReece / gist:9386944
Created March 6, 2014 10:27
Install PhantomJS and CasperJS on Ubuntu 12.04
# First install PhantomJS
cd /usr/local/share
sudo wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-x86_64.tar.bz2
sudo tar jxvf phantomjs-1.9.7-linux-x86_64.tar.bz2
sudo ln -s /usr/local/share/phantomjs-1.9.7-linux-x86_64 /usr/local/share/phantomjs
sudo ln -s /usr/local/share/phantomjs/bin/phantomjs /usr/local/bin/phantomjs
# Test that PhantomJS is installed and working
which phantomjs
# should produce:
@bajanReece
bajanReece / gist:9386424
Created March 6, 2014 09:54
Installing NodeJS and NPM on Ubuntu
sudo apt-get update
sudo apt-get install -y python-software-properties python g++ make
sudo add-apt-repository -y ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
@bajanReece
bajanReece / quick-lamp-setup
Created February 25, 2014 16:26
Quick LAMP setup
# 1. Install Apache
sudo apt-get -y install apache2
# 2. Install MySQL, you'll be asked for a root password
sudo apt-get -y install mysql-server mysql-client
# 2.1. the next step is optional, but it tidies things up and secures your db installation
sudo mysql_secure_installation
# 3. Install PHP
sudo apt-get -y install php5 libapache2-mod-php5 php-pear php5-cli php5-mysql php-apc php5-adodb php5-imagick php5-gd php5-mcrypt php5-memcache php5-memcached php5-curl php5-dev
@bajanReece
bajanReece / gist:5195434
Created March 19, 2013 11:37
Getting Taxonomy content from a Drupal node.
<?php
function get_taxonomy_content($tid, $limit = 10) {
/**
A note on variables:
field_data_field_article_rating --- this is the name of taxonomy table you're referring to
field_article_rating_tid --- this is the name of the term ID column in the table above
**/
$out = array();
@bajanReece
bajanReece / gist:5186538
Last active February 26, 2016 01:43
How to programatically create new content with Concrete5
<?php
$my_page_type = 'php_news';
$parent_path = '/languages/php/news';
$hide_from_nav = TRUE;
$parent = Page::getByPath($parent_path);
/**
* Let's pretend the title and description have been set by POST values
* and added to the variables $title, $description and $content