Skip to content

Instantly share code, notes, and snippets.

@freetonik
Created November 23, 2017 10:36
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 freetonik/5d900dcd3368db89cc1cef765cb61dcc to your computer and use it in GitHub Desktop.
Save freetonik/5d900dcd3368db89cc1cef765cb61dcc to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
export LANGUAGE='en_US.UTF-8' && export LC_ALL='en_US.UTF-8'
unset MAILCHECK
# NAV
alias ls='ls -G'
alias la="ls -la"
alias ll="ls -la"
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias cls='clear'
alias o='open .'
# GIT
alias gs='git status'
alias ga='git add .'
alias gadd='git add'
alias gcm='git commit -v -m'
alias gb='git branch'
alias gl="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative"
alias gdiff='git diff'
alias gpmas='git push origin master'
alias gpr='git pull --rebase'
gitapush() {
if [ $# -eq 0 ];
then
echo "Enter message: "
read message
else
message=$1
fi
git add .
git commit -m "$message"
git push origin master
}
# JEKYLL
alias js='bundle exec jekyll serve --watch'
jposten() {
if [ $# -eq 0 ];
then
echo "Where is the title?!"
else
jekyll_post ~/code/hello.rakh.im $1
fi
}
jpost() {
if [ $# -eq 0 ];
then
echo "Where is the title?!"
else
jekyll_post ~/code/rakh.im $1
fi
}
jekyll_post() {
ptitle=${2// /-} # convert spaces in title to hyphens
plc=`echo "$ptitle" | tr '[:upper:]' '[:lower:]'` # convert title to lowercase
pdate=`date +%Y-%m-%d`
filename=$1/_posts/$pdate-$plc.md
touch $filename
cd $1
echo "---
layout: post
title:
category: Notes
cover_url: \"\"
---" > $filename
open -a "Google Chrome" http://127.0.0.1:4000/
subl $filename
js
}
# VAGRANT
alias vup='vagrant up'
alias vsu='vagrant suspend'
# ImageMagick
pdftopng() {
if [ $# -eq 0 ];
then
echo "usage: pdftopng IN.pdf OUT.png density[120] quality[95] shave_x[100] shave_y[100]"
else
convert -density ${3:-120} -quality ${4:-95} -background white -alpha remove -shave ${5:-100}x${6:-100} "$1" -append "$2"
fi
}
# ETC
alias s='subl .'
alias c='code .'
alias halp='cat ~/.bash_profile'
alias bashreload='source ~/.bash_profile'
ia() { if [ -z "$1" ]; then echo "No file specified."; else if [ -f "$1" ]; then open -a "iA Writer" "$1"; else touch "$1.md"; open -a "iA Writer" "$1.md"; fi fi }
source $HOME/.bash_theme
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment