Convert Chrome tabs to a list to save memory and your sanity

By the end of the workday, my Internet research and wanderings leave me with dozens upon dozens of open tabs. This trail of tabs is confusing to navigate and leaves my laptop feeling sluggish. If you use tabs as temporary bookmarks as I do and use Chrome, I suggest you give OneTab a whirl. […]

linux下 mysql用户的管理

自从上在redhat Enterprise 5 中安装了MySQL,这次来实践操作一下MySQL用户的管理;

 

一、root用户密码的维护:

由于安装MySQL完后,MySQL会自动提供一个不带密码的root用户,为了安全起见给root设置密码:

#mysqladmin -u root password 123 (123为密码,也可以写成:’123’或”123″) ;

设置密码后登入时就不能直接输入mysql了,必须跟些参数了,如下:

[root@localhost ~]# mysql -u root -p (-u 后跟登入的用户名,-p 提示要密码登入) Enter password:(输入密码)

 

修改密码:

[root@localhost ~] #mysqladmin -u root -p password 123456 (password 后跟的是要更新的新密码) Enter password:(输入原始密码,回车即可)

 

二、其他用户的增加和删除:

以root用户登入,在mysql中有一张mysql.user表是存储MySQL中所有用户的信息表,所以可以直接增加删除这个表的记录就可增加和删除用户;

 

1.添加用户(有两种形式):

A.mysql> grant all on *.* to yushan@”%” identified by “123” […]

linux shell 用sed命令在文本的行尾或行首添加字符

昨天写一个脚本花了一天的2/3的时间,而且大部分时间都耗在了sed命令上,今天不总结一下都对不起昨天流逝的时间啊~~~

 

用sed命令在行首或行尾添加字符的命令有以下几种:

假设处理的文本为test.file

在每行的头添加字符,比如”HEAD”,命令如下:

sed ‘s/^/HEAD&/g’ test.file

在每行的行尾添加字符,比如“TAIL”,命令如下:

sed ‘s/$/&TAIL/g’ test.file

运行结果如下图:

几点说明:

1.”^”代表行首,”$”代表行尾

2.’s/$/&TAIL/g’中的字符g代表每行出现的字符全部替换,如果想在特定字符处添加,g就有用了,否则只会替换每行第一个,而不继续往后找了

例:

3.如果想导出文件,在命令末尾加”> outfile_name”;如果想在原文件上更改,添加选项”-i”,如

4.也可以把两条命令和在一起,在test.file的每一行的行头和行尾分别添加字符”HEAD”、“TAIL”,命令:sed ‘/./{s/^/HEAD&/;s/$/&TAIL/}’ test.file

 

 

以上其实都还OK,昨天花太多时间,主要因为被处理的文件是用mysql从数据库提取的结果导出来的,别人给我之后我就直接处理,太脑残了= -我一直有点怀疑之所以结果不对,有可能是windows和linux换行的问题,可是因为对sed不熟,就一直在搞sed。。。。。。。

 

众所周知(= -),window和linux的回车换行之云云,如果你知道了,跳过这一段,不知道,读一下呗:

Unix系统里,每行结尾只有“<换行>”,即“\n”;Windows系统里面,每行结尾是“<换行><回 车>”,即“\n\r”。一个直接后果是,Unix系统下的文件在Windows里打开的话,所有文字会变成一行;而Windows里的文件在Unix下打开的话,在每行的结尾可能会多出一个^M符号。

 

好了,所以我的问题就出在被处理的文件的每行末尾都有^M符号,而这通常是看不出来的。可以用”cat -A test.file”命令查看。因此当我想在行尾添加字符的时候,它总是添加在行首且会覆盖掉原来行首的字符。

要把文件转换一下,有两种方法:

1.命令dos2unix test.file

2.去掉”\r” ,用命令sed -i ‘s/\r//’ test.file

好了,这样处理完,就OK啦!!!

[…]

Install genometools

the ‘new’ error message refers to a nonexistant Cairo library on your system, which is needed for the AnnotationSketch component of GenomeTools. If you do not need this, do a ‘make cleanup’ and recompile with the additional make option ‘cairo=no’, e.g. ‘make errorcheck=no cairo=no’. This will disable support for AnnotationSketch and remove the cairo […]

