tuanle
5/3/2014 - 2:28 AM

My basic ubuntu setup and dot files.

My basic ubuntu setup and dot files.

# SYSTEM
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias www='cd /var/www/html/'

# EDITOR
alias v=vim
alias sv='sudo vim'

# GIT
alias gst='git status'
alias gbr='git branch'
alias gps='git push'
alias gplrb='git pull --rebase'
alias gpl='git pull'
alias glo='git log --oneline'
alias gl='git log'
alias gs='git show'
alias gsst='git show --stat'
alias grb='git rebase'
alias ga='git add'
alias gaa='git add .'
alias gcm='git commit'
alias gco='git checkout'
alias gcl='git clean'
alias gsth='git stash'
alias gsthp='git stash pop'
alias gdf='git diff'
alias gf='git fetch'
alias grs='git reset'

#SVN                                                                     
alias sst='svn status'
alias sa='svn add'
alias scm='svn ci'
alias sco='svn co'
alias sup='svn up'
alias scu='svn cleanup'
alias sli='svn list'
alias sdl='svn delete'
alias sdf='svn diff'
alias sl='svn log'
alias smv='svn move'
sudo bash -c '{
echo "start on (login-session-start)"

echo "script"
   echo "    echo 13 2>/dev/null > /sys/class/backlight/acpi_video0/brightness"
   echo "    echo 13 2>/dev/null > /sys/class/backlight/acpi_video1/brightness"
echo "end script"
} > /etc/init/brightness.conf '

# Another way, you can insall xbacklight
# sudo apt-get instal xbacklight
# xbackligh -set 90
# (mean 90% brightness)
#!/usr/bin/env bash

dir=$(dirname $0)
gconfdir=/apps/gnome-terminal/profiles

echo # This makes the prompts easier to follow (as do other random echos below)

########################
### Select a profile ###
########################

declare -a profiles
declare -a visnames
profiles=($(gconftool-2 -R $gconfdir | grep $gconfdir | cut -d/ -f5 |  cut -d: -f1))

#get visible names
for index in  ${!profiles[@]}; 
do    
    visnames[$index]=$(gconftool-2 -g $gconfdir/${profiles[$index]}/visible_name);
done
echo "Please select a Gnome Terminal profile:"
IFS=','
names="${visnames[*]}"
select profile_name in $names; 
do 
  if [[ -z $profile_name ]]; then
    echo -e "ERROR: Invalid selection -- ABORTING!\n"
    exit 1
  fi
  break; 
done
profile_key=$(expr ${REPLY} - 1)
unset IFS

#########################################################
### Show the choices made and prompt for confirmation ###
#########################################################

echo    "You have selected:"
echo -e "  Profile: $profile_name (gconf key: ${profiles[$profile_key]})\n"

#typeset -u confirmation
echo -n "Is this correct? (YES to continue) "
read confirmation
confirmation=$(echo $confirmation | tr '[:lower:]' '[:upper:]')
if [[ $confirmation != YES ]]; then
  echo -e "ERROR: Confirmation failed -- ABORTING!\n"
  exit 3
fi

########################
### Finally... do it ###
########################

echo -e "Confirmation received -- applying settings\n"

profile_path=$gconfdir/${profiles[$profile_key]}
# set palette
gconftool-2 -s -t string $profile_path/palette "#3F3F3F3F3F3F:#CCCC93939393:#7F7F9F9F7F7F:#E3E3CECEABAB:#DFDFAFAF8F8F:#CCCC93939393:#8C8CD0D0D3D3:#DCDCDCDCCCCC:#3F3F3F3F3F3F:#CCCC93939393:#7F7F9F9F7F7F:#E3E3CECEABAB:#DFDFAFAF8F8F:#CCCC93939393:#8C8CD0D0D3D3:#DCDCDCDCCCCC"

# set highlighted color to be different from foreground-color
gconftool-2 -s -t bool $profile_path/bold_color_same_as_fg false

# set foreground, background and highlight color
gconftool-2 -s -t string $profile_path/background_color "#3F3F3F3F3F3F"
gconftool-2 -s -t string $profile_path/foreground_color "#DCDCDCDCCCCC"
gconftool-2 -s -t string $profile_path/bold_color       "#E3E3CECEABAB"

# make sure the profile is set to not use theme colors
gconftool-2 -s -t bool $profile_path/use_theme_colors false
#==============================================
# Install core for developer, I swear
#==============================================

sudo apt-get install curl git-core vim


#==============================================
# Install extras
#==============================================

sudo apt-get install ubuntu-restricted-extras


#==============================================
# Disable crash report
#==============================================

sudo vim /etc/default/apport


#==============================================
# Install rar, vlc
#==============================================

sudo apt-get install rar vlc


#==============================================
# Install 32bit architecture (for 64bit)
#==============================================

sudo dpkg --add-architecture i386 && sudo apt-get update
sudo apt-get install ia32-libs
#==============================================
# Update & upgrade system
#==============================================
sudo apt-get update
sudo apt-get upgrade


#==============================================
# Install apache2
#==============================================
sudo apt-get install apache2


#==============================================
# Install mysql
#==============================================
sudo apt-get install mysql-server mysql-client libapache2-mod-auth-mysql php5-mysql

# Setup security
sudo /usr/bin/mysql_secure_installation


#==============================================
# Install PHP
#==============================================
sudo apt-get install php5 libapache2-mod-php5 php5-curl php-pear php5-mcrypt

# More php modules
sudo apt-get install php5-gd php5-imagick php5-imap php5-memcache php5-sqlite php5-ming
sudo apt-get install php5-ps php5-pspell php5-recode php5-snmp php5-tidy php5-xmlrpc php5-xsl

# Search and install php modules
apt-cache search php5-
sudo apt-get install name_of_the_module


#==============================================
# Restart
#==============================================
sudo service apache2 restart


#==============================================
# Change user permissions
#==============================================
sudo chown -R tuanlq /var/www/html/
sudo chmod -R 755 /var/www/html/


#==============================================
# References
#==============================================

# Install
# firefox https://www.digitalocean.com/community/articles/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu

# Setup mod_rewrite
# firefox http://askubuntu.com/questions/48362/how-to-enable-mod-rewrite-in-apache

# Setup multiple php version
# firefox https://gist.github.com/gmodarelli/5887778

# Fix mycrypt, phpmyadmin
# firefox http://pastebin.com/3PpwMvVV