Skip to content

Instantly share code, notes, and snippets.

@mCzolko
Last active December 14, 2015 20:18
Show Gist options
  • Save mCzolko/5142632 to your computer and use it in GitHub Desktop.
Save mCzolko/5142632 to your computer and use it in GitHub Desktop.
#############################################################################
# current prompt
#############################################################################
# \d – Current date
# \t – Current time
# \h – Host name
# \# – Command number
# \u – User name
# \W – Current working directory (ie: Desktop/)
# \w – Current working directory, full path (ie: /Users/Admin/Desktop)
# export PS1="\u@\h\w: "
export PS1="\w: "
#############################################################################
# git autocomplet and bash prompt
# sudo port selfupdate
# sudo port install git-core +bash_completion +doc +svn
#############################################################################
# Bash shell command completion
if [ -f /opt/local/share/doc/git-core/contrib/completion/git-completion.bash ]; then
. /opt/local/share/doc/git-core/contrib/completion/git-completion.bash
fi
if [ -f /opt/local/share/doc/git-core/contrib/completion/git-prompt.sh ]; then
. /opt/local/share/doc/git-core/contrib/completion/git-prompt.sh
fi
# prompt
GIT_PS1_SHOWDIRTYSTATE=1
GIT_PS1_SHOWUNTRACKEDFILES=1
GIT_PS1_SHOWUPSTREAM="git verbose legacy"
export PSORIG="$PS1" # pokud chcete zachovat puvodni PS1
PS1=$PSORIG'$(__git_ps1 "\[\033[01;31m\]%s \[\033[00m\]")'
#############################################################################
# apache aliases
#############################################################################
alias apachectl='sudo /opt/local/apache2/bin/apachectl'
alias apache-start="sudo /opt/local/apache2/bin/apachectl start"
alias apache-restart="sudo /opt/local/apache2/bin/apachectl restart"
alias apache-stop="sudo /opt/local/apache2/bin/apachectl stop"
alias apache-graceful="sudo /opt/local/apache2/bin/apachectl graceful"
#############################################################################
# memcached
#############################################################################
alias memcached-start="/opt/local/bin/memcached -m 1 -l 127.0.0.1 -p 11211 -d"
alias memcached-stop="killall memcached"
alias memcached-restart="killall memcached && /opt/local/bin/memcached -m 1 -l 127.0.0.1 -p 11211 -d"
#############################################################################
# mongo
#############################################################################
alias mongo-start="sudo /opt/local/bin/mongod --fork --journal --logpath /var/log/mongo.log --logappend --dbpath /data/mongo/"
#############################################################################
# mongo
#############################################################################
alias mysql="/opt/local/lib/mysql5/bin/mysql"
#############################################################################
# perl env variables for git
#############################################################################
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
#############################################################################
# Path to macports
#############################################################################
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
#############################################################################
# aliases
#############################################################################
alias ll="ls -la" # ll alias
alias drives="df -h" # list all drives
#############################################################################
# ant tags autocomplete
# see http://matthew.mceachen.us/blog/ant-bash-completion-on-mac-os-x-43.html
# sudo port install bash-completion apache-ant
#############################################################################
if [ -f /opt/local/etc/bash_completion ]; then
. /opt/local/etc/bash_completion
fi
complete -C /opt/local/share/java/apache-ant/bin/complete-ant-cmd.pl ant
#############################################################################
# bash history size
#############################################################################
export HISTCONTROL=erasedups
export HISTSIZE=10000
shopt -s histappend

Install mac env

Download and install:

Create sublime shortcut:

sudo ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /bin/subl

Show hidden files in Finder:

defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder

Update macports sudo port -v selfupdate

## Install Apache2

sudo port install apache2
sudo port load apache2

Try http://localhost/

Edit: subl /opt/local/apache2/conf/httpd.conf set:

  • default htdocs dir /opt/local/apache2/htdocs to something
  • add ServerName localhost:80
  • add LoadModule php5_module modules/mod_php54.so
  • change DirectoryIndex index.html to DirectoryIndex index.html index.php
  • add AddType application/x-httpd-php .php and AddType application/x-httpd-php-source .phps
  • uncomment Include conf/extra/httpd-vhosts.conf and add NameVirtualHost *:80

Restart apache: sudo port unload apache2 && sudo port load apache2 or apache-restart if you use my .bash_profile

Setup some virtual hosts: subl /opt/local/apache2/conf/extra/httpd-vhosts.conf

Install PHP 5.4

sudo port install php54 php54-apache2handler
sudo port select php php54
php -v

Install PHP extensions

sudo port install php54-APC
sudo port install php54-memcached
sudo port install php54-curl
sudo port install php54-gd
sudo port install php54-soap
sudo port install php54-sockets
sudo port install php54-http
sudo port install php54-iconv
sudo port install php54-imagick
sudo port install php54-imap
sudo port install php54-mbstring
sudo port install php54-mcrypt
sudo port install php54-mysql
sudo port install php54-openssl
sudo port install php54-tidy
sudo port install php54-gettext
sudo port install php54-zip
sudo port install php54-mongo

sudo port install php54-xdebug

For more run sudo port search php54-

Setup php.ini

sudo cp /opt/local/etc/php54/php.ini-development /opt/local/etc/php54/php.ini edit subl /opt/local/etc/php54/php.ini and set:

  • pdo_mysql.default_socket=/opt/local/var/run/mysql55/mysqld.sock

Install MySQL Sever

sudo port install mysql5-server
sudo port load mysql5-server

Mongodb

sudo port install mongodb

Install environment

sudo port install git-core +bash_completion
sudo port install nodejs

### Install NPM:

sudo curl http://npmjs.org/install.sh | sh

Install packages

### Install composer:

sudo curl -s http://getcomposer.org/installer | php && mv ./composer.phar /bin/composer
sudo composer self-update

Setup

### Git

git config --global user.name "Your Name"
git config --global user.email [email protected]

### VPN

Download https://code.google.com/p/tunnelblick/ and install

open ~/Library/Application\ Support/Tunnelblick/Configurations/

See my ```~/.bash_profile``

Resources:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment