[CentOS/Linux/SSH]
- Launch a file browser from ssh with x11 forwarding
nautilus –no-desktop
ref: http://ubuntuforums.org/showthread.php?t=1749890
[MySQL]
- Create account
see http://dev.mysql.com/doc/refman/5.1/en/adding-users.html
shell>mysql –user=root mysql
mysql>create user ‘hebin’@'localhost’ identified by ‘password’;
mysql>create user ‘hebin’@'%’ identified by ‘password’;
mysql>grant all privileges on *.* (or database name) to ‘hebin’@'%’ with grant option;
mysql>grant all privileges on *.* (or database name) to ‘hebin’@'localhost’ with grant option; - more /etc/my.cnf
** checking data directory
[R]
- To do subtotal like functionalities in excel, see aggregate()
- subsetting a data.frame with %in%
used when I have a “filter” vector which contains the values matching a subset of a column in the data.frame
subset(data.frame, target %in% filter) - color correlation table using image
http://www.phaget4.org/R/image_matrix.html - color chart and color bar plot
http://research.stowers-institute.org/efg/R/Color/Chart/index.htm - ESS previous command matching input–type in the first few letters of the command, then C-c M-r
- ESS–record R session transcripts
To keep a record of your S session in a disk file, use the Emacs command C-x C-w (write-file) to attach a file to the ESS process buffer…
http://www.xemacs.org/Documentation/packages/html/ess_4.html#SEC26 - Divide a range into intervals and code a continuous variable x in this range into factors according to which interval the values fall
cut()
qauntcut() - Pattern matching and replacing in a string
gsub(“-”,”",seq) ## will remove all the “-” in a DNA sequence
[Perl]
- executing system commands using backticks can be tricky, note that one should put two back slashes before special characters such as “|” because it’s going through two levels of interpretation
eg. `grep \”PATTERN1\\|PATTERN2\” file` - Installing PERL module using CPAN
use CPAN to install perl module is quite easy. On lab mac, su into labadmin, enter into CPAN shell by typing cpan, use “i package-name” to inquire about the status of the package, use “install package-name” to install.
[Shell]
- Screen usage — how to make “less” clear screen upon exit
put “altscreen on” into ~/.screenrc
or type ctl-a:altscreen on[return] in any screen session
from here - Command history: 15 examples to learn
- .bashrc vs .bash_profile – http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html
the difference is that bash_profile is loaded upon a new login shell, while bashrc is executed when the user is already logged in but merely start a new shell. screen command within a shell will load bashrc but not bash_profile. - Enhanced (sophisticated) ftp client : lftp link_to_website
- Changing Bash Promp
Bash-Prompt-HOWTO
- Linux Shell Programming–A Beginner’s Handbook
http://www.freeos.com/guides/lsst/ - Get the machine name
hostname - Using rsync
rsync –delete -avz[destination]–delete will ensure deleting files existing on destination but not on source
-n will do a test
-u will update, i.e. only replace if the original file is newer - wget multiple files
wget -r -l1 -A.fa http://sample.com/sequences
-r for recursive, -l1 for retrieving just one layer, -A.fa for designating the type of files to retrieve
[EMACS]
- To restrict ESC key to the only function of escaping insertion mode in Viper, so as to avoid problems when hitting esc + j/k too fast, which will be interpreted as breaking a line / killing a block
(setq viper-ESC-keyseq-timeout 0) - Fix comment highlighting bug associated with emacs in Mac OS
(set-face-foreground 'font-lock-comment-face "red")
- Emacs–change the default directory of a buffer [Jan 19 2010]
M-x cd - Several ways to convert DOS 2 UNIX
http://www.vasudevaservice.com/documentation/how-to/converting_dos_and_unix_text_files
[LaTeX]
- Essential LaTeX
http://web.mit.edu/olh/Latex/ess-latex.html
[SVN]
- svn+ssh用法
svn co svn+ssh://hebin@eeg.uchicago.edu/home/hebin/svn/tfbs_mel_poly ./ - To add or rm files in batch mode, I added the following two aliase
alias svnadd=’svn status | grep ^\? | cut -c8- | xargs -d “\n” svn add’alias svnrm=’svn status | grep ^\! | cut -c8- | xargs -d “\n” svn rm’
the -d “\n” is to protect filenames with blanks