Skip to content

Instantly share code, notes, and snippets.

View eresende's full-sized avatar

Eusebio Resende eresende

  • NuoDB/3DS
  • Dublin, Ireland
View GitHub Profile
@eresende
eresende / php-switch
Last active August 29, 2015 14:02
Script to switch between multiple versions of PHP on your Mac OS X ML Homebrew
#!/bin/bash
# php switch for homebrew
# $ brew tap josegonzalez/php && brew install php53 --with-mysql && brew install php54 --with-mysql && brew install php55 --with-mysql
# Might as well ask for password up-front, right?
sudo -v
if [[ $1 == 5.5 ]]; then
ln -sf `brew list php55 | grep libphp` /usr/local/lib/libphp5.so
@eresende
eresende / copyfiles.sh
Last active August 29, 2015 14:02
Copy files with specific pattern and maintain directory structure
rsync -avr --exclude '*.ext.php' --include '*/' --include 'pt_PT.*' --exclude '*' --prune-empty-dirs ~/source ~/dest
@eresende
eresende / gist:8c8584a305877c162550
Last active August 29, 2015 14:04
Show Git log entries that belong to me, between dates and exclude merges
git log --author=Eusebio --since='2014-07-22' --until='2014-07-26' --pretty=format:"%ad%x09%s" --abbrev-commit --no-merges
@eresende
eresende / imap.php
Created September 26, 2014 15:32
Test IMAP connection
<?php
$mail_server = "mail.example.com" ;
$mail_username = "[email protected]" ;
$mail_password = "a very long and unbreakable password" ;
$mail_port = 143 ;
$mail_folder = 'INBOX';
echo "<h1>".$mail_username." on ".$mail_server."</h1>\n\n" ;
@eresende
eresende / add_swap.sh
Last active August 29, 2015 14:08
Add swap file
#! /bin/bash -ex
/bin/dd if=/dev/zero of=/var/swapfile.1 bs=1M count=4096
/sbin/mkswap /var/swapfile.1
chmod 600 /var/swapfile.1
/sbin/swapon /var/swapfile.1
echo "/var/swapfile.1 swap swap defaults 0 0" >> /etc/fstab
@eresende
eresende / yosemite-install-usb
Last active August 29, 2015 14:14
Command to create Yosemite Install USB pen drive
sudo "/Applications/Install OS X Yosemite.app/Contents/Resources/createinstallmedia" --volume /Volumes/Untitled --applicationpath "/Applications/Install OS X Yosemite.app" --nointeraction
@eresende
eresende / druis
Last active August 29, 2015 14:14
Docker :: Remove Untagged Images
docker rmi $(docker images | grep '^<none>' | awk '{print $3}')
@eresende
eresende / clear-ssh-hosts.sh
Last active August 29, 2015 14:14
Clear dockerhost ssh connections from known_hosts file
sed -i -e '/\[dockerhost\]\:49/d' ~/.ssh/known_hosts
@eresende
eresende / tail-php-error.sh
Created February 10, 2015 03:30
Tail php error log with line breaks
#!/bin/bash
tail -f /var/log/httpd/error_log | sed "s/\\\n/\\n/g"
@eresende
eresende / import_gzip_database.sh
Created February 10, 2015 16:36
Import gziped mysql dump file
gunzip < DUMP_FILE.sql.gz | mysql --user=DB_USER --password DB_NAME