Today, following a document to tune the security of our whm hosting, I enabled “Shell fork bomb protection” in “Security Center”. But I’m 100% sure what I did. Then when I try to run the apache process of the user, the exception “bash: fork Resource temporarily unavailable” raised. It took me a lot of time to find why this happen. Finally I got this document: http://www.eddieoneverything.com/linux/linux-whm-cpanel-resource-temporarily-unavailable.php
It’s because “Shell fork bomb protection” will enable the limitation for each user, the limitation is defined with ulimit command. The default limitation is 100 open files with 20 processes.
Linux
Linux
It’s a long time pain for my mp3 files. I tried a lot of kinds way to convert my mp3 files’ id3 tag encoding. But every time when I need to convert the tag, I can’t remembered what I did last time. Now I’m going to record some way to do this.
I used amarok. Since the developers os amarok hate to deal with various kinds of encoding, they determined to use unicode which required id3v2.4 tag. This decision makes a lot of Chinese music displayed like a mess in the amarok because most of Chinese music used old version, different encode id3 tags.
I found some good ways to convert your music id3 tags here: http://wiki.linuxmce.org/index.php/Converting_MP3_Tags_To_UTF-8
The most way I like is mid3iconv
I used it like this:
For a single file
$mid3iconv -e gb2312 a.mp3 --remove-v1 -dp
For a directory
$find . -name "*.mp3" -exec mid3iconv -e gb2312 --remove-v1 -dp "{}" \;
-p option means dry-run, so if you really want to convert, remove this option.
Linux
id3, Linux, tool
I can’t install google toolbar in archlinux firefox3 for a long time. Today I resolved this issue by searched archlinux forum.
Reference:
http://bugs.archlinux.org/task/13759
Why I can’t install google toolbar?
Google can’t recogonized my firefox version correct, that’s because archlinux mark firefox as “GranParadiso”.
How to change that?
1. Type “about:config” in the url bar of firefox.
2. Search “general.useragent.extra.firefox” key, and change the value from “GranParadiso/3.0.x” to “Firefox/3.0.x”
3. Then go to google toolbar install page and click install.
Linux
archlinux, firefox
Recently, I’m interesting with android, but they only have online documents now. I can’t access the internet freely when I’m at home, so I want to download the documents and read them offline.
I searched the internet, and found wget can deal with this task very well.
wget --mirror --no-parent --page-requisites --convert-links --no-host-directories http://code.google.com/intl/zh/android/documentation.html
--mirror : Mirror is equivalent to "-r -N -l inf --no-remove-listing" (basically, infinite recursion).
--no-parent : Do not follow links that ascend to the parent directory. Only follow links that are under the given URL.
--page-requisites : Download all page requisites necessary to display the page (images, CSS, javascript, etc.).
--convert-links : Convert links in the pages so that they work locally relative to the OUTPUT_DIR.
--no-host-directories : Don't create host name directories.
Two additional useful options:
-A: Accept list, define which files you need.
-R:Reject list, define which files you don’t need.
I got that from http://www.noah.org/wiki/Offline_mirror_with_wget
Linux
I’m confused by different endline charactors for different systems recently. I organized some information here.
LF(n) — new line
CR(r) — enter
For windows system, it used CRLF(rn) at the end of each line.
For Mac, it used CR(r) at the end of each line.
For Linux, it used LF(n) at the end of each line.
So if you open a windows file in linux or mac system, there is a character ‘^M’ and the end of each line. On the contrary, you will see there is no line break if you open a mac/linux file in windows system.
I used Linux, so I just collect the way to convert the file from CRLF to LF.
1. Used vim
vim somefile
:set ff=unix
:wq
2. used commond tr
tr can delete characters from standard input, writing to standard output. See detail, please man tr
tr -d 'r' < "inputfile" > "outputfile"
3. If you use archlinux, install hd2u package, it includes a tool named dos2unix
With dos2unix, you can convert the file from mac, windows, unix freely.
dos2unix --d2u file
Linux
Recent Comments