gentoo下安装bugzilla

我在一台gentoo机器上安装bugzilla的问题记录,过程实在是太折腾了。 安装方法参考README文件,下面记录的是遇到的问题. bugzilla是perl编写的,所以需要apache + mod_perl mod_perl需要perl,libperl启用ithread ...

June 28, 2010 · notsobad

ubuntu10.04下freemind字体处理

ubuntu 10.4 下,更新源里面只有openjdk了,处理中文有些问题。 freemind的中文显示为扁花的字体 解决办法参考这个 sudo mkdir -p /usr/share/fonts/truetype/arphic/ sudo ln -s /usr/share/fonts/truetype/wqy/wqy-microhei.ttc /usr/share/fonts/truetype/arphic/uming.ttc 上面的方法效果不好,更好的应该是这样: sudo echo “export _JAVA_OPTIONS=’-Dawt.useSystemAAFontSettings=on’” > /etc/profile.d/notsobad.sh 然后重新login就可以了

May 11, 2010 · notsobad

定时关机命令

定时关机 windows: at 4:00 shutdown -s linux: sudo shutdown -h 4:00

February 8, 2010 · notsobad

shell中求字符串的md5

shell中求字符串的md5 参考这篇文章http://ubuntuforums.org/showthread.php?t=532594 ~$ echo x x ~$ echo x| od -bc 0000000 170 012 x \n 0000002 ~$ echo x | md5sum 401b30e3b8b5d629635a5c613cdb7919 - ~$ echo -n x | md5sum | awk '{print $1}' 9dd4e461268c8034f5c8564e155c67a6 ~$ php -r 'echo md5("x");' 9dd4e461268c8034f5c8564e155c67a6 # 封装个函数 ~$ md5(){ echo -n $1 | md5sum | awk '{print $1}'; } ~$ md5 x 9dd4e461268c8034f5c8564e155c67a6

February 4, 2010 · notsobad

awk中使用shell变量

511 ~$who | awk '/^'"$USER"'/' wang tty7 2009-12-23 09:00 (:0) wang pts/0 2009-12-23 09:00 (:0) 511 ~$who| awk '/^'"$USER"'/' wang tty7 2009-12-23 09:00 (:0) wang pts/0 2009-12-23 09:00 (:0) 较新版本的awk可以这样: nawk 'END { print "Your path variable is " ENVIRON["PATH"] }' #如下: ~$awk --version GNU Awk 3.1.6 ~$export b=2; ~$awk 'END { print "Your path variable is " ENVIRON["b"] }' /dev/null Your path variable is 2 参考文章 3.12) Is it possible to pass shell variable settings into an awk program? There are two different ways to do this. The first involves simply expanding the variable where it is needed in the program. For example, to get a list of all ttys you’re using: who | awk ‘/^’"$USER"’/ { print $2 }’ (1) Single quotes are usually used to enclose awk programs because the character ‘$’ is often used in them, and ‘$’ will be interpreted by the shell if enclosed inside double quotes, but not if enclosed inside single quotes. In this case, we want the ‘$’ in “$USER” to be interpreted by the shell, so we close the single quotes and then put the “$USER” inside double quotes. Note that there are no spaces in any of that, so the shell will see it all as one argument. Note, further, that the double quotes probably aren’t necessary in this particular case (i.e. we could have done who | awk ‘/^’$USER’/ { print $2 }’ (2) ), but they should be included nevertheless because they are necessary when the shell variable in question contains special characters or spaces. The second way to pass variable settings into awk is to use an often undocumented feature of awk which allows variable settings to be specified as “fake file names” on the command line. For example: who | awk ‘$1 == user { print $2 }’ user="$USER" - (3) Variable settings take effect when they are encountered on the command line, so, for example, you could instruct awk on how to behave for different files using this technique. For example: awk ‘{ program that depends on s }’ s=1 file1 s=0 file2 (4) Note that some versions of awk will cause variable settings encountered before any real filenames to take effect before the BEGIN block is executed, but some won’t so neither way should be relied upon. Note, further, that when you specify a variable setting, awk won’t automatically read from stdin if no real files are specified, so you need to add a “-” argument to the end of your command, as I did at (3) above. A third option is to use a newer version of awk (nawk), which allows direct access to environment vairables. Eg. nawk ‘END { print “Your path variable is " ENVIRON[“PATH”] }’ /dev/null ...

