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

linux下获取mac地址

参考[这篇](http://blog.khsing.net/2009/01/use-sed-to-got-mac-and-ip-from- ifconfig.html)文章 ifconfig eth0 | sed -n -e '/.*HWaddr \([:[:xdigit:]\-]*\).*/{s//\1/;p}' linux下由于语言版本不同,这样的脚本可能在中文下就不行了 想了下,可以在一个子shell中,配置LANG变量,然后再调用 #在一个子shell中执行,LANG不会影响调用的shell (LANG=en_US && ifconfig eth0 | sed -n -e '/.*HWaddr \([:[:xdigit:]\-]*\).*/{s//\1/;p}')

April 13, 2010 · notsobad

python的SimpleHTTPServer

想快速的共享些文件给其他人? 用samba,或者简单的起个web server即可。 serv(){ ip=`ifconfig eth0 | sed -n 's/^\s*inet [^:]*://p' | awk '{print $1}'`; echo http://$ip:8000; python -m SimpleHTTPServer; } 加到~/.bashrc中,以后在需要的目录中运行serv 550 /tmp# serv http://10.16.22.1:8000 Serving HTTP on 0.0.0.0 port 8000 ... wang-desktop.local - - [04/Apr/2010 16:17:22] "GET / HTTP/1.1" 200 - wang-desktop.local - - [04/Apr/2010 16:17:22] "GET / HTTP/1.1" 200 - 然后访问把地址, 如“http://10.16.22.1:8000”发给其他人即可。 ...

April 4, 2010 · notsobad

windows下启动一个带有gui的程序

如何在调起一个命令,然后立即返回呢? linux下的好办。windows下怎么做呢?参考下面。 http://www.php.net/manual/en/function.exec.php function execInBackground($cmd) { if (substr(php_uname(), 0, 7) == "Windows"){ pclose(popen("start /B ". $cmd, "r")); } else { exec($cmd . " > /dev/null &"); } } windows下web.py中,想启动一个带gui的程序,或者想在一个新的cmd窗口中执行一个命令行程序,如何做呢? 启动带gui的程序: ...

March 19, 2010 · notsobad

定时关机命令

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

February 8, 2010 · notsobad

全文搜索工具

编译 sphinx ./configure --with-mysql ..... ERROR: cannot find MySQL include files. Check that you do have MySQL include files installed. The package name is typically 'mysql-devel'. .... 提示需要mysql-devel包,但是ubuntu里面没有叫这个名字的包,搜了一下,应该是这个 http://ubuntuforums.org/showthread.php?t=556317 apt-get install libmysql++-dev make && sudo make install 安装完成 几个相关的文档 django-sphinx http://github.com/dcramer/django-sphinx http://www.davidcramer.net/code/65/setting-up-django-with-sphinx.html http://www.sphinxsearch.com/ http://www.davidcramer.net/code/117/announcing- django-sphinx-200.html http://code.google.com/p/django-sphinx/ sphinx需要启动daemon,绑定主机、端口,在共享主机下,比较难操作,似乎xapian是更好的选择。 ...

January 24, 2010 · notsobad

html转换为epub

html转换为epub,使用calibre 先用tidy整理下格式。 ~$ tidy -m a.html ~$ ebook-convert a.html a.epub --no-default-epub-cover --base-font-size=10 -v --authors=wang ebook-convert 是属于calibre里的工具。 关于它的参数,help是看不到的,要看这里 <http://calibre- ebook.com/user_manual/cli/ebook-convert-3.html#html-input-to-epub-output> 其它格式转换在这里 http://calibre-ebook.com/user_manual/cli/ebook-convert.html 如果转换失败,需要清理下html代码,去除多余数据,清理格式。 ...

January 24, 2010 · notsobad

php代码格式化工具

对于一些缩进不好的代码,可以利用这些工具来进行缩进美化下。 http://www.codeassembly.com/examples/beautifier.php http://www.beautifyphp.com/ 水木上有人传了sina微博泄漏代码,是个文本,全部都在一行里,没法看 我用sed处理了下, cat att.php\?s.261.77749.629.txt | iconv -f gb2312 -t utf8 | sed -e 's/;/;\n/g' -e 's#//#\n//#g' -e 's#\*/#\*/\n#g' -e 's/\}/\}\n/g' 然后再用http://www.codeassembly.com/examples/beautifier.php 格式化了下,基本能看了 ...

January 15, 2010 · notsobad

利用nmap来解析ip段

nmap支持很多中ip段的格式 ~$ nmap -n -sL 10.16.1-2.3-4 | awk '/Host/{print $2}' 10.16.1.3 10.16.1.4 10.16.2.3 10.16.2.4 ~$ nmap -n -sL 10.16.1-10.1 | awk '/Host/{print $2}' 10.16.1.1 10.16.2.1 10.16.3.1 10.16.4.1 10.16.5.1 10.16.6.1 10.16.7.1 10.16.8.1 10.16.9.1 10.16.10.1 -sL 列出扫描目标,不向目标发送数据,但是会做dns反向解析,可以加-n,去掉dns查询。 参考: -sL (List Scan) . The list scan is a degenerate form of host discovery that simply lists each host of the network(s) specified, without sending any packets to the target hosts. By default, Nmap still does reverse-DNS resolution on the hosts to learn their names. It is often surprising how much useful information simple hostnames give out. For example, fw.chi is the name of one company´s Chicago firewall. Nmap also reports the total number of IP addresses at the end. The list scan is a good sanity check to ensure that you have proper IP addresses for your targets. If the hosts sport domain names you do not recognize, it is worth investigating further to prevent scanning the wrong company´s network. Since the idea is to simply print a list of target hosts, options for higher level functionality such as port scanning, OS detection, or ping scanning cannot be combined with this. If you wish to disable ping scanning while still performing such higher level functionality, read up on the -PN option. ...

January 15, 2010 · notsobad