Skip to content

Instantly share code, notes, and snippets.

@ambroiseRabier
Created May 10, 2019 17:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ambroiseRabier/bcc51060feeb0e1e9fb13de6e306ab9d to your computer and use it in GitHub Desktop.
Save ambroiseRabier/bcc51060feeb0e1e9fb13de6e306ab9d to your computer and use it in GitHub Desktop.
export HISTTIMEFORMAT="%d/%m/%y %T "
alias gs='git status'
alias gsc='clear && git status'
alias glns='git log --name-status'
alias gpullos='git pull origin $(git rev-parse --abbrev-ref HEAD)' # s for self
alias gpushos='git push origin $(git rev-parse --abbrev-ref HEAD)' # s for self
alias gitfuckit='git checkout -- . && git clean -fd'
# find big files in dir (-h for human readable)
alias findBigFiles='du -a -h --max-depth=1 | sort -hr'
#alias doesn't take parameters
#function trash() { mv "$@" ~/.Trash; }, huuum
function gc() { git checkout $@; }
function gb() { git branch $@; }
function gf() { git diff $@; }
function gl() { git log --graph --decorate $@; }
function gpullo() { git pull origin $@; }
function gpusho() { git push origin $@; }
function gQuickBlame() { git log --name-status --follow $1; } # or use -p instead of name-status for diff
alias ghelp='cat ~/.bash_profile'
#ssh
alias start_ssh='eval $(ssh-agent -s)'
alias ssh_isart='eval $(ssh-agent -s) && ssh-add ~/.ssh/id_rsa_isart'
alias ssh_github='eval $(ssh-agent -s) && ssh-add ~/.ssh/pcFixeGithub'
alias ssh_gitlab='eval $(ssh-agent -s) && ssh-add ~/.ssh/gitlab-desktop'
alias ssh_VPS='eval $(ssh-agent -s) && ssh-add ~/.ssh/ovh_VPS'
# do not seem to work with alias ?
#alias create_ssh_key= 'cd ~/.ssh/ && ssh-keygen -t rsa -b 4096 -C "<mail>"'
#image magick
# open window do to transformation trough UI
function openImageMagick() { magick $1 win:; }
function magickNegate() {
local fullfilename=$1;
local extension="${fullfilename##*.}";
local filename="${fullfilename%.*}";
magick $1 -negate "${filename}_negated.${extension}";
}
function magickToGray() {
local fullfilename=$1;
local extension="${fullfilename##*.}";
local filename="${fullfilename%.*}";
magick $1 -colorspace LinearGray "${filename}_gray.${extension}";
}
# add transparent background bellow image, carefull it modify the image directly
# filename, size
# blabla.png 50x100
function magickExtends() {
convert $1 -background none -gravity Center -extent $2 $1;
}
# http://www.imagemagick.org/Usage/resize/#adaptive-resize
function newLearnDir() {
local str="$@";
mkdir "${str}";
mkdir "${str}/src";
touch "$str/$str.md"
}
function newProjectDir() {
local str="$@";
mkdir "${str}";
mkdir "${str}/src";
touch "${str}/${str}_Brainstorm.md"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment