Skip to content

Instantly share code, notes, and snippets.

Sam Doidge samdoidge

Block or report user

Report or block samdoidge

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Lazy load Disqus comments.js
* <div class="comments"></div>
var comments = document.getElementsByClassName('comments')[0],
disqusLoaded = false;
function loadDisqus() {
samdoidge /
Last active Nov 22, 2016
Setup a DigitalOcean LAMP 16.04 image ready for Laravel. Creates a swap file, generates ssh key, installs required packages and composer.
# Run with the following:
# curl -s | bash -s 1g
# Last argument is swapfile size. 1g = 1 gigabyte.
set -e
sudo fallocate -l $1 /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
samdoidge /
Last active Sep 6, 2016
Recursively loop through a direcctory, cutting files down to 11 lines maximum - creating a new file of the same name in a Test folder.
for file in *; do head -n 11 "$file" > ../Test/"$file"; done
samdoidge / gist:2912c4b4e8690e79097f
Created May 19, 2014
If CodeIgniter gives 'No input file specified'
View gist:2912c4b4e8690e79097f
check permissions on folder - chown'ing to plesk user
samdoidge / gist:fb880394887490b7ea4d
Last active Aug 29, 2015
locate: can not open `/var/lib/mlocate/mlocate.db': No such file or directory
View gist:fb880394887490b7ea4d
sudo updated
to fix
View gist:0594a8429d2ded5094f2
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^$ [NC]
RewriteRule ^(.*)$$1 [R=301,L]
samdoidge / content
Created Apr 28, 2014
Copy without SVN files
View content
rsync -avzr --exclude=.svn /dir/ /dir-copy/
samdoidge / grep-exclude-file-extension
Created Oct 11, 2013
grep exclude file extension, recursively search through current directory
View grep-exclude-file-extension
grep -r --exclude '*.sql' 'search string' .
samdoidge / grep-file-extension
Last active Dec 25, 2015
grep recursively through the current folder with a specific file extension
View grep-file-extension
grep -r --include="*.php" "search string" .
You can’t perform that action at this time.