Skip to content

Instantly share code, notes, and snippets.

@terryoy
terryoy / gist:4240884
Created December 8, 2012 16:21
sae django setup
# 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
@terryoy
terryoy / collection.sh
Last active October 14, 2015 00:57
A Collection of Shell Scripts/Commands
# 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
@terryoy
terryoy / gist:4359184
Last active December 10, 2015 01:28
SVN Commands
# 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.
@terryoy
terryoy / gist:4369681
Created December 24, 2012 15:38
django tastypie, userena setup
# 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
@terryoy
terryoy / gist:4411528
Last active October 6, 2018 09:49
My Gentoo Install Command List(under VirtualBox)
# 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
@terryoy
terryoy / gist:4435265
Last active April 7, 2022 22:33
My Gentoo Shell Command Collection
### 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
@terryoy
terryoy / gist:4461444
Last active December 10, 2015 16:28
Archlinux Installation Script
# 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)
@terryoy
terryoy / gist:4475888
Last active December 10, 2015 18:38
Compile C program under linux
$ vi hello.c
# #include <stdio.h>
#
# int main() {
# printf("Hello world!\n");
# exit(0);
# }
$ gcc -o hello hello.c
hello.c: In function ‘main’:
@terryoy
terryoy / gist:4518272
Last active December 11, 2015 00:39
Linux Shell Programming
### 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
@terryoy
terryoy / serial_related.py
Last active December 11, 2015 07:18
Python Script Collections