开机自动挂载(mount),可以在/etc/fstab

如果想开机就自动挂载(mount)上,可以在/etc/fstab上添加如下几行:

/dev/hda5 /mnt/d vfat exec,dev,suid,rw,umask=0,iocharset=gb2312,codepage=936 0 0

同时也解决了中文文件名的乱码问题,我的fstab文件如下,仅供参考:

LABEL=/12 / ext3 defaults 1 1

none /dev/pts devpts gid=5,mode=620 0 0

none /proc proc defaults 0 0

none /dev/shm tmpfs defaults 0 0

/dev/hda4 swap swap defaults 0 0

/dev/cdrom /mnt/cdrom iso9660 noauto,owner,kudzu,ro 0 0

/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0

/dev/hda1 /mnt/c vfat exec,dev,suid,rw,umask=0,iocharset=gb2312,codepage=936 0 […]

solve the problem of “read-only file system”

Originally Posted by prabhatsoni When I mount it by giving “mount -t vfat -o rw /dev/sdb1 /media/disk”, it mounts. But again when I try to delete a file, It gives the error “read-only file system”.

Give the mount command w/o any options a see whether it says it is mounted ro. If so, check […]

Solve problem for /usr/bin/ld: cannot find -lgfortran

gcc -std=gnu99 -shared -o vegan.so cepin.o data2hill.o decorana.o goffactor.o monoMDS.o nestedness.o ordering.o pnpoly.o stepacross.o vegdist.o -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR /usr/bin/ld: cannot find -lgfortran collect2: ld returned 1 exit status make: *** [vegan.so] Error 1

After installing libgfortran3, you should rename libgfortran.so.3 to libgfortran.so

mv /usr/lib/libgfortran.so.3 /usr/lib/libgfortran.so

在linux环境编译应用程式或lib的source code时常常会出现如下的错误讯息:

/usr/bin/ld: cannot find -lxxx

这些讯息会随着编译不同类型的source […]

Install mcaGUI problem

To install this package, start R and enter:

source(“http://bioconductor.org/biocLite.R”) biocLite(“mcaGUI”) Note: R version >= 2.13 ……………………..

g++ -shared -L/usr/local/lib64 -o ShortRead.so Biostrings_stubs.o IRanges_stubs.o R_init_ShortRead.o alphabet.o io.o io_bowtie.o io_soap.o pileup.o readBfaToc.o read_maq_map.o sampler.o util.o xsnap.o -lz 安装至 /home/shenzy/R/x86_64-pc-linux-gnu-library/R-2.13.1/library/ShortRead/libs ** R ** inst ** preparing package for lazy loading

Attaching package: ‘IRanges’

The following object(s) are masked […]

linux ubuntu 中文输入法消失

按Ctrl+ALT+T 快捷键打开终端, 输入: killall ibus-daemon (结束进程) ibus-daemon -d (重启ibus)

Good Useful one-line scripts for sed!

————————————————————————- SED单行脚本快速参考(Unix 流编辑器) 2005年12月29日 英文标题:USEFUL ONE-LINE SCRIPTS FOR SED (Unix stream editor) 原标题:HANDY ONE-LINERS FOR SED (Unix stream editor) 整理:Eric Pement – 电邮:pemente[at]northpark[dot]edu 版本5.5 译者:Joe Hong – 电邮:hq00e[at]126[dot]com 在以下地址可找到本文档的最新(英文)版本: http://sed.sourceforge.net/sed1line.txt http://www.pement.org/sed/sed1line.txt 其他语言版本: 中文 – http://sed.sourceforge.net/sed1line_zh-CN.html 捷克语 – http://sed.sourceforge.net/sed1line_cz.html 荷语 – http://sed.sourceforge.net/sed1line_nl.html 法语 – http://sed.sourceforge.net/sed1line_fr.html 德语 – http://sed.sourceforge.net/sed1line_de.html 葡语 – http://sed.sourceforge.net/sed1line_pt-BR.html 文本间隔: ——– # 在每一行后面增加一空行 sed […]