Permalink
Browse files

Whole bunch of stuff!

  • Loading branch information...
aziz committed May 7, 2015
1 parent fa4634b commit 17c6920b1795ca8d4e981d475a2c4fd229c5d1cd
@@ -1,9 +1,8 @@
#!/bin/bash
alias edit="$EDITOR"
alias e="$EDITOR"
alias s="subl"
alias edit='$EDITOR'
alias e='$EDITOR'
alias s='subl'
alias v='vim'
alias vi='vim'
alias vim_pristine='vim -u NONE'
@@ -12,3 +11,10 @@ if [ "$(uname)" = "Linux" ]; then
alias s="/usr/bin/subl"
alias subl="/usr/bin/subl"
fi
subl_symlink() {
if [ "$(uname)" = "Darwin" ]; then
ST_APP=$(osascript -e 'tell application "System Events" to POSIX path of (file of process "Sublime Text" as alias)')
ln -sf "$ST_APP/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
fi
}
View
@@ -1,7 +1,6 @@
#!/bin/bash
# colored grep
# export GREP_OPTIONS='--color=auto'
export GREP_COLOR='1;33'
# colored ls
@@ -17,15 +16,7 @@ export LESS_TERMCAP_so=$'\E[38;5;246m' # begin standout-mode - info box
export LESS_TERMCAP_ue=$'\E[0m' # end underline
export LESS_TERMCAP_us=$'\E[04;38;5;146m' # begin underline
# Loading grc (colouriser for beautifying logfiles or output of commands)
# TODO: make it work under linux
if which brew >/dev/null 2>&1; then
if [ -f `brew --prefix grc`/etc/grc.bashrc ]; then
source "`brew --prefix grc`/etc/grc.bashrc"
fi
fi
# Load the theme
if [[ $BASH_THEME ]]; then
source "$BASH/themes/$BASH_THEME.theme.bash"
source "$BASH/themes/$BASH_THEME.theme.bash"
fi
View
@@ -7,9 +7,7 @@ shopt -s histappend
#
# Erase duplicates
# Bash History
export HISTCONTROL="ignoredups"
export HISTCONTROL=erasedups
export HISTCONTROL='ignoreboth'
# resize history size
export HISTSIZE=500000
@@ -1,12 +1,8 @@
### Handy Extract Function
# to use make sure you've installed:
# brew install unrar
# brew install p7zip
#!/bin/bash
# I never remember tar options!
alias targz="tar -cvzf"
extract () {
# Handy Extract Function
# make sure you've installed: brew install unrar p7zip
extract() {
if [ -f "$1" ] ; then
case $1 in
*.tar.bz2) tar xvjf "$1" ;;
@@ -26,3 +22,40 @@ extract () {
echo "'$1' is not a valid file"
fi
}
# Create a .tar.gz archive, using `zopfli`, `pigz` or `gzip` for compression
targz() {
local tmpFile="${@%/}.tar"
tar -cvf "${tmpFile}" --exclude=".DS_Store" "${@}" || return 1
size=$(
stat -f"%z" "${tmpFile}" 2> /dev/null # OS X `stat`
stat -c"%s" "${tmpFile}" 2> /dev/null # GNU `stat`
)
local cmd=""
if (( size < 52428800 )) && hash zopfli 2> /dev/null; then
# the .tar file is smaller than 50 MB and Zopfli is available; use it
cmd="zopfli"
else
if hash pigz 2> /dev/null; then
cmd="pigz"
else
cmd="gzip"
fi
fi
echo "Compressing .tar using \`${cmd}\`"
"${cmd}" -v "${tmpFile}" || return 1
[ -f "${tmpFile}" ] && rm "${tmpFile}"
echo "${tmpFile}.gz created successfully."
}
# Compare original and gzipped file size
gz() {
local origsize=$(wc -c < "$1")
local gzipsize=$(gzip -c "$1" | wc -c)
local ratio=$(echo "$gzipsize * 100 / $origsize" | bc -l)
printf "orig: %d bytes\n" "$origsize"
printf "gzip: %d bytes (%2.2f%%)\n" "$gzipsize" "$ratio"
}
@@ -14,6 +14,12 @@ new_github () {
git push -u origin master
}
git_track_upstream () {
local CURRENT_BRANCH
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
git branch --set-upstream-to="$(git remote | head)"/"$CURRENT_BRANCH" "$CURRENT_BRANCH"
}
git_remove_missing_files () {
git ls-files -d -z | xargs -0 git update-index --remove
}
@@ -1,6 +1,8 @@
#!/bin/bash
export NODE_PATH="/usr/local/lib/node_modules"
export NODE_REPL_HISTORY_FILE="$HOME/.node_history"
export NODE_REPL_HISTORY_SIZE='32768'
npmls() {
npm ls "$@" | grep "^[└├]" | sed "s/─┬/──/g"
View

This file was deleted.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 17c6920

Please sign in to comment.