WEET's way

如果你不在创造,别人就只能用品味来衡量你,但问题是品位没有办法量化。so create.

All About Git

| Comments

Update Git [1.7.1 ==> 1.8]

yum remove git
yum install perl-CPAN

wget https://git-core.googlecode.com/files/git-1.8.3.2.tar.gz
tar -zxvf git-1.8.3.2.tar.gz
cd git-1.8.3.2
./configure && make && make install

# Install man pages
tar xzv -C /usr/local/share/man -f git-manpages-1.8.3.2.tar.gz

Configure GitHub

cd ~/.ssh
ssh-kengen
# Copy *id_rsa.pub* to *SSH Keys* @github.com

FAQ

1. Checkout/Push a remote branch

Git how to create remote branch

# Checkout
git fetch 
git checkout -b origin origin/learn

# Push
git push --set-upstream origin learn

2. Checkout a branch by tag

git checkout -b  [NEW-BRANCH-NAME]  [TAG-NAME]

All About Emacs

| Comments

Installation

Some requirements

完全放弃折腾, 最多使用自带的vi, 考虑如何以最快的时间在一台主机上配置 一个趁手的Emacs.

1. Install Emacs

wget http://ftp.gnu.org/gnu/emacs/emacs-24.3.tar.xz
tar Jxf emacs-24.3.tar.xz
./configure --with-x-toolkit=no --with-xpm=no --with-jpeg=no --with-png=no --with-gif=no --with-tiff=no
make && make install

2. Get configuration

git clone git@github.com:TheWaWaR/.emacs.d.git

# In emacs, compile all files in .emacs.d directory
C-u 0 M-x byte-recompile-directory

Oh! The features!

. undo tree

. Window control : [winner-undo]

. Tabs : [tabbar]

. auto-complete

. yasnippet

. Color theme : [zenburn]

zenburn on GitHub

. Dictionary : [youdao, sdcv]

. Version control : [magit]

Already the latest version[1.2.0]. Use e in magit mode to use the magic ediff XD.

. Input method : [eim]

. Markup language : [markdown, rst]

. Python support

  • highlight-indentation
  • pyflakes
  • jedi

. Database access

  • postgresql
  • mysql
  • sqlite

. Global varibles : []

. Little modes:

saveplace      --- automatically save place in files
ffap           --- file file (or url) at point
uniquify       --- unique buffer names dependent on file name
recentf        --- setup a menu of recently opened files
open-next-line --- Behave like vi's o command
tramp          --- Transparent Remote Access, Multiple Protocol
ansi-color     --- translate ANSI escape sequences into faces

. My custom functions : [my-defuns.el]

. My custom keybinds : [my-key-bindings.el]

FAQ

All About Octopress

| Comments

Installation

1. Setup Octopress

git clone git://github.com/imathis/octopress.git octopress
cd octopress    # If you use RVM, You'll be asked if you trust the
.rvmrc file (say yes).
ruby --version  # Should report Ruby 1.9.3p194

2. Install Dependencies

gem install bundler
rbenv rehash
bundle install

3. Install the default Octopress theme

rake intall

4. Deploying to Github Pages

rake seup_github_pages
rake gen_deploy

5. Commit the source for blog

git add .
git commit -m "COMMIT MESSAGE"
git push origin source

Multiple machines

Clone Your Octopress to Blog From Two Places

git clone -b source git@github.com:TheWaWaR/thewawar.github.io.git

cd thewawar.github.io
git clone git@github.com:TheWaWaR/thewawar.github.io.git _deploy

gem install bundler
rbenv rehash
bundle install
rake setup_github_pages
# Input:: git@github.com:TheWaWaR/thewawar.github.io.git

# ** Maybe alse need:
git clone git@github.com:TheWaWaR/thewawar.github.io.git _deploy
rake gen_deploy

All About Postgresql

| Comments

Installation

Install Postgresql 9.1 server on CentOS 6

rpm -Uvh http://yum.pgrpms.org/9.1/redhat/rhel-6-x86_64/pgdg-centos91-9.1-4.noarch.rpm
yum install postgresql91-server.x86_64 postgresql91-devel.x86_64

Additional (after install postgresql 9.1)

1
2
3
4
service postgresql-9.1 initdb

# You'd better to edit ~/.zshrc
export PATH=$PATH:/usr/pgsql-9.1/bin     # For install pgcopy2

Add user

PostgreSQL add or create a user account and grant permission for database

1. In Shell

1
2
3
4
5
6
7
8
9
# Add a user called *tom*
adduser tom
passwd tom

# Change user
su - postgres

# Start postgresql client
psql

2. Inside Postgresql

1
2
3
4
5
6
CREATE USER tom WITH PASSWORD 'public';
-- Use this to change password >>> \password tom;

CREATE DATABASE jerry;
GRANT ALL PRIVILEGES ON DATABASE jerry to tom;
\q

Authentication issue

By default, the authentication method is (peer for Unix domain socket connections AND ident for IPV4 local connections), if you login postgresql server by:

psql -d myDB -U kafka -h 127.0.0.1

It will report an error like this:

psql: FATAL:  Ident authentication failed for user "kafka"

In pg_hba.conf, Change all authentication type to md5 (means by password that after md5 processed).

Authentication Methods

[Option] :: In postgresql.conf , Change listen_addresses from localhost to * so you can connect postgresql from remote host.

If you get message like:

psql: FATAL:  no pg_hba.conf entry for host "115.192.190.55", user "postgres", database "postgres", SSL off

You should change something in file pg_hba.conf, add a line like this:

host    all             all             0.0.0.0/0            md5

FAQ

1. How to import(or export) data or scheme from .sql file?

psql -U userName dbName < DATA_OR_SCHEME.sql

pg_dump -U userName dbname > output.sql

The New CentOS

| Comments

Initialization

1. Download the mini version of CentOS-6.4 ISO file.

2. Configure yum

Just use the default(centos.ustc.edu.cn). So, nothing to do ~

3. Install some important packages

yum upgrade
yum groupinstall "Development Tools"
yum install wget bzip2 unzip zip man 

Time spend: [21:17-21:40] 25min, 400kb/s