Skip to content

Instantly share code, notes, and snippets.

View davidbehan's full-sized avatar

David Behan davidbehan

View GitHub Profile
@davidbehan
davidbehan / git-snippets
Last active December 17, 2015 05:49
Handy set of commands for Git
# Handy commands
git remote show origin
# Removes .DS_store from Git Repo
find . -name .DS_Store -print0 | xargs -0 git rm --ignore-unmatch
# Archive/Export
git archive master | tar -x -C /somewhere/else
git archive master | bzip2 >source-tree.tar.bz2
git archive --format zip --output /full/path/to/zipfile.zip master
@davidbehan
davidbehan / sql-snippets
Created May 11, 2013 16:54
Some SQL commands I use every now and then, in current state or modified versions
# SQL Like Usage
# - - - - - - - - - - - - - - - - - - - - - - - - - -
SELECT * FROM asdf WHERE asdf LIKE 'asdf%';
UPDATE asdf
SET asdf = ""
WHERE asdf LIKE '/images/uploads/asdf%';
UPDATE asdf
SET asdf = replace(asdf,'/images/uploads/logos/cropped/ready/','/images/uploads/logos/')
@davidbehan
davidbehan / ssh-snippets
Last active December 17, 2015 05:49
Snippets I use in command line or SSH
# common ssh tasks
# - - - - - - - - - - - - - - - - - - - - - - - - - -
zip -r filename.zip *
chown -R username *
chgrp -R group *
rm -rf *
chmod -R 777 uploads/
scp -r localfolder remotefolder
df -h # disk space
du -sh /var/ # disk space by folder
@davidbehan
davidbehan / ee-coding-snippets
Last active December 20, 2015 14:29
Quick access to common coding snippets used in EE
# EE Hacksaw
# - - - - - - - - - - - - - - - - - - - - - - - -
{exp:eehive_hacksaw chars="100" append="…" allow=""}{news_excerpt}{/exp:eehive_hacksaw}
# CE Img
# - - - - - - - - - - - - - - - - - - - - - - - -
@davidbehan
davidbehan / sublime-regex-searches
Created August 29, 2013 11:19
Some regex I use when searching csv, text, html, php files in Sublime Text
# Find non alpha numberic characters, excluding _.,-
[^a-zA-Z\d\s_.,-]
# Find single tag only
html - <html\b[^>]*>
div - <div\b[^>]*>
span - <span\b[^>]*>
font - <font\b[^>]*>
xml namespace - <\?xml\b[^>]*>
xml namespace - <!--\?xml\b[^>]*>
@davidbehan
davidbehan / atmail-exim-commands
Created September 3, 2013 21:14
Some atmail/exim commands for searching and managing the message queue
# start/stop/restart atmail
/etc/init.d/atmailserver start
/etc/init.d/atmailserver stop
/etc/init.d/atmailserver restart
# count of messages in queue
/usr/local/atmail/mailserver/bin/exim -bpc
# list of messages in queue
/usr/local/atmail/mailserver/bin/exim -bp
@davidbehan
davidbehan / install-multiple-php-in-plesk
Last active December 17, 2015 15:54
Script for installing multiple php versions in plesk 11.5
# FROM: http://forum.parallels.com/showthread.php?290399-Plesk-11-5-Easy-Install-Script-for-Multiple-PHP-CentOS-6-4-x64
yum -y install gcc make gcc-c++ cpp kernel-headers.x86_64 libxml2-devel openssl-devel bzip2-devel libjpeg-devel libpng-devel freetype-devel openldap-devel postgresql-devel aspell-devel net-snmp-devel libxslt-devel libc-client-devel libicu-devel gmp-devel curl-devel libmcrypt-devel unixODBC-devel pcre-devel sqlite-devel db4-devel enchant-devel libXpm-devel mysql-devel readline-devel libedit-devel recode-devel libtidy-devel
phpconfigureflagscommon="--with-libdir=lib64 --cache-file=./config.cache --prefix=/usr/local/php-\$phpversion-\$phptype --with-config-file-path=/usr/local/php-\$phpversion-\$phptype/etc --disable-debug --with-pic --disable-rpath --with-bz2 --with-curl --with-freetype-dir=/usr/local/php-\$phpversion-\$phptype --with-png-dir=/usr/local/php-\$phpversion-\$phptype --enable-gd-native-ttf --without-gdbm --with-gettext --with-gmp --with-iconv --with-jpeg-dir=/usr/local/php-\$ph