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: "
#
# for colored prompt use this notation (color codes find on Google, dont be lazy):
# \033['code'm'string'\033[0m
export PS1="\033[0;36m\u\033[0m\033[0;37m@\h\033[0m \033[0m\033[0;32m\w\033[0m "
#############################################################################
# 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"
#############################################################################
# Redis
#############################################################################
alias redis-flushall="redis-cli flushall"
#############################################################################
# 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/"
#############################################################################
# MySQL
#############################################################################
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
[
{ "keys": ["super+alt+l"], "command": "reindent", "args": {"single_line": false} }
]

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-intl

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/mysql5/mysqld.sock
  • date.timezone = Europe/Prague
  • default_charset = "UTF-8"
  • post_max_size = 256M

Install MySQL Sever

sudo port install mysql5-server
sudo -u mysql mysql_install_db5
sudo port install php54-mysql
sudo port load mysql5-server

Setup password: mysqladmin5 -u root password ''

Check if running sudo ps -ef | grep mysql

Change php.ini subl /opt/local/etc/php54/php.ini:

mysql.default_socket = /opt/local/var/run/mysql5/mysqld.sock
mysqli.default_socket = /opt/local/var/run/mysql5/mysqld.sock
pdo_mysql.default_socket = /opt/local/var/run/mysql5/mysqld.sock
sudo chown -R mysql:mysql /opt/local/var/db/mysql5/
sudo chown -R mysql:mysql /opt/local/var/run/mysql5/
sudo chown -R mysql:mysql /opt/local/var/log/mysql5/

Mongodb

sudo port install mongodb

Install GIT

sudo port install git-core +bash_completion

and

git config --global user.name "Your Name"
git config --global user.email you@example.com

Install NPM and node.js

sudo port install nodejs
curl http://npmjs.org/install.sh | sh
sudo chmod -R g+w /opt/local/

Or curl -k https://npmjs.org/install.sh | sudo sh if you have trable with error newline. Check node -v and npm -v

npm install -g bower
npm install -g grunt-cli
npm install -g less
npm install -g coffee-script

### Install composer:

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

## Install VPN

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

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

Resources:

Install GIT

brew install git bash-completion

and

if [ -f $(brew --prefix)/etc/bash_completion ]; then
    . $(brew --prefix)/etc/bash_completion

    source ~/.git-completion.bash
        GIT_PS1_SHOWDIRTYSTATE=1
        GIT_PS1_SHOWUNTRACKEDFILES=1
        GIT_PS1_SHOWUPSTREAM="git verbose legacy"
        export PSORIG="$PS1"

        PS1=$PSORIG'$(__git_ps1 "\[\033[01;31m\]%s \[\033[00m\]")'
fi

and (if you didn't do this earlier)

git config --global user.name "Your Name"
git config --global user.email you@example.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment