存档

2010年5月 的存档

chroot-symlinks

2010年5月31日 16hot 没有评论

A typical scenario is one where “DefaultRoot ~” is used to restrict users to their home directories, and where the administrator would like to have a shared upload directory, say /var/ftp/incoming, in each user’s home directory. Symbolic links would normally be used to provide an arrangement like this. As mentioned above, though, when chroot(2) is used (which is what the DefaultRoot directive does), symlinks that point outside the new root (the user’s home directory in this case) will not work. To get around this apparent limitation, it is possible on modern operating systems to mount directories at several locations in the filesystem.

To have an exact duplicate of the /var/ftp/incoming directory available in /home/bob/incoming and /home/dave/incoming, use one of these commands:

    * Linux (as of the 2.4.0 kernel):

mount --bind /var/ftp/incoming /home/bob/incoming
  mount --bind /var/ftp/incoming /home/dave/incoming

    * BSD (as of 4.4BSD):

mount_null /var/ftp/incoming /home/bob/incoming
  mount_null /var/ftp/incoming /home/dave/incoming

    * Solaris:

mount -F lofs /var/ftp/incoming /home/bob/incoming
  mount -F lofs /var/ftp/incoming /home/dave/incoming

The same technique can be used for <Anonymous> directories, which also operate in a chroot()ed environment.

As usual, more information can be found by consulting the man pages for the appropriate command for your platform. The commands for other flavors of Unix will be added as needed.

In order to have these tricks persist, to survive a system reboot, the /etc/fstab (or /etc/vfstab) file may need to have these mounts added. Consult your local fstab(5) (or vfstab(4) for Solaris) man pages for more information.

http://www.proftpd.org/localsite/Userguide/linked/chroot-symlinks.html

分类: BSD/linux 标签: , , ,

统计状态说明

2010年5月30日 16hot 没有评论

The Statistics File

The statistics file generated by BIND 9 is similar, but not identical, to that generated by BIND 8.

The statistics dump begins with a line, like:

+++ Statistics Dump +++ (973798949)

The number in parentheses is a standard Unix-style timestamp, measured as seconds since January 1, 1970. Following that line are a series of lines containing a counter type, the value of the counter, optionally a zone name, and optionally a view name. The lines without view and zone listed are global statistics for the entire server. Lines with a zone and view name for the given view and zone (the view name is omitted for the default view).

The statistics dump ends with the line where the number is identical to the number in the beginning line; for example:

— Statistics Dump — (973798949)

The following statistics counters are maintained:

success The number of successful queries made to the server or zone. A successful query is defined as query which returns a NOERROR response with at least one answer RR.
referral The number of queries which resulted in referral responses.
nxrrset The number of queries which resulted in NOERROR responses with no data.
nxdomain The number of queries which resulted in NXDOMAIN responses.
failure The number of queries which resulted in a failure response other than those above.
recursion The number of queries which caused the server to perform recursion in order to find the final answer.

Each query received by the server will cause exactly one of success, referral, nxrrset, nxdomain, or failure to be incremented, and may additionally cause the recursion counter to be incremented.

分类: 16hot 杂记 标签:

使用rxvt-unicode

2010年5月30日 16hot 没有评论

在新笔记本,迁移到UTF-8环境下,mrxvt不支持UTF-8,中文显示乱码。只有换成rxvt-unicode了。支持UTF-8,中文输入。

配置文件:

$ cat ~/.Xresources
Xft.dpi:96
! Color setting
!URxvt.geometry: 200×53
URxvt.cursorColor:green
URxvt.foreground:black
URxvt.background:lightyellow
! transparent setting
URxvt.inheritPixmap:false
URxvt.tintColor:lightyellow
URxvt.shading:-80
! normal setting
URxvt.termName:rxvt
URxvt.cursorBlink:true
URxvt.saveLines:65535
URxvt.scrollBar_right:true
URxvt.scrollTtyKeypress:true
URxvt.scrollWithBuffer:false
!URxvt.font:xft:serif:pixelsize=13:antialias=false
!URxvt.font: 9x15bold,\
! -misc-fixed-bold-r-normal–15-140-75-75-c-90-iso10646-1,\
! -misc-fixed-medium-r-normal–15-140-75-75-c-90-iso10646-1,\
! [codeset=cp936]xft:serif:antialias=false, \
! xft:simsun:antialias=false

URxvt.font: -*-fixed-medium-r-*–14-*-*-*-*-*-iso10646-1,\
xft:simsun:pixelsize=14:antialias=false