December 23, 2009 · notsobad

ubuntu安装thunderbird3

ubuntu源里的thunderbird还是2.*的,3.*已经出了好久了 参考[这里](http://www.ubuntu- inside.me/2009/08/howto-install-thunderbird-3-beta-on.html) sources.list中添加个ppa的源 sudo gedit /etc/apt/sources.list deb http://ppa.launchpad.net/ubuntu-mozilla-daily/ppa/ubuntu jaunty main deb-src http://ppa.launchpad.net/ubuntu-mozilla-daily/ppa/ubuntu jaunty main 添加key $sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 247510BE $sudo apt-get update $sudo apt-get install thunderbird-3.0 thunderbird-3.0-gnome-support

December 17, 2009 · notsobad

ubuntu下使用amule下载

ubuntu下使用amule下载 老实说,互联网上中文的东西大部分都是一大抄,很多东西找来找去都是一篇,而且还可能是错的! 我设置firefox的文件关联,就一直没设置好, 看了下amule网站上的说明,才明白少设置了一个东西. Handling ED2k links in Firefox can be configured in two ways: either for an individual user, or for all users of the computer. Configuration for a single user * Insert about:config in the address bar * Right click on the list, select New, then Boolean; insert network.protocol- handler.external.ed2k as Preference Name and true as Value * Now another right click, select New and String; insert network.protocol-handler.app.ed2k as Preference Name and /path/to/ed2k (path to where the file is installed on your system) as Value. For Firefox 3 and higher only, you should also: * Right click on the list, select New, then Boolean; insert network.protocol- handler.expose.ed2k as Preference Name and false as Value After that, click over an ed2k link, and Firefox should ask which app you want to use to open the link. Choose /usr/bin/ed2k and it should work. ...

December 14, 2009 · notsobad

使用lynx来获取网页文本

使用lynx来获取网页文本, 效果就相当于在一个网页上面输入ctrl+a ctrl+c,然后ctrl+v保存到一个文本文件中,当然写到脚本里就可以自动化操作了。 lynx -notitle -nomargins -nolist -width=4096 -verbose -display_charset=gb2312 -dump http://baike.baidu.com/view/396668.htm?hh=255 | iconv -f gb2312 -t utf8//IGNORE 排下版 wang@wang-desktop:~/script/notsobad/shell/tool$ cat get_url.sh #!/bin/sh # File: get_url.sh # Author: notsobad # Description: # Created: 2009-12-14 15:53:02 # Last modified: 2009-12-14 15:53:02 url=$1 lynx -notitle\ -nomargins\ -nolist\ -width=4096\ -verbose\ -display_charset=gb2312\ -dump\ "$url"\ | iconv -f gb2312 -t utf8//IGNORE

December 14, 2009 · notsobad

shell中的eval

关于shell中的eval 对于命令注入后,一条命令可能需要的字符大概有这几个吧 $ ' " ; && || [ ] ` > <; 可以看到是很多的,所以黑名单过滤的方法肯定是有问题的,因为是肯可能绕过去的。 加入对所有GET, POST的参数都用了htmlspecialchars做了处理,那么所有的< > 都会被转义成html字符 那么就没办法使用重定向符号了吗? 参考下下面的利用eval来使用管道符号 The shell takes care of pipes and I/O redirection before variable substitution, so it never recognizes the pipe symbol inside pipe. The result is that the three arguments |, wc, and -l are passed to ls as arguments. ...

December 7, 2009 · notsobad

ubuntu下去除开机的服务

ubuntu下去除开机的服务,如果安装了apache,mysql开发用,可以去掉,使用的时候再打开。 find /etc/rc*.d/ -name \*apache2 -exec rm {} \; #Or: sudo update-rc.d -f apache2 remove

December 7, 2009 · notsobad