Tuesday, April 30, 2013

postgresql create drop user

Postgresql server start

Use the following command (from terminal) to control the PostgreSQL server
Start the service : /etc/init.d/postgresql start
Stop the service : /etc/init.d/postgresql stop
Know the status : /etc/init.d/postgresql status
Restart the service : /etc/init.d/postgresql restart

Read more: http://linuxpoison.blogspot.tw/2012/01/how-to-install-configure-postgresql.html#ixzz2RutcjeNH

Thursday, April 25, 2013

ubuntu fix ip

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

File: /etc/network/interfaces

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static


address 192.168.8.188
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.225
gateway 192.168.8.1
dns-nameservers 192.168.8.201 202.130.97.65

sudo /etc/init.d/networking restart


mac hosts file

sudo vi /private/etc/hosts

Install apache for ruby on rails on Ubuntu

  1. Install apache2
    1. sudo apt-get update
    2. sudo apt-get install apache2
  2. Enable https
    1. sudo a2enmod ssl
      sudo a2ensite default-ssl

      sudo service apache2 restart
  3. Install Passenger
    1. gem install passenger
    2. passenger-install-apache2-module
    3. sudo apt-get install libcurl4-openssl-dev
    4. rvmsudo rvm get head && rvm reload && rvm repair all
    5. Permission denied -> chmod 777...

Install passenger on ubuntu

Ubuntu: Curl development headers with SSL support

By: Richard26-11-2010computing
Share
Just been trying to install Passenger on a new Ubuntu EC2 instance and
passenger is giving me the error:


* Curl development headers with SSL support... not found


Took some digging around but turns out I was just missing the
libcurl4-openssl-dev package:


sudo apt-get install libcurl4-openssl-dev

Solve Apache2 permission problem.

<Directory />
    Options FollowSymLinks
    AllowOverride All
    Order deny,allow
    Allow from all
</Directory>

Monday, April 15, 2013

vim binary mode

To binary mode -- :%!xxd
To normal mode -- :%!xxd -r

Sunday, April 14, 2013

Git move master to branch

git checkout target_branch
git merge --strategy==ours --no-commit master
git commit -m "Move master to this branch..."
git checkout master
git merge target_branch

Git command history

>git reflog

Friday, April 5, 2013

Linux - Bash encrypt and decrypt file

openssl des3 -salt -in unencrypted-data.file \
-out encrypted-data.file.des3

openssl des3 -d -salt -in encrypted-data.file.des3 \
-out unencrypted-data.file