! test modify ALT key value
!URxvt.insecure:true
!URxvt.modifier:alt
!URxvt.meta8:true
!XTerm*VT100*metaSendsEscape:true
urxvt*font:xft:SimSun:pixelsize=16
urxvt*imFont: -misc-simsun-medium-r-normal-0-0-0-0-p-0-iso10646-1
urxvt*inputMethod:SCIM
urxvt*preeditType: OverTheSpot
urxvt*multichar_encoding:noenc

分类: BSD/linux, Shell 标签: ,

入手X201i新笔记本

2010年5月28日 16hot 没有评论

今天拿到了新的X201i笔记本。 i5 M430 CPU,加到4G内存,换了块500G 7200转的硬盘。

拿到后,先是运行系统自带的windows7,确认机器没问题。之后加内存,换硬盘,安装FreeBSD AMD64版8.0系统。8.0-RELEASE,不支持笔记本的有线、无线网卡。幸好之前买了一块D-Link的USB无线网卡,先用着,更新到8-stable系统源码,重新编译升级到8-stable后,有线、无线网卡都支持了。

接下来就是需要确认是否支持显卡了,在下载和编译安装Xorg,Gnome2.30 。期待……

分类: 16hot 杂记 标签:

USB光盘刻录

2010年5月27日 16hot 没有评论

[x200: /opt/distfiles ]# cdrecord -scanbus
Cdrecord-Clone 2.01 (i386-unknown-freebsd8.0) Copyright (C) 1995-2004 Jöòg Schilling
Using libscg version ‘schily-0.8′.
scsibus1:
1,0,0   100) ‘TSSTcorp’ ‘CD/DVDW TS-H652M’ ‘CM01′ Removable CD-ROM
1,1,0   101) *
1,2,0   102) *
1,3,0   103) *
1,4,0   104) *
1,5,0   105) *
1,6,0   106) *
1,7,0   107) *
[x200: /opt/distfiles ]# cdrecord dev=1,0,0 -v speed=4 8.0-RELEASE-amd64-disc1.iso
cdrecord: No write mode specified.
cdrecord: Asuming -tao mode.
cdrecord: Future versions of cdrecord may have different drive dependent defaults.
cdrecord: Continuing in 5 seconds…
Cdrecord-Clone 2.01 (i386-unknown-freebsd8.0) Copyright (C) 1995-2004 Jöòg Schilling
TOC Type: 1 = CD-ROM
scsidev: ’1,0,0′
scsibus: 1 target: 0 lun: 0
Using libscg version ‘schily-0.8′.
SCSI buffer size: 64512
atapi: 0
Device type    : Removable CD-ROM
Version        : 0
Response Format: 2
Capabilities   :
Vendor_info    : ‘TSSTcorp’
Identifikation : ‘CD/DVDW TS-H652M’
Revision       : ‘CM01′
Device seems to be: Generic mmc2 DVD-R/DVD-RW.
Current: 0×0009
Profile: 0×0015
Profile: 0×0016
Profile: 0x002B
Profile: 0x001B
Profile: 0x001A
Profile: 0×0014
Profile: 0×0013
Profile: 0×0012
Profile: 0×0011
Profile: 0×0010
Profile: 0x000A
Profile: 0×0009 (current)
Profile: 0×0008
Profile: 0×0002
cdrecord: This version of cdrecord does not include DVD-R/DVD-RW support code.
cdrecord: If you need DVD-R/DVD-RW support, ask the Author for cdrecord-ProDVD.
cdrecord: Free test versions and free keys for personal use are at ftp://ftp.berlios.de/pub/cdrecord/ProDVD/
Using generic SCSI-3/mmc   CD-R/CD-RW driver (mmc_cdr).
Driver flags   : MMC-3 SWABAUDIO BURNFREE
Supported modes: TAO PACKET SAO SAO/R96P SAO/R96R RAW/R16 RAW/R96P RAW/R96R
Drive buf size : 1579776 = 1542 KB
FIFO size      : 4194304 = 4096 KB
Track 01: data   658 MB
Total size:      755 MB (74:53.69) = 337027 sectors
Lout start:      756 MB (74:55/52) = 337027 sectors
Current Secsize: 2048
ATIP info from disk:
Indicated writing power: 5
Is not unrestricted
Is not erasable
Disk sub type: Medium Type A, high Beta category (A+) (3)
ATIP start of lead in:  -11634 (97:26/66)
ATIP start of lead out: 359846 (79:59/71)
Disk type:    Short strategy type (Phthalocyanine or similar)
Manuf. index: 3
Manufacturer: CMC Magnetics Corporation
Blocks total: 359846 Blocks current: 359846 Blocks remaining: 22819
Starting to write CD/DVD at speed 8 in real TAO mode for single session.
Last chance to quit, starting real write    0 seconds. Operation starts.
Waiting for reader process to fill input buffer … input buffer ready.
BURN-Free is OFF.
Performing OPC…
Starting new track at sector: 0
Track 01:  658 of  658 MB written (fifo 100%) [buf 100%]   8.5x.
Track 01: Total bytes read/written: 690227200/690227200 (337025 sectors).
Writing  time:  572.721s
Average write speed   8.0x.
Min drive buffer fill was 99%
Fixating…
cdrecord: Input/output error. close track/session: scsi sendcmd: retryable error
CDB:  5B 00 02 00 00 00 00 00 00 00
status: 0×2 (CHECK CONDITION)
Sense Bytes: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Sense Key: 0xFFFFFFFF [], Segment 0
Sense Code: 0×00 Qual 0×00 (no additional sense information) Fru 0×0
Sense flags: Blk 0 (not valid)
cmd finished after 9.767s timeout 480s
cmd finished after 9.767s timeout 480s
cdrecord: Cannot fixate disk.
Fixating time:   40.225s
cdrecord: fifo had 10872 puts and 10872 gets.
cdrecord: fifo was 0 times empty and 10793 times full, min fill was 89%.
[x200: /opt/distfiles ]#

