Skip to content

Instantly share code, notes, and snippets.

# add to .gitconfig
[alias]
lg1 = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
lg = !"git lg1"
@dearaujoj
dearaujoj / gist:2f53b9e34869e9787b2c
Created October 27, 2014 16:47
How to list files sorted by modification date recursively
#Change 1n,1 to 1nr,1 if you want the files listed most recent first.
find . -printf '%T@ %c %p\n' | sort -k 1n,1 -k 7 | cut -d' ' -f2-
@dearaujoj
dearaujoj / delete-local-and-remote-tags
Created November 17, 2014 13:33
delete local and remote Git tags programatically
#check tag with specific value
for i in 2013 ; do git tag -l | grep "$i" ; git ls-remote --tags origin | awk '{print ":"$2}' | grep "$i" | grep -v '{}' ; done
#delete local and remote tag with specific value
for i in 2013 ; do git tag -l | grep "$i" | xargs git tag -d ; git ls-remote --tags origin | awk '{print ":"$2}' | grep "$i" | grep -v '{}' | xargs git push origin ; done
#credits http://anavarre.net/2014/01/07/delete-local-and-remote-git-tags-programatically
sshfs username@hostname:/remote/directory/path /local/mount/point -ovolname=NAME
@dearaujoj
dearaujoj / gist:2663082
Created May 11, 2012 23:29 — forked from anonymous/gist:2388015
iOS fix for iframe cropping
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
if (/iPhone|iPod|iPad/.test(navigator.userAgent))
$('iframe').wrap(function(){
var $this = $(this);
return $('<div />').css({
width: $this.attr('width'),
height: $this.attr('height'),
overflow: 'auto',
@dearaujoj
dearaujoj / Phantom_UA.sql
Created July 24, 2012 15:02
Universal importer sample
DECLARE
v_GroupName varchar2(200);
BEGIN
v_GroupName := 'Phantom0B';
Delete From uax_import_instances
Where GroupName = v_GroupName;
Delete From uax_import_properties
Where GroupName = v_GroupName;
@dearaujoj
dearaujoj / git-clean.txt
Created December 3, 2012 11:14
git clean command
remove files git clean -f
remove directories, run git clean -f -d.
remove ignored files, run git clean -f -X.
remove ignored as well as non-ignored files, run git clean -f -x.
Note the case difference on the X for the two latter commands.
Unless you specify -f and clean.requireForce is set to "true" (the default) in your configuration, nothing will actually happen, with a recent enough version of git.
#Remove files from quarantine recursively
xattr -d -r com.apple.quarantine ./Folder
@dearaujoj
dearaujoj / gist:5661536
Created May 28, 2013 09:12
Push a local branch to a different remote branch
git push remote local_branch:remote_branch
@dearaujoj
dearaujoj / MemoryAll
Created October 17, 2013 08:41
Total amount of memory used by the various process running on Linux
ps -eo size,pid,user,command --sort -size | awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' | awk '{total=total + $1} END {print total}'