This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install virtualenv to manage the environment | |
sudo apt-get install python-virtualenv | |
# create site folder | |
mkdir mysite | |
cd mysite | |
# activatet the virtualenv environment | |
virtualenv venv | |
source venv/bin/activate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# convert text files to all lower case | |
$ tr '[:upper:]' '[:lower:]' < input.txt > output.txt | |
# Convert Data Stored in a Shell Variable From UPPPER to lowercase | |
$ echo $VAR_NAME | tr '[:upper:]' '[:lower:]' | |
# Convert Data Stored in a Shell Variable From lowercase to UPPER | |
$ echo $VAR_NAME | tr '[:lower:]' '[:upper:]' | |
# job control: | |
# ctrl+z - suspend a job and put into background |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Checkout source | |
svn co SVN_URL [PATH] [--username USERNAME] [--password PASSWORD] [-r REVISION] | |
# Add an unversioned(new) FILE or DIR to the version control system | |
svn add FILE | |
# show the current conflict/modified/new status of working directories and files | |
svn status | |
# You should always do a manual svn status --show-updates before trying to commit | |
# changes in order to check that everything is OK and ready to go. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install userena | |
pip install django-userena | |
# a simple catpcha for django | |
pip install django-simple-captcha | |
# install dependencies for pil and captcha | |
sudo apt-get install libjpeg libjpeg-dev libfreetype6 libfreetype6-dev zlib1g-dev | |
# install pil | |
pip install pil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reference: http://www.gentoo.org/doc/zh_cn/gentoo-x86-quickinstall.xml | |
########################################################################## | |
##### part 1: boot with gentoo minimal ##### | |
# boot | |
gentoo | |
# config network | |
net-setup eth0 | |
ifconfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### emerge package management (need root access) ### | |
### "emerge" is a tool manipulating Gentoo's package management tool "Portage" ### | |
# update portage tree | |
emerge --sync | |
# search package | |
emerge --search pdf | |
emerge --searchdesc pdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create and format the partitions | |
fdisk /dev/sda | |
# n (new partition) | |
# +100M (for /boot) | |
# n | |
# +15G (for / including /usr) | |
# n | |
# +8G (for /var) | |
# n | |
# (for the rest, extended) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ vi hello.c | |
# #include <stdio.h> | |
# | |
# int main() { | |
# printf("Hello world!\n"); | |
# exit(0); | |
# } | |
$ gcc -o hello hello.c | |
hello.c: In function ‘main’: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### IO redirecting ### | |
# "2" is stderr | |
kill -HUP >killout 2>killerr.txt | |
# add stderr to the same file as stdout | |
kill -l 1234 >killout 2>&1 | |
# output to "Recycle Bin" | |
kill -l 1234 >/dev/null 2>&1 | |
# redirect stdin | |
more < killout.txt |
OlderNewer