分类: BSD/linux 标签:

车做完首保了

2010年5月22日 16hot 没有评论

车买了4个多月,跑了差不多3000公里了,也该做首保了。

在周六(22日)的时候,将车开去4S店,做首保,随便报了保险,给刮蹭的地方喷喷漆。报保险还挺麻烦,填好单子,定损,打电话报案,获取了报案号后,填到单子里,然后去维修……

今天去取车,都喷好漆了,感觉还很不错的。呵呵

迟些找二毛帮忙叫人跑跑高速,看看有没有什么改善的地方。

分类: 16hot 杂记 标签:

shell脚本编译

2010年5月18日 16hot 没有评论

今天发现一个好玩的东东,可以将shell脚本编译一下。

http://www.datsi.fi.upm.es/~frosal/sources/shc.html

文档:

Manpage for shc(1)


NAME

     shc - Generic shell script compiler

SYNOPSIS

     shc [ -e date ] [ -m addr ] [ -i iopt ] [ -x cmnd ]
     [ -l lopt ] [ -ACDhTv ] -f script

DESCRIPTION

     shc creates a stripped  binary  executable  version  of  the
     script specified with -f on the command line.

     The binary version will get a .x extension appended and will
     usually  be  a  bit  larger  in size than the original ascii
     code. Generated C source code is saved in a  file  with  the
     extension .x.c

     If you supply an expiration date with the -e option the com-
     piled  binary  will  refuse to run after the date specified.
     The message "Please contact your provider" will be displayed
     instead.  This message can be changed with the -m option.

     You can compile any kind of shell script, but  you  need  to
     supply valid -i, -x and -l options.

     The compiled binary will still be  dependent  on  the  shell
     specified  in  the  first  line  of  the  shell  code  (i.e.
     #!/bin/sh), thus shc does not create completely  independent
     binaries.

     shc itself is not a compiler such as cc, it  rather  encodes
     and encrypts a shell script and generates C source code with
     the added expiration capability. It  then  uses  the  system
     compiler  to compile a stripped binary which behaves exactly
     like the  original  script.  Upon  execution,  the  compiled
     binary  will  decrypt and execute the code with the shell -c
     option.  Unfortunatelly, it will  not  give  you  any  speed
     improvement as a real C program would.

     shc's main purpose is to protect  your  shell  scripts  from
     modification  or  inspection.  You can use it if you wish to
     distribute your scripts but don't want  them  to  be  easily
     readable by other people.

OPTIONS

     The command line options are:

     -e date
          Expiration date in dd/mm/yyyy format [none]

     -m message
          message to display  upon  expiration  ["Please  contact
          your provider"]

     -f script_name
          File name of the script to compile

     -i inline_option
          Inline option for the shell interpreter i.e: -e

     -x comand
          eXec    command,    as    a    printf    format    i.e:
          exec(\\'%s\\',@ARGV);

     -l last_option
          Last shell option i.e: --

     -r   Relax security. Make  a  redistributable  binary  which
          executes  on different systems running the same operat-
          ing system.

     -v   Verbose compilation

     -D   Switch on debug exec calls

     -T   Allow binary to be  traceable  (using  strace,  ptrace,
          truss, etc.)

     -C   Display license and exit

     -A   Display abstract and exit

     -h   Display help and exit

ENVIRONMENT VARIABLES

     CC   C compiler command [cc]

     CFLAGS
          C compiler flags [none]

EXAMPLES

     Compile a script which can be run on other systems with  the
     trace option enabled:

       example% shc -v -r -T -f myscript

BUGS

     The  maximum  size  of the script that could be executed once com�
     piled is limited by the operating system  configuration  parameter
     _SC_ARG_MAX (see sysconf(2))

AUTHOR

     Francisco Rosales <frosal@fi.upm.es>

REPORT BUGS TO

     the author.
分类: Shell 标签:

一颗璀璨的月光宝石–Lua(转)

2010年5月16日 16hot 没有评论

1993年在巴西里约热内卢天主教大学(Pontifical Catholic University of Rio de Janeiro in Brazil)诞生了一门编程语言,发明者是该校的三位研究人员,他们给这门语言取了个浪漫的名字——Lua,在葡萄牙语里代表美丽的月亮。事实证明她没 有糟蹋这个优美的单词,Lua语言正如它名字所预示的那样成长为一门简洁、优雅且富有乐趣的语言。

Lua从一开始就是作为一门方便嵌入(其它应用程序)并可扩展的轻量级脚本语言来设计的,因此她一直遵从着简单、小巧、可移植、快速的原则,官 方实现完全采用ANSI C编写,能以C程序库的形式嵌入到宿主程序中。Lua的每个版本都保持着开放源码的传统,不过各版采用的许可协议并不相同,自5.0版(最新版是5.1) 开始她采用的是著名的MIT许可协议。正由于上述特点,所以Lua在游戏开发、机器人控制、分布式应用、图像处理、生物信息学等各种各样的领域中得到了越 来越广泛的应用。其中尤以游戏开发为最,许多著名的游戏,比如Escape from Monkey Island、World of Warcraft、大话西游,都采用了Lua来配合引擎完成数据描述、配置管理和逻辑控制等任务。

作为一门过程型动态语言,Lua有着如下的特性:

1、变量名没有类型,值才有类型,变量名在运行时可与任何类型的值绑定;

2、语言只提供唯一一种数据结构,称为表(table),它类似key-value关联数组,可以用任何类型的值作为key和value。提供 了一致且富有表达力的表构造语法,使得Lua很适合描述复杂的数据;

3、函数是一等类型,支持匿名函数和正则尾递归(proper tail recursion);

4、支持词法定界(lexical scoping)和闭包(closure);

5、提供thread类型和结构化的协程(coroutine)机制,在此基础上可方便实现协作式多任务;

6、运行期能编译字符串形式的程序文本并载入虚拟机执行;

7、通过元表(metatable)和元方法(metamethod)提供动态元机制(dynamic meta-mechanism),从而允许程序运行时根据需要改变或扩充语法设施的内定语义;

8、能方便地利用表和动态元机制实现基于原型(prototype-based)的面向对象模型;

9、从5.1版开始提供了完善的模块机制,从而更好地支持开发大型的应用程序;

Lua的语法类似PASCAL和Modula但更加简洁,所有的语法产生式规则(EBNF)不过才60几个。熟悉C和PASCAL的程序员一般 只需半个小时便可将其完全掌握。而在语义上Lua则与Scheme极为相似,她们完全共享上述的1、3、4、6点特性, Scheme的continuation与协程也基本相同只是自由度更高。最引人注目的是,两种语言都只提供唯一一种数据结构:Lua的表和Scheme 的列表(list)。正因为如此,有人甚至称Lua为“只用表的Scheme”。 阅读全文…

分类: LUA, 转载 标签:

孩子满月了

2010年5月15日 16hot 没有评论

孩子都已经满月了,今天办了满月酒。还是在吉祥鸟湘菜。我们08年的婚宴是在那里,而且就是4月12日。而我们孩子的生日,也是4月12日,非常巧合。这也是准备通知大家聚聚,翻以前的邮件才发现的。

本来也没有计划大张旗鼓的办,只是邀请了几位同事和朋友,还有老婆的同学。基本算是家庭聚餐之类的吧,他们也带着孩子过来。很热闹。

我们家小家伙也到酒店去。不过在那边就老睡觉,谁也不理。这家伙,回家后,又很精神了。

分类: 16hot 杂记 标签:

MySQL 分支 MariaDB

2010年5月7日 16hot 没有评论

MariaDB 是一个采用 Maria 存储引擎的 MySQL 分支版本,是由原来 MySQL 的作者 Michael Widenius 创办的公司所开发的免费开源的数据库服务器。

与 MySQL 相比较,MariaDB 更强的地方在于:

  • Maria 存储引擎
  • PBXT 存储引擎
  • XtraDB 存储引擎
  • FederatedX 存储引擎
  • 更快的复制查询处理
  • 线程池
  • 更少的警告和bug
  • 运行速度更快
  • 更多的 Extensions (More index parts, new startup options etc)
  • 更好的功能测试
  • 数据表消除
  • 慢查询日志的扩展统计
  • 支持对 Unicode 的排序
分类: MySQL 标签: ,