RPM commands

List all installed packages
rpm -qa

For others, see
http://www.linuxdocs.org/HOWTOs/RPM-for-Unix-HOWTO-5.html

Joke of mathematician

The American inventor of cybernetics theory, Norbert Wiener, for example, is frequently depicted as the archetypal absent-minded professor. It is said he once lost his way walking home from the Massachusetts Institute of Technology. He came across a small girl in the street and asked if she could give him directions. “Yes, daddy,” she replied, “I’ll take you home.”

Create Oracle/Mysql Key and Index

MySQL:

create table user
(
user_id int NOT NULL AUTO_INCREMENT,
name varchar(100),
phone varchar(100),
email varchar(100),
password varchar(100),
role_id int,
primary key(user_id),
unique index email_idx(email),
index role_idx(role_id)
);

Oracle:

create table user2
(
user_id int NOT NULL,
name varchar2(100),
phone varchar2(100),
email varchar2(100),
password varchar2(100),
role_id int,
primary key(user_id),
unique (phone),
foreign key (role_id) references role(role_id)
);
create unique index cu on user2 (email);
create index role_idx on user2 (role_id);

or
create table foo (a int primary key,
b varchar(20) unique);

PGP commands

. Copy GPG keys
copy the following files pubring.gpg random_seed secring.gpg trustdb.gpg from your old directory to your new directory, usually ~/.gngpg under Linux

. Encrypt a file
gpg -e -r me@hongyu.org test.pdf

. Decrypt a file
gpg -d test.pdf.gpg > test.pdf