Last active
October 29, 2019 15:38
-
-
Save peledies/155272dbc1aa0ec43bf95eb133977a71 to your computer and use it in GitHub Desktop.
Bash Profile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##### Deacs aliases ########### | |
alias dc='docker-compose' | |
alias dcl='docker-compose logs' | |
alias diff="diff -w" | |
alias chrome='open -a "Google Chrome" --args --aggressive-cache-discard --disable-cache --disable-application-cache --disable-offline-load-stale-cache --disk-cache-size=0' | |
alias chromeNoSSL='open -a "Google Chrome" --args --cipher-suite-blacklist=0x0088,0x0087,0x0039,0x0038,0x0044,0x0045,0x0066,0x0032,0x0033,0x0016,0x0013' | |
alias migritcycle="migrit down -d local; migrit up -d local; migrit import -d local" | |
alias slkr="node ~/Projects/slackr/index.js | ~/Projects/message-top/message-top.sh &" | |
alias serve="php -S localhost:8000 & open -a '/Applications/Google Chrome.app' 'http://localhost:8000'" | |
alias pa="php artisan" | |
alias pao="php artisan optimize" | |
alias taglog="git for-each-ref --format '%(refname) %09 %(taggerdate) %(*subject) %(taggeremail)' refs/tags --sort=taggerdate" | |
alias la="ls -lah" | |
alias dnsnuke="dscacheutil -flushcache; sudo killall -HUP mDNSResponder" | |
alias say="say -v tessa" | |
alias r="echo rsync -avz -O --no-perms --dry-run --checksum -e \'ssh -p 424\' ./source/ beyondthevineind@four.sfp.net:/dest/" | |
alias cda="composer dump-autoload" | |
#### Vagrant Aliases ########### | |
alias vs="vagrant status" | |
alias vgs="vagrant global-status" | |
alias vgsr="vagrant global-status | grep running" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
green=$(tput setaf 2) | |
gold=$(tput setaf 3) | |
magenta=$(tput setaf 5) | |
cyan=$(tput setaf 6) | |
red=$(tput setaf 1) | |
default=$(tput sgr0) | |
# run a command in every child directory relative to your CWD | |
unset -f sub | |
function sub { | |
for d in ./*/ ; do (cd "$d" && $1 &); done | |
} | |
export -f sub | |
git_repo(){ | |
git rev-parse --show-toplevel > /dev/null 2>&1 | |
if [ "$?" = "0" ]; then | |
echo " [$(basename `git rev-parse --show-toplevel`)]$(__git_ps1)$(git_dirty_status)" | |
fi | |
} | |
git_dirty_status(){ | |
git rev-parse --show-toplevel > /dev/null 2>&1 | |
if [ "$?" = "0" ];then | |
D=$(git status --porcelain | wc -l) | |
if [ $D -ne 0 ]; then | |
echo -en "${green}[${red}✗${green}]${default}" | |
else | |
echo -en "${green}[✓]${default}" | |
fi | |
fi | |
} | |
unset -f pullprofile | |
function pullprofile(){ | |
read -p "${cyan}Overwrite existing ~/.bash_profile? [y/n]${gold} " -n 2 -r | |
if [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
echo ${default} | |
curl https://gist.githubusercontent.com/peledies/155272dbc1aa0ec43bf95eb133977a71/raw/.bash_profile \ | |
-o ~/.bash_profile | |
fi | |
read -p "${cyan}Overwrite existing ~/.bash_aliases? [y/n]${gold} " -n 2 -r | |
if [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
echo ${default} | |
curl https://gist.githubusercontent.com/peledies/155272dbc1aa0ec43bf95eb133977a71/raw/.bash_aliases \ | |
-o ~/.bash_aliases | |
fi | |
read -p "${cyan}Overwrite existing ~/.bash_functions? [y/n]${gold} " -n 2 -r | |
if [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
echo ${default} | |
curl https://gist.githubusercontent.com/peledies/155272dbc1aa0ec43bf95eb133977a71/raw/.bash_functions \ | |
-o ~/.bash_functions | |
fi | |
} | |
export -f pullprofile | |
unset -f mirror | |
function mirror(){ | |
if [ -z "$1" ];then | |
echo "${red}You must specify a URL to create a mirror from.${default}" | |
else | |
echo "${cyan}Creating new site mirror for ${red}$1${default} project in ${magenta}`pwd`/$1 ${default}" | |
wget --mirror --convert-links --adjust-extension --page-requisites --no-parent $1 -P ./ | |
fi | |
} | |
export -f mirror | |
unset -f webencode | |
function webencode(){ | |
# Install ffmpeg with the following | |
# brew install ffmpeg --with-theora --with-libvorbis --with-fdk-aac --with-libvpx | |
if [ -z "$1" ];then | |
echo "${red}You must specify a file to encode.${default}" | |
fi | |
if [ -z "$2" ];then | |
echo "${red}You must specify an output name.${default}" | |
fi | |
if [ -z "$3" ];then | |
echo "${red}You must specify an output bitrate ie. [1000k].${default}" | |
fi | |
if [ -n "$1" ] && [ -n "$2" ] && [ -n "$3" ];then | |
echo "${cyan}Creating new web versions of ${red}$1${default} video in ${magenta}`pwd`/$1 ${default}" | |
ffmpeg -i $1 -codec:v libtheora -qscale:v 7 -codec:a libvorbis -qscale:a 5 $2.ogv | |
ffmpeg -i $1 -c:v libvpx -qmin 0 -qmax 50 -an -crf 5 -b:v $3 -c:a libvorbis $2.webm | |
ffmpeg -i $1 -c:v libx264 -an -b:v $3 $2.mp4 | |
fi | |
} | |
export -f webencode | |
unset -f metax | |
function metax(){ | |
if [ -z "$1" ];then | |
echo "${red}You must specify a file or wildcard to strip meta data from.${default}" | |
else | |
for file in "$@" | |
do | |
echo "${cyan}Removing meta data from $file ${default}" | |
exiftool -preserve -overwrite_original_in_place -all= "$file" | |
done | |
fi | |
} | |
export -f metax | |
unset -f optimize | |
function optimize(){ | |
# Install jpegoptim | |
# brew install jpegoptim optipng | |
DIRECTORY=optimzed | |
if [ ! -d "$DIRECTORY" ]; then | |
mkdir optimized | |
fi | |
# for f in *.png | |
# do | |
# echo "${f%%.*}" | |
# convert $f -sample 1920x -quality 80 ./optimized/"${f%%.*}".jpg ; done | |
# done | |
echo "${cyan}Optimizing all jpg files in your current directory ${magenta}`pwd`/$DIRECTORY ${default}" | |
#cp -a *.jpg ./${DIRECTORY} | |
#cp *.png $DIRECTORY | |
#find ./$DIRECTORY -type f -name "*.jpg" -exec jpegoptim -m70 --strip-all {} \; | |
#find /path/to/pngs/ -type f -name "*.png" -exec optipng -o2 {} \ | |
} | |
export -f optimize | |
unset -f btmax | |
function btmax(){ | |
echo "${cyan}Increasing the bluetooth Bitpool to increase quality and range ${default}" | |
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Max (editable)" 80 | |
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" 48 | |
defaults write com.apple.BluetoothAudioAgent "Apple Initial Bitpool (editable)" 40 | |
defaults write com.apple.BluetoothAudioAgent "Apple Initial Bitpool Min (editable)" 40 | |
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool" 58 | |
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool Max" 58 | |
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool Min" 48 | |
sudo killall coreaudiod | |
} | |
export -f btmax | |
unset -f pdf2html | |
function pdf2html(){ | |
# Install pdf2htmlEX | |
# brew install pdf2htmlEX | |
echo "${cyan}Converting all PDF files in your current directory ${magenta}`pwd`/$DIRECTORY ${default}" | |
DIRECTORY=html | |
if [ ! -d "$DIRECTORY" ]; then | |
mkdir html | |
fi | |
for file in "$@" | |
do | |
echo $DIRECTORY"/$file.html" | |
pdf2htmlEX --process-outline 0 "$file" $DIRECTORY"/$file.html" | |
done | |
} | |
export -f pdf2html | |
unset -f svg2icon | |
function svg2icon(){ | |
binCheck 'rsvg-convert' 'librsvg' | |
filename=$(basename "$1") | |
filename="${filename%.*}" | |
store=$filename-icons | |
mkdir $store > /dev/null 2>&1 | |
for RES in 16 32 57 60 72 96 114 120 144 152 180 192 | |
do | |
echo "${RES}x${RES}" | |
rsvg-convert -w $RES -h $RES $1 -o "${filename}-icons/icon-${RES}x${RES}.png" | |
done | |
} | |
export -f svg2icon | |
unset -f binCheck | |
function binCheck(){ | |
INSTALL=${2:-$1} | |
if hash $1 2>/dev/null; then | |
echo "" | |
else | |
echo -e "\n${red}$1 not found.\n${default}run '${cyan}brew install $INSTALL${default}'" | |
kill -INT $$ | |
fi | |
} | |
export -f binCheck |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export CLICOLOR=1 | |
export LSCOLORS=GxFxCxDxBxededabagadad | |
# LSCOLORS generator http://geoff.greer.fm/lscolors/ | |
export PATH=/usr/local/bin:/usr/local/share/npm/bin:$PATH | |
# set the tab names for osx to the pwd | |
PROMPT_COMMAND='echo -ne "\033]0;${PWD##*/}\007"' | |
#Git configuration stuff | |
source ~/settings/system/git-completion.bash | |
source ~/settings/system/git-prompt.sh | |
#Editor config | |
EDITOR='vi' | |
export EDITOR | |
VISUAL='vi' | |
export VISUAL | |
export PS1='\[\033[01;33m\]\u@\h\[\033[00m\]:\[\033[01;33m\]\W\[\033[35m\]$(git_repo)\[\033[00m\]\n> ' | |
##### Enable .bash_functions ########### | |
if [ -f ~/.bash_functions ]; then | |
. ~/.bash_functions | |
fi | |
##### Enable .bash_aliases ########### | |
if [ -f ~/.bash_aliases ]; then | |
. ~/.bash_aliases | |
fi | |
################## added by gotomark ################ | |
# # | |
##### loads gotomark preferences if file exists ##### | |
# # | |
if [ -f ~/.gotomark/profile.sh ]; then # | |
source ~/.gotomark/profile.sh # | |
fi # | |
# # | |
##################################################### | |
###### https://github.com/whtevn/gotomark ########### | |
##################################################### |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment