李波's profilekpld's SpacePhotosBlogLists Tools Help

Blog


    10/23/2009

    debug perl in sandbox

    perl -de 0
    10/14/2009

    vim删除多行注释

    :%s/\s*\(\/\*.\{-}\*\/\|\/\/.*$\)//g

    9/29/2009

    close monitor under Linux

    In X:  
      xset dpms force off
     
    In console: 
      if [ ${TERM} = "linux" ]; then
          setterm -blank 1 -powersave powerdown
      fi
     
    These need ACPI support, you can use cmd:
      cat /proc/acpi/info
    to verify this feature.
    This cmd should show "version: 20081214" similar string.
    9/27/2009

    Argument list too long error in shell and solution

    use cmd "getconf ARG_MAX" to get this limit
    this macro is defined in "include/linux/limits.h"
     
    solution:
    1. 
    find /path/ |xargs -n 100 rm
     
    2. 
    for fileset in a b c d e f g h i j k l m n o p q r s t v w x z
    do
       /bin/rm $fileset*
    done
     
    3.
    ls|xargs rm
     
    4. modify kernel at "include/linux/binfmts.h"
    #define MAX_ARG_PAGES 32      // modify 32 to larger
     
    9/13/2009

    nptl的问题

    我的显卡是R300系列,用的开源ati驱动,glxgear跑不起来,3D游戏也不能玩。google了半天,说是去掉nptl这个USE,只好这样。重新emerge了一下,需要编译gcc、mesa、xorg-server这三个包。
    弄完之后,glxgear了一下,2300多分,相当不错。马上打开glest,果然比较流畅。
    查了下nptl,Enable support for Native POSIX Threads Library, the new threading module (requires linux-2.6 or better usually),这个怎么会影响显卡驱动效果呢?不解。
    9/11/2009

    Magic System Request

    查看:cat /proc/sys/kernel/sysrq
    设置:CONFIG_MAGIC_SYSRQ
    R-E-I-S-U-B 这个序列的推荐使用方式是:R – 1 秒 – E – 30 秒 – I – 10 秒 – S – 5 秒 – U – 5 秒 – B,而不是一气呵成地按下这六个键
    说明:
    R - 把键盘设置为 ASCII 模式
    E - 向除 init 以外所有进程发送 SIGTERM 信号
    I - 向除 init 以外所有进程发送 SIGKILL 信号
    S - 磁盘缓冲区同步
    U - 重新挂载为只读模式
    B - 立即重启系统

    user & group command

    newgrp: change primary group ID to exec command
    sg group -c command: change group ID to exec command
    vigr: edit /etc/group
    vipw: edit /etc/passwd
    groups: show groups of user
    pwck: verify passwd file
    grpck: verify group file
    setfacl: set file acl
    getfacl: get file acl
     
     
     
    9/4/2009

    screen的高级用法:multiuser

    要使用multiuser模式,首先必须
    # chmod u+s /usr/bin/screen
     
    user1:
    screen -S window1
    Ctrl+a
    :multiuser on
    :acladd user2
    :aclchg user -w "#"
    Ctrl+a Ctrl+d
     
    user2:
    screen -r user1/window1
     
    这样user1在屏幕上操作的步骤,user2就能看到了,而且user2去掉了"写"权限,他只能看user1操作,退出使用Ctrl+a Ctrl+d键。
     
    9/2/2009

    useful unix command

    1. apropos         ;;lookup command
    2. pgrep            ;;find process
    3. pwgen           ;;generate secure password
    4. multitail         ;;view multi files
    5. zcat,zgrep,zless,zdiff     ;;operator compressed file directly, without uncompress them
    3/2/2009

    彩色的man pages

    export PAGER="/usr/bin/less -s"
    export BROWSER="$PAGER"
    export LESS_TERMCAP_mb=$'\E[01;34m'
    export LESS_TERMCAP_md=$'\E[01;34m'
    export LESS_TERMCAP_me=$'\E[0m'
    export LESS_TERMCAP_se=$'\E[0m'
    export LESS_TERMCAP_so=$'\E[01;44;33m'
    export LESS_TERMCAP_ue=$'\E[0m'
    export LESS_TERMCAP_us=$'\E[01;33m'
    11/28/2008

    免费注册Unix帐号

    http://www.prunk.si/mediawiki/index.php/Free_List

    http://bbs.chinaunix.net/viewthread.php?tid=1126814

    11/20/2008

    获取系统信息

    getconf命令加参数可以获取系统某些信息
    5/29/2008

    迅雷、快车、QQ下载地址分析

    迅雷:
    加密:"thunder://".base64_encode("AA".$txt1."ZZ");
    解密:substr(base64_decode(str_ireplace("thunder://","",$txt1)),2,-2);
     
    flashget:
    加密:"flashget://".base64_encode($txt2);
    解密:str_ireplace("[FLASHGET]","",base64_decode(str_ireplace("flashget://","",$txt2)));
     
    QQ:
    加密:"qqdl://".base64_encode($txt3);
    解密:base64_decode(str_ireplace("qqdl://","",$txt3));

    查看进程时间

    ps axfo time,stime,start_time,start,pid,comm

    pstree

    pstree -G: use VT100 line drawing characters
    5/21/2008

    gzexe

    gzexe can be used to create self-uncompressing executable file