Jan 26, 2014
TechnologyFor create a new branch in the current repository:
git branch <name_of_your_new_branch>
Then you can push the branch on github
git push origin <name_of_your_new_branch>
If you want to switch to your new branch:
git checkout <name_of_your_new_branch>
See all of the branches via:
git branch
Also you can add multiply remote url via:
git remote add <name_of_your_remote> <url>
Push all of your changes
git push origin <name_of_your_remote>
Jan 26, 2014
TechnologyInstall python-virtualenv:
sudo apt-get install python-virtualenv
Install the virtualenv Wrapper:
sudo apt-get install virtualenvwrapper
Now create the directory for holding the virtual environment:
mkdir ~/pyv
Edit the virtualenv resource file:
export WORKON_HOME="/home/Trusty/pyv"
export PROJECT_HOME="/home/Trusty/pyv"
#source /usr/bin/virtualenvwrapper.sh
Here we meet the problem, it says cannot find the /usr/bin/virtualenvwrapper.sh, I got the answer from the stackoverflow:
From /usr/share/doc/virtualenvwrapper/README.Debian:
In contrast to the information in
/usr/share/doc/virtualenvwrapper/en/html/index.html this package installs
virtualenvwrapper.sh as /etc/bash_completion.d/virtualenvwrapper.
Virtualenvwrapper is enabled if you install the package bash-completion and
enable bash completion support in /etc/bash.bashrc or your ~/.bashrc.
If you only want to use virtualenvwrapper you may just add
source /etc/bash_completion.d/virtualenvwrapper
to your ~/.bashrc.
So the right command should be:
$ cat /home/Trusty/.virtualenvrc
export WORKON_HOME="/home/Trusty/pyv"
export PROJECT_HOME="/home/Trusty/pyv"
source /etc/bash_completion.d/virtualenvwrapper
Now add this find into .bashrc and source~/.bashrc again:
$ tail -1 ~/.bashrc
source /home/Trusty/.virtualenvrc
$ source ~/.bashrc
Good!!! Now you can continue with the following steps, just as we noticed in previous articles.
Jan 24, 2014
TechnologyInstall pinyin for we want to use it for generate the title:
$ pip install pinyin
Write a new post:
$ python config_blog.py 迁移博客成功
content/posts/2014/01/2014_01_24_qianyibokechenggong.md
Chinese codec:
cat ~/.bashrc
export LANG="zh_CN.UTF-8" Or "en_US.UTF-8"
export LC_ALL="zh_CN.UTF-8" Or "en_US.UTF-8"
Write the blog:
vim content/posts/2014/01/2014_01_24_qianyibokechenggong.md
Install BeautifulSoup
pip install BeautifulSoup
Jan 23, 2014
Technology###Backgroud
Because github only allow one user to login(trusted key), the error message is listed as “Error: Key already in use”, I have to try another method for updating the qzone.
First I have created a new user on github, and created the corresponding repositories, now I have to create the user on my own machine, named “qzone” for only updating the repository.
###Create the user
Use following command for create a new user:
useradd -m -g root -G wheel -s /bin/bash qzone
passwd qzone
Then as another oridinary user, run “su qzone” then we can switch to the new user’s shell.
###Configure the user
Configure the git tools:
[qzone@XXXyyy ~]$ git config --global user.name "qzone"
[qzone@XXXyyy ~]$ git config --global user.email "XXXYYY@qq.com"
Add python virtualenv running environment:
mkdir ~/pyv
[qzone@XXXyyy ~]$ cat ~/.virtualenvrc
export WORKON_HOME="/home/qzone/pyv"
export PROJECT_HOME="/home/qzone/pyv"
source /usr/bin/virtualenvwrapper.sh
Add following lines for automatically run virtualenv setup
$ tail ~/.bashrc
source /home/qzone/.virtualenvrc
Now we can create the virtualenv for running python.
[qzone@XXXyyy ~]$ mkvirtualenv --python=/usr/bin/python2.7 v27
$ cdvirtualenv
Now we are in the python 2.7 environment. But notice you have to set http_proxy/https_proxy, etc for you are working under the proxy.
Install the pelican:
$ pip install pelican
Add configuration for git proxy:
export GIT_PROXY_COMMAND=/bin/myproxy
Add workon directory in .bashrc:
export WORKON_HOME=~/pyv
Next time, workon v27 then we can switch to python2.7 shell.
Make the directory of code, which will store all of the code.
$ mkdir -p ~/code/XXXYYY
Now clone the existing repository into the local directory:
git clone https://github.com/XXXYYY/XXXYYY.github.io
Install ghp-import for swiftly deploy your website
pip install ghp-import
Now setting:
pelican content -o output -s pelicanconf.py
ghp-import output
git push git@github.com:XXXYYY/XXXYYY.github.io.git gh-pages:master
Now you will failed, because you don’t have the correct access rights. So we need to set the ssh access right:
ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub
Then in github’s accounting management page, add this content.
Push all of the modifications to the remote repository:
git push -f git@github.com:XXXYYY/XXXYYY.github.io.git gh-pages:master
Install markdown for analyse the markdown based blog:
pip install markdown
Now you can do the following:
make html
make github
git push -f git@github.com:XXXYYY/XXXYYY.github.io.git gh-pages:master
Now install new themes:
cat pelicanconf.py
# Use theme for our own
THEME = "./pelican-themes/waterspill-en"
OK, now you can enjoy the blog finally.
Jan 20, 2014
TechnologyGetting Start
Install pelican via pip:
pip install pelican
Getting started Manual: http://docs.getpelican.com/en/3.1.1/getting_started.html, and the command is listed as following:
# Make sure your pelican is the newest
$ pip install --upgrade pelican
$ mkdir ~/code/yoursitename
$ cd ~/code/yoursitename
$ pelican-quickstart
The “pelican-quickstart” will ask you some questions, after answer all of the questions, you will have a start-up point for the website.
If your content is OK, run
$ make html && make serve
will generate the html files and preview it on the server.
Change the Theme
Copy the offical themes into your own directory:
$ git clone --recursive https://github.com/getpelican/pelican-themes ~/pelican-themes
Set the default theme in your pelicanconf.py:
# Use theme for our own
# THEME = "/home/Trusty/pelican-themes/mnmlist"
# THEME = "/home/Trusty/pelican-themes/storm"
THEME = "/home/Trusty/pelican-themes/html5-dopetrope"
Regenerate the site:
$ make html && make serve
Notice the pelican is pretty slow for rendering all of the content. For some themes, it may take up to several minutes for generating the whole site!