Skip to content

Instantly share code, notes, and snippets.

View AlexanderRD's full-sized avatar

Alexander Donkin AlexanderRD

View GitHub Profile
@AlexanderRD
AlexanderRD / gist:f929240dca9d0f7016c7
Created November 21, 2014 10:57
Delete all branches that have been merged into current branch
$ git branch --merged | xargs git branch -d
@AlexanderRD
AlexanderRD / gist:dad3583959c1ff3651b4
Created October 7, 2014 14:04
Setting folder and file permissions
To change all the directories to 755 (-rwxr-xr-x):
find /opt/lampp/htdocs -type d -exec chmod 755 {} \;
To change all the files to 644 (-rw-r--r--):
find /opt/lampp/htdocs -type f -exec chmod 644 {} \;
@AlexanderRD
AlexanderRD / gist:f32aff58266f4fdc51df
Created October 6, 2014 13:10
SSH remote folder to local machine with tar compression
ssh [email protected] "tar -zcf - /remote/dir/target/folder --exclude='/remote/dir/target/folder'" > /local-machine/directory/file.tar.gz
// Multiple excludes can be appended!
@AlexanderRD
AlexanderRD / gist:1ef5819bc7e79b6c7252
Created September 29, 2014 12:58
Print out list of all branches with last commit date to the branch, including relative time since commit and color coding.
for k in `git branch|perl -pe s/^..//`;do echo -e `git show --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" $k|head -n 1`\\t$k;done|sort -r
@AlexanderRD
AlexanderRD / gist:199915cf6f2a5bdc78b8
Created September 11, 2014 11:14
Perform mysqldump from remote server to local directory
mysqldump -hServerName.co.za -uUsername -pPassword dataBaseName > /Local/directory/backup_name.sql
@AlexanderRD
AlexanderRD / git-pup.sh
Last active August 29, 2015 14:04
Updating submodules within a local git clone
#!/bin/bash
# Exists to fully update the git repo that you are sitting in...
git pull && git submodule init && git submodule update && git submodule status