laye's profiletR@Ce<laye>PhotosBlogListsMore Tools Help

tR@Ce<laye>

In The Name of Bach
September 11

notes

" Vim color file
" carvedwood v0.7a
" Maintainer:	Shawn Axsom 
"               [axs221.1l.com]

" carvedwood -
"     a color scheme modified from my desertocean scheme into a brown
" and green scheme, easier on the eyes and optimized for more important syntax
" to stand out the most (eg comments and values are dark and dull while
" statements are bright).

" cool help screens
" :he group-name
" :he highlight-groups
" :he cterm-colors

set background=dark
if version > 580
    " no guarantees for version 5.8 and below, but this makes it stop
    " complaining
hi clear 
    if exists("syntax_on")
		syntax reset
    endif
endif

let g:colors_name="carvedwood"

hi Normal ctermbg=233 ctermfg=247 guibg=#111410 guifg=#b09aa0
hi NonText ctermbg=234 ctermfg=236 guibg=#1a1d1a guifg=#382920

" syntax highlighting
hi Comment ctermfg=237 guifg=#403b43
hi Title ctermfg=74 guifg=#60b0ea
hi Underlined ctermfg=110 guifg=#80aae0
hi Statement ctermfg=224 guifg=#fac5b3
hi Type ctermfg=138 guifg=#c5908a
hi Constant ctermfg=95 guifg=#7b5b5d
hi PreProc cterm=none ctermfg=174 gui=none guifg=#c07a6a
hi Identifier ctermfg=131 guifg=#b36d70
hi Special ctermfg=242 guifg=#606A70
hi Ignore ctermfg=241 guifg=#666666
hi Todo ctermbg=11 ctermfg=9 guibg=#eeee00 guifg=#ff4500
hi Error ctermbg=161 guibg=#e04462
"end syntax highlighting

" highlight groups
"hi CursorIM
hi Directory ctermfg=152 guifg=#bbd0df
"hi DiffAdd
"hi DiffChange
"hi DiffDelete
"hi DiffText
"hi ErrorMsg

hi Cursor ctermbg=23 ctermfg=109 guibg=#205a50 guifg=#7ab0aa

hi FoldColumn ctermbg=237 ctermfg=81 guibg=#403533 guifg=#00CCFF
hi LineNr ctermbg=239 ctermfg=251 guibg=#594540 guifg=#D0C0BA
hi StatusLine cterm=none ctermbg=181 ctermfg=234 gui=none guibg=#c99f93 guifg=#102015
hi StatusLineNC cterm=none ctermbg=138 ctermfg=236 gui=none guibg=#937b7a guifg=#373334

hi Search ctermbg=242 ctermfg=251 guibg=#5a6d7d guifg=#bac5d0
hi IncSearch ctermbg=189 ctermfg=59 guibg=#cddaf0 guifg=#50606d

hi VertSplit cterm=none ctermbg=144 ctermfg=8 gui=none guibg=#c2bfa5 guifg=#7f7f7f
hi Folded ctermbg=23 ctermfg=152 guibg=#0a4f4d guifg=#BBDDCC
hi ModeMsg ctermfg=38 guifg=#00AACC
hi MoreMsg ctermfg=181 guifg=SeaGreen
hi Question ctermfg=250 guifg=#AABBCC
hi SpecialKey ctermfg=137 guifg=#90703B
hi Visual ctermbg=44 ctermfg=31 guibg=#33DFEF guifg=#008FBF
"hi VisualNOS
hi WarningMsg ctermfg=210 guifg=#fa8072
"hi WildMenu
"hi Menu
"hi Scrollbar  guibg=grey30 guifg=tan
"hi Tooltip


"vim: sw=4
# ===============================================================
# File:                 $HOME/.screenrc
# Purpose:              Setup file for program "(GNU) screen"
# written by:           Sven Guckes 
# Latest update:        Sat Feb 16 06:00:00 MET 2002
# Latest user version:  screen-3.9.11      [020215]
# Latest beta version:  screen-3.9.11beta6 [020206]
# Length and size:      450 lines and about 15 kilobytes
# ===============================================================
#
# ===============================================================
# SEE ALSO:
# ===============================================================
# SCREEN Pages:
# http://www.math.fu-berlin.de/~guckes/screen/
#
# Commands List (from the manual to screen-3.7.6):
# http://www.math.fu-berlin.de/~guckes/screen/commands.txt
#
# MailingList:
# http://www.yahoogroups.com/group/gnu-screen/
#
# ===============================================================
# ESCAPE - the COMMAND CHARACTER
# ===============================================================
# escape ^aa  # default
 escape ^oo  # suggested binding for emacs users
#
# ===============================================================
# STARTUP of programs in an extra window:
# ===============================================================
# Uncomment one/some following lines to automatically let
# SCREEN start some programs in the given window numbers:
#screen -t irssi			0 irssi
#screen -t mutt       1 mutt
# screen -t EDIT        2 vim
# screen -t GOOGLE      3 links http://www.google.com
# screen -t NEWS        4 slrn
# screen -t WWW         5 links http://www.math.fu-berlin.de/~guckes/
#
# ===============================================================
# VARIABLES - Boolean values (on/off)
# ===============================================================
  autodetach            on              # default: on
  crlf                  off             # default: off
  deflogin              off             # default: on
# defsilence            off             # default: off
  hardcopy_append       on              # default: off
# nethack               on              # default: off
  startup_message       off             # default: on
# termcap  xterm        'AF=\E[3%dm:AB=\E[4%dm'
# terminfo xterm        'AF=\E[3%p1%dm:AB=\E[4%p1%dm'
# Matthias Kopfermann  [020222]:
#  termcapinfo linux "ve=\E[?25h\E[?17;0;64c" # red
  termcapinfo linux* 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
  termcapinfo xterm* 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
  
  vbell                 off             # default: ???
#
# ===============================================================
# VARIABLES - Number values
# ===============================================================
  defscrollback         3000            # default: 100
# msgminwait            3               # default: 1
  silencewait           15              # default: 30
#
# ===============================================================
# VARIABLES - Paths and Files (esp. programs)
# ===============================================================
# bufferfile:   The file to use for commands
#               "readbuf" ('<') and  "writebuf" ('>'):
# bufferfile            $HOME/.screen_exchange
#
# hardcopydir:  The directory which contains all hardcopies.
# hardcopydir           ~/.hardcopy
# hardcopydir           ~/.screen
#
# shell:  Default process started in screen's windows.
# Makes it possible to use a different shell inside screen
# than is set as the default login shell.  Halleluja! :-)
# shell                 zsh
 shell                 bash
 shelltitle            "$ |bash"
# shell                 ksh
#
# ===============================================================
# VARIABLES - Strings
# ===============================================================

# some notes on COLOR before explaining its use in
# the commands caption, hardstatus, and sorendition.
#
# COLOR:  colors codes are combinations of
# [attribute modifier] [color description]
# the manual talks of "attribute/color modifiers".
# see the manual, section "STRING ESCAPES".
#
# Color table:
# 0 Black             .    leave color unchanged
# 1 Red               b    blue
# 2 Green             c    cyan
# 3 Brown / yellow    d    default color
# 4 Blue              g    green           b    bold
# 5 Purple            k    blacK           B    blinking
# 6 Cyan              m    magenta         d    dim
# 7 White             r    red             r    reverse
# 8 unused/illegal    w    white           s    standout
# 9 transparent       y    yellow          u    underline
#
# note: "dim" is not mentioned in the manual.
#
# ===========================================
# CAPTION - shows a "caption" for the window.
# ===========================================
# a "caption" is another line which can show information -
# in addition to the hardstatus line.
#
# use caption to show window list:
#caption always "%{= kw}%?%-Lw%?%{+b kw}%n*%t%f %?(%u)%?%{= kw}%?%+Lw%?"


# caption always '%{= wb}%50=%n%f %t%{= wb}'
# this basically just shows the current window number and title
# on its own; the "%50=" displays it in the middle of the line.
#
# caption always "%>%{wk}%?%-Lw%?%{bw}%n*%f %t%?(%u)%?%{wk}%?%+Lw%?%<"
# caption always "%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<"
# caption always "%?%F%{.RW}%?%3n %t%? [%h]%?"
# caption always "%{rk}%H %{gk}%c %{yk}%M%d %{wk}%?%-Lw%?%{bw}%n*%f %t%?(%u)%?%{wk}%?%+Lw%?"
#
#  caption always "%{kG}%?%-Lw%?%{bw}%n*%f %t%?(%u)%?%{kG}%?%+Lw%?"
#
# "push right border: current time with seconds and current date"
# caption always "%=%c:%s %Y-%m-%d"
#
# Prints the window names and highlight the current window in yellow.
# On the right there is the time in green and the date in yellow.
#
#caption always "%?%{+b kw}%-Lw%?%{yK}%n*%f %t%?(%u)%?%?%{wk}%+Lw%? %{gk}%=%c %{yk}%d/%M/%Y"

#
# ===============================================================
#
# ===============================
# Hardstatus Line and sorendition
# ===============================
#
# Prints the window names and highlight the current window in yellow.
# On the right there is the time in green and the date in yellow.
#
#hardstatus alwayslastline "%?%{wk}%-Lw%?%{+b bk}%n*%f %t%?(%u)%?%?%{-b wk}%+Lw%? %=%{-b yk}[%l] %{-b gk}%c:%s"
hardstatus alwayslastline '%{gk}[ %{G}%H %{g}][%= %{wk}%?%-Lw%?%{=b kR}(%{W}%n*%f %t%?(%u)%?%{=b kR})%{= kw}%?%+Lw%?%?%= %{g}][%{Y}%l%{g}]%{=b C}[ %m/%d %c ]%{W}'
#hardstatus alwayslastline "%{+b kr}[ %H ] %{ky} Load: %l %-=%{kb} %c  %d.%m.%Y"

#hardstatus alwayslastline "%{+b kr}[ %H ] %{kw} Load: %l %-=%  %{kb} %c:%s  %d.%m.%Y "


# Colorize the "messages" and "text marking":
# Example:  Blue bg, white fg
 sorendition gK
#
# ============================
# Password
# ============================
# password SZnBqiqMtfa6k
# Do NOT remove the comment if
# you don't know what this does!
# (TODO describe the effect - obviously)
#
# ===============================================================
# Messages
# ===============================================================
# There are two kinds of messages:  "activity" and "bell"
# They are also the names of the commands that set the
# respective messages.  In every message there can be "meta
# strings" which are replaced by values.  A meta string starts
# with a percent sign and is then followed by one of the
# following letters: aAdDmMnstwWyY The meta strings refer to
# the current date and time or to a window title or number:
#   %t - title
#   %n - number (a single % still works)
#   %d - day
#   %D - weekday name
#   %m - month
#   %M - month name
#   %y - year (2 digit)
#   %Y - year (4 digit)
#   %w - hour:minutes (24h format)
#   %W - hour:minutes (12h format)
#   %s - seconds
#   %a - am/pm
#   %A - AM/PM
# Older versions of screen used a single '%' character
# for window titles - but since version 3.7 this is
# obsoleted by '%n' and will vanish in future releases!
# So please update your screenrc to meet this convention!
#
# ===============================================================
# "~" stands for the "bell" character
#
# activity:     This message *includes* a "beep" with '~'.
  activity              "activity in %n (%t) [%w:%s]~"
#
# bell:         This message *includes* a "beep" with '~'.
  bell                  "bell     in %n (%t) [%w:%s]~"
#
# pow_detach_msg:       Message shown when session
#                       gets power detached.
  pow_detach_msg        "BYE"
#
# vbell_msg:            Message shown when the
#                       "virtual bell" rings.
  vbell_msg             " *beep* "
#
# ==============================================================
#  BIND bind - defaults
# ==============================================================
# The "bind" command assign keys to (internal) commands
# SCREEN checks all the keys you type; you type the key
# which is known as the "command character" then SCREEN
# eats this key, too, and checks whether this key is
# "bound" to a command.  If so then SCREEN will execute it.
#
# The command "bind" allows you to chose which keys
# will be assigned to the commands.
#
# Some commands are bound to several keys -
# usually to both some letter and its corresponding
# control key combination, eg the command
# "(create) screen" is bound to both 'c' and '^C'.
#
# The following list shows the default bindings:
#
# break       ^B b
# clear       C
# colon       :
# copy        ^[ [
# detach      ^D d
# digraph     ^V
# displays    *
# dumptermcap .
# fit         F
# flow        ^F f
# focus       ^I
# hardcopy    h
# help        ?
# history     { }
# info        i
# kill        K k
# lastmsg     ^M m
# license     ,
# log         H
# login       L
# meta        x
# monitor     M
# next        ^@ ^N sp n
# number      N
# only        Q
# other       ^X
# pow_break   B
# pow_detach  D
# prev        ^H ^P p ^?
# quit        \
# readbuf     <
# redisplay   ^L l
# remove      X
# removebuf   =
# reset       Z
# screen      ^C c
# select      " '
# silence     _
# split       S
# suspend     ^Z z
# time        ^T t
# title       A
# vbell       ^G
# version     v
# width       W
# windows     ^W w
# wrap        ^R r
# writebuf    >
# xoff        ^S s
# xon         ^Q q
# ^]  paste .
# -   select -
# 0   select 0
# 1   select 1
# 2   select 2
# 3   select 3
# 4   select 4
# 5   select 5
# 6   select 6
# 7   select 7
# 8   select 8
# 9   select 9
# I   login on
# O   login off
# ]   paste .
#
# FAQ: So many keys are bound to some command already -
#      which keys are unbound yet? Which are free for binding?
# A:   SCREEN does not have a command to show you
#      a table of currently unbound keys - sorry!
#      You simply have to read this setup file. ;-)
#
#      Summary:  Here is a table of the keys
#      which are not bound by default:
#      unbound:  -B--E-G--J-L---P-R-TUV--Y-
#        bound:  A-CD-F-HI-K-MNO-Q-S---WX-Z
#
# And here are the default bind commands if you need them:
#
# bind A title
# bind C clear
# bind D pow_detach
# bind F fit
# bind H log
# bind I login on
# bind K kill
# bind L login
# bind M monitor
# bind N number
# bind O login off
# bind Q only
# bind S split
# bind W width
# bind X remove
# bind Z reset
#
# I suggest that you don't change the bidnings for
# 'H' ("log") and 'M' ("monitor") as they are really
# useful and you might want to use them a lot;
# in this case it is recommended to use
# the defaults to avoid confusion.
# personally, I use 'A' ("title") quite often, too.
#
# If you are using "split windows" already
# (this is not available in the latest user release yet)
# then you will also use the command
# associated with the keys FQSX a lot, too -
# so don't change their bindings!
#
# Anyway, I have bound the unbound uppercase letters
# to start programs in windows directly, ie without
# starting a new window with a shell within first.
# This simply saves shells and thus saves RAM -
# and also avoids that the title of a windows is
# the name of your shell.  Also, you need not "exit"
# from a shell when you are done with some program:
#
# ==============================================================
# BIND and the Services:
# ==============================================================
# I am using the uppercase letters to start programs/services:
#
 bind A title  # default!
#
# BUUG - Berlin Unix User Group - read some news about Unix
#  bind B screen -t 'buug' 4 links www.buug.de
#
# CHEM - LinuxTag event in Chemnitz -- 2002-03-09 + 2002-03-10
#  bind C screen -t 'CHEM' 9 links www.tu-chemnitz.de/linux/tag/
# NOTE:  This overrides the default binding for the "clear" command.
#
# DICT - Dictionary English<->German
# bind D pow_detach !
#  bind D screen -t 'DICT' 4 links dict.tu-chemnitz.de
# Note: this overrides the default binding for the
# command "pow_detach".  I hardly ever use that one.
#
# MUTT - Email User Agent
#  bind E screen -t 'mail' 0 mutt
# I use email quite a lot - so window #0 is reserved for that.
# see also:  http://www.math.fu-berlin.de/~guckes/mutt/
#
# FTP - File Transfer "Program"
# bind F fit # default!
# bind F screen -t 'ftp' 9 ncftp
# see also:  http://www.math.fu-berlin.de/~guckes/ncftp/
#
# GOOGLE - Web Search Engine
  bind ^g  screen -t 'Google' links www.google.com
#
# HEISE - IT NewsTicker
# bind H log # default!
#  bind H screen -t HeiseTicker links www.heise.de
# NOTE: This overrides the default binding of the "hardcopy" command!
#
# IRC - International Relay Chat
# bind I screen -t 'irc'  5 irc
# bind I screen -t 'icq'  9 micq
# see also:  http://www.math.fu-berlin.de/~guckes/irc/
#
# Feb 2002:  Use it to search the Internet Movie DataBase (IMDB):
# bind I screen -t 'IMDB' 9 links http://www.imdb.com/
#  bind I screen -t 'IMDB' 9 links http://us.imdb.com/search/
# see also: http://www.math.fu-berlin.de/~guckes/berlinale/
#
 bind K  kill # default!
#   bind K
# This *removes* the binding for 'K'
# thus requireing you to enter the
# command via the command line, ie ":kill".
# This prevent accidental killing of your windows.
# Old versions of SCREEN do not prompt for
# confirmation on "killing a window", you see..
#
# LYNX - web browser
# bind L screen -t 'lynx' 4 lynx  http://www.math.fu-berlin.de/~guckes/
# see also:  http://www.math.fu-berlin.de/~guckes/lynx/
#
# see also:  http://www.math.fu-berlin.de/~guckes/links/
# bind L screen -t 'WWW'  4 links http://www.math.fu-berlin.de/~guckes/
#
# bind L screen -t 'WWW'  4 links http://www.lug-camp-2002.de/programm.html
# bind L screen -t 'WWW'  4 links http://www.mdlug.de/index.php/linuxtag2002/vortraege/v12.inc?menu=0|4|
# bind L screen -t 'WWW'  4 links http://www.mdlug.de/index.php/linuxtag2002/programm.inc?menu=0|4|&nomfc=1
#
 bind M monitor # default!
#
# NN - newsreader
# bind N screen -t 'nn'   3 nn
# see also:  http://www.math.fu-berlin.de/~guckes/nn/
# Get some news about the weather... (dont ask ;-)
#  bind N screen -t 'Nepal'  links http://www.wunderground.com/global/stations/44454.html
# bind N screen -t 'Nepal'  links http://www.wunderground.com/global/stations/10382.html
#
# Paste - use 'P' instead of ']':
  bind P paste .
# The character ']' is hard to type on german keyboards,
# as it requires the use of a yet another meta character "AltGR".
# I prefer to use 'P' for "paste" because it is a letter
# which is available at the same position both with the
# US keyboards and keyboards with "Kraut layout" -
# which I call" Krautboards", by the way. ;-)
# bind ] paste . # default!
#
#      Register page at NetMind's Service:
#  bind R screen links http://www.netmind.com/URL-minder/new/register.html
#
#
# SLRN - newsreader
#  bind S screen -t 'slrn' 3 slrn -n -C -k0
# see also:  http://www.slrn.org  http://slrn.sourceforge.net
# and        http://www.math.fu-berlin.de/~guckes/slrn/
#
# VIM - editor
  bind V screen -t 'vim' 0 vim
# Editing comes with email quite naturally -
# so I have reserved window #1 for this.
# http://www.math.fu-berlin.de/~guckes/vim/
# http://www.vim.org/ (which is just a mirror)
#
#      X - a fast way to lock the current screen.
#  bind X lockscreen
#
# bind Y exec !!! echo -n http://www.math.fu-berlin.de/~guckes/
#  bind Y stuff http://www.math.fu-berlin.de/~guckes/
# This pastes the address of my homepage to the process
# in the current window.  very nice - saves some typing.
# and you don't have to have the functionality of
# "abbreviating" in the processes themselves. :-)
#
# my binds
#
#  bind ^w screen -t 'watch' $HOME/.screen/scripts/tetherwatch
#  bind ^c screen -t 'capture' $HOME/.screen/scripts/tethercapture
#  bind ^r screen -t 'output'  $HOME/.screen/scripts/tetherout
#  bind ^o screen -t 'output-short' $HOME/.screen/scripts/tetherout.short
#  bind ^t screen -t 'sysinfo' top

#bind ^N screen -t 'news' links www.debian.de/News/weekly/index.de.html
#bind ^M screen -t w3m cm.adrenalin.de
#bind ^L screen -t watch -n 5 tail -45 /var/log/sysloc
bind ^Y screen -t log watch -n 5 rail -40 /var/log/syslog

#
#
# ===============================================================
# BIND Examples:
# ===============================================================
# You can also paste the values of
# SCREEN's environment variables:
# bind E stuff $EMAIL
# bind U stuff $URL
# bind I stuff $ICQ
#
# ===============================================================
# BINDKEY:
# ===============================================================
# [TODO briefly explain the difference between BIND and BINDKEY]
#
# Use the function keys F7 and F8
# to cycle backwards/forwards in
# the list of existing windows:
bindkey "^[[1;5D" prev
bindkey "^[[1;5C" next
#
# make the "kb" send a backspace (CTRL-H:)
# bindkey -d kb stuff ^H
# WARNING:  this does not work as advertised.
# it eats the "kb" when typing "dankbar" for example. :-(
#
#
# ===============================================================
# Key bindings  (TODO)
# ===============================================================
# Remove some default key bindings by binding
# them to "nothing" (empty right-hand-side):
#
# bind .  dumptermcap # default
  bind .
# bind ^\ quit        # default
  bind ^\
# bind \\ quit        # default
  bind \\
# bind h  hardcopy    # default
# bind h
# bind ^h ???         # default
# bind ^h
# bind }  history     # default
# bind }
#
#
# ===============================================================
# At the very end... show the current version and say hello :-)
# ===============================================================
# Briefly show the version number of this starting
# screen session - but only for *one* second:
  msgwait 1
  version
# change back to showing messages
# for duration of two seconds:
  msgwait 2
#
# Welcome the user:
  echo "welcome :-)"
#
# Ths DISPLAY variable keeps getting in my way.
# usually I do not want to start programs which
# need a DISPLAY.  Text Tools rule!  :-)
#  setenv DISPLAY ''
#
# Tell Vim to use a "tabstop" of '8',
# ie expands TABs to the next column
# whose number is a multiple of eight.
# EOF  vim: ts=8

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

# don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=ignoredups
# ... and ignore same sucessive entries.
export HISTCONTROL=ignoreboth

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color)
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
    ;;
*)
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
    ;;
esac

# Comment in the above and uncomment this below for a color prompt
#PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
    ;;
*)
    ;;
esac

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

#if [ -f ~/.bash_aliases ]; then
#    . ~/.bash_aliases
#fi

# enable color support of ls and also add handy aliases
if [ "$TERM" != "dumb" ]; then
    eval "`dircolors -b`"
    alias ls='ls --color=auto'
    #alias dir='ls --color=auto --format=vertical'
    #alias vdir='ls --color=auto --format=long'
fi

# some more ls aliases
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'
alias grep='grep --color=always'
alias hg='history | grep'
alias rm='rm -i'

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
fi

# laye's prompt

if [ $TERM == 'screen' ]; then
    PS1='\n\[\e[1;32m\]\u\[\e[1;31m\]@\h\[\e[m\](\j) \w\n\[\ek\e\\\]$ '
else
    PS1='\n\[\e[1;32m\]\u\[\e[1;31m\]@\h\[\e[m\](\j) \w\n\$ '
fi 

export PS1
May 26

A Perl script against ARP attacking

use strict;
use warnings;

use Net::ARP;

my $dev = "eth0";
my $my_ip = "10.100.102.10";
my $rt_ip = "10.100.102.250";
my $rate = 0.5;

my $my_mac = Net::ARP::get_mac($dev);
my $bc_mac = "ff:ff:ff:ff:ff:ff";
my $bc_ip = $my_ip;
$bc_ip =~ s/\.\d+$/\.255/;

$| = 1;
print "Working  ";
while (1) {
    Net::ARP::send_packet
        ($dev, $my_ip, $bc_ip, $my_mac, $bc_mac, "reply");
    Net::ARP::send_packet
        ($dev, $my_ip, $rt_ip, $my_mac, $bc_mac, "request");
    for ('/', '|', '\\', '-') {
        print "\b$_";
        select undef, undef, undef, $rate / 4.0;
    }
}

May 02

...

... ...
... ...

她曾有明亮的眼睛,穿着天鹅绒连衣裙 elle avait les yeux clairs et la robe en velours
在他母亲旁边,周围是他的家人 a coté de sa mere et la famille autour
在黄昏柔和的阳光下显得有些庸懒 elle pose un peu discrete au doux soleil de la fin du jour
虽然相片拍得并不完美,但我们从中可以看到 La photo n’est pas bonne mais on peut y voir
相片主人公的幸福和夜晚的柔和 le bonheur en personne et la douceur d’un soir
她曾热爱音乐,尤其是舒曼和莫扎特的音乐 Elle aimait la musique surtout Schuman et puis Mozart
象你一样,象你一样,象你一样,象你一样,Comme toi, comme toi comme toi .....
象你一样,象你一样,象你一样,象你一样,Comme toi, comme toi comme toi .....
象你一样,我在下面看着你 Comme toi que je regarde tout bas
象会在睡梦中想象你一样 Comme toi qui dors en revant a quoi?
象你一样,象你一样,象你一样,象你一样。comme toi, comme toi comme toi....
她曾在山下村庄上学 Elle allait a l’ecole au village d’en bas
她曾学习看书,她曾学习法律 elle apprennait les livres elle apprennait les lois
她曾为青蛙王子和树林里沉睡的公主而歌唱elle chantait les grenouilles et les princesses dorment au bois
她曾喜欢过她的娃娃,她曾爱过她的朋友 elle aimait sa poupée elle aimait ses amies
特别是Ruth,Anna,和Jeremie surtout ruth et anna et surtout jeremy
他们俩有一天可能会在华沙结婚et ils se mariraient un jour peut etre a Varsovie
象你一样,象你一样,象你一样,象你一样,Comme toi, comme toi comme toi....
象你一样,象你一样,象你一样,象你一样,Comme toi, comme toi comme toi....
象你一样,我在下面看着你 Comme toi que je regarde tout bas
象会在睡梦中想象你一样 COmme toi qui dors en revant a quoi?
象你一样,象你一样,象你一样,象你一样,comme toi, comme toi comme toi....
她叫Sarah,还不满8岁 Elle s’apellait sarah elle n’avait pas 8 ans
生活对她而言曾是温柔、梦想和白云 sa vie s’etait douceur, reves et nuages blancs
但别人却决定了她另一个命运 Mais d’autres gens en avaient decidé autrement
她曾有着明亮的眼睛,她和你年龄相仿 Elle avait tes yeux clairs et elle avait oton age
这曾是一个单纯而乖巧的女孩 C’etait une petite fille sans histoire et tres sage
但她没能和您一样出生在这里,而现在...... mais elle n’est pas née comme toi ici et maintenant
象你一样,象你一样,象你一样,象你一样,Comme toi comme toi comme toi....
象你一样,象你一样,象你一样,象你一样,Comme toi comme toi comme toi....
象你一样,我在下面看着你 Comme toi que je regarde tout bas
象会在睡梦中想象你一样 COmme toi qui dors en revant a quoi?
象你一样,象你一样,象你一样,象你一样。comme toi, comme toi comme toi....





February 08

Behold, my new CPAN modules


Algorithm::LBFGS - Perl extension for L-BFGS
AI::MaxEntropy - Perl extension for learning Maximum Entropy Models

Thanks Qi Zhang for his help on mathematics.

And happy lunar new year to all ^_^


January 20

MIT sketching software ~ Cool


Cute and incredible:

http://www.youtube.com/watch?v=NZNTgglPbUA

And, you may want to download it freely from here:

http://icampus.mit.edu/MagicPaper/

November 12

Busan, Korea

刚到韩国的时候,完全没有意识到自己是在另一个国家,因为,走在大街上,无论是面孔还是街景,都几乎和国内一模一样。只是文字换成了弯弯扭扭的韩国字,语言变成了听不懂的鸟语。住了几天之后,慢慢发现一些不同:

首先,自然环境明显好于国内,釜山是个靠海的城市,沿海的路边就有许多公共海滩。海水的颜色是碧蓝的,完全不像国内的那种泛黄的海水。乘车从海边的公路上驶过,经常有海鸥在上方盘旋。城市卫生状况方面也比国内要好一些,虽然比不上日本,但绝不会像国内一样看见露天的垃圾。破房子,破碎的人行道和公共设施还是有的,但整体而言还比较整洁。

和上海相比,釜山的城市布局比较分散,不会看见特别密集的高楼群。布局分散的好处最明显体现在交通上,虽然釜山是个大城市,但基本看不到堵车。另外,说到交通,有一点值得提起的是,在日韩,如果你横穿马路(即使在没有人行横道的地方),所有的汽车都会老远就减速并停下来等你。一开始我们都非常不习惯,不知道哪一天中国司机也能做到这一步。

韩国人还是比较热情的,大部分韩国人都能友善的对待中国人(个别除外)。另外,我们发现,虽然能用英语流利交谈的韩国人不多,但街上随便抓到一个韩国人,基本上都能听懂一些常用的英语词汇,所以问路和买东西是没有问题的。在民族情结上,的确存在着一些愤青,某天晚上 party 时,一个韩国人喝醉了,便开始大放厥词说韩国人和中国人要联合以来打倒日本什么的,搞得我们都很尴尬。

韩国的旅游景点真的没有什么意思,在城市里看到的还是韩文,到了旅游景点看到的全都是中文...

韩国的特色食品,除了泡菜就是海鲜了。海鲜不仅有生吃的,还有活吃的,比如把活的章鱼海星什么的切成块直接拌上蔬菜和酱汁就吃的,吃的时候还在动。另外有一种像大虫子一样的东西,据说非常好吃,但我没敢去吃,只是尝了一些烤的贝类。那些很大的贝类吃起来肉质类似很嫩的鱼肉,味道还是不错的。集贸市场里也有类似中国的小吃摊,不过卫生都做的很不错,台面擦得一尘不染。

暂时就写这么多,照片暂时整理为 4 个项册,分别为:

City:纯景观

P1000040P1000042P1000072P1000077P1000083P1000090P1000092P1000095P1000098P1000100P1000102P1000104P1000122P1000125P1000126P1000127P1000130P1000133P1000135P1000152P1000204P1000213P1000214P1000215P1000223P1000225P1000251P1000256

P1000044P1000051P1000078P1000084P1000086P1000096P1000121P1000200P1000217

Laye:包含我的照片

P1000057P1000168P1000170P1000173P1000194P1000198

P1000080P1000094P1000097P1000105P1000154P1000188P1000192


Food:食品

P1000141P1000146P1000149P1000162

P1000067P1000068P1000157P1000240


Misc:杂集

P1000059P1000085P1000128P1000209P1000211P1000237

October 11

Call Stanford Parser in Perl

use Inline (
    Java => <<'END_JAVA',

import edu.stanford.nlp.parser.lexparser.LexicalizedParser;

class Parser {
    LexicalizedParser lexParser;
    public Parser(String model) {
        lexParser = new LexicalizedParser(model);
    }
    public String parse(String sentence) {
        lexParser.parse(sentence);
        return lexParser.getBestParse().toString();
    }   
}
 
END_JAVA

    CLASSPATH => 'stanford-parser.jar',
    EXTRA_JAVA_ARGS => '-mx800m'
);

my $p = Parser->new("englishPCFG.ser.gz");
print $p->parse($_)."\n" while (<>);  


感觉实在是很 Cool,主要使用了 Inline-Java 这个 bundle。
运行时需要把
stanford-parser.jar, Parser 数据文件 englishPCFG.ser.gz 和这个 perl 程序放在同一目录下,当然必须保证 Inline-Java 能找到你的 JDK,可以通过 J2SDK 这个 Option 来指定。
August 30

Laye's Ubuntu 7.04 Cookbook

cook01 中文字体美化

(1) 得到 simsun.ttc tahoma.ttf tahomabd.ttf  verdana.ttf verdanab.ttf verdanai.ttf verdanaz.ttf 几个个字体文件 (可以从 Windows 的 Fonts 文件夹中获取)
(2) 用 nautilus 打开系统的字体文件夹:nautilus fonts:///
(3) 将第 (1) 步中的几个个字体复制进第 (2) 步打开的字体文件夹中
(4) 创建 /etc/fonts/local.conf 文件,内容如 [附录1]
(5) 重新启动 X: Ctrl + Alt + Backspace
(6) 打开 gnome 字体设置:gnome-font-properties,设置前四个字体为 Tahoma
(7) 打开 firefox 字体设置:将 Serif 设置为 SimSun,Sans-serif 设置为 Tahoma,Monospace 设置为 SimSun,并且允许网页自由选择字体
(8) 重新启动 X, enjoy~

点评:该优化方案用 Windows 的 SimSun (衬线) 和 Tahoma (无衬线) 作为 UI 和 Web 中的主要字体使用。并且,解决了字体替换后的几个问题:
(1) 针对中文选字混乱问题 (同一句话中的不同汉字可能用不同字体进行渲染),我将所有亚洲字符都强制使用 SimSun 显示。
(2) 由于 SimSun 的小字体为点阵字体,所以关闭了 8-17px 字体的抗锯齿以达到理想的显示效果。
(3) 设置了 SimSun 和 Tahoma 的最小字体尺寸以保证显示效果

在上面的描述中,我假设读者已掌握了基本的 ubuntu 操作,所以只是描述了要做什么,并没有具体到点哪个按钮输入是么字符。

已知 Bug:  SimSun 英文和数字粗体效果不佳,可以下载网友制作的 SimSunbd 拷贝入字体目录 (SimSunbd 的英文和数字用的好像是 Tahoma)


cook02 连接 windows 的远程桌面

安装 rdesktop:
sudo apt-get install rdesktop

使用:
rdesktop ip
rdesktop -f ip (全屏)


cook03 使 ntfs 分区可写

安装 ntfs-config:
sudo apt-get install ntfs-config

配置:
sudo ntfs-config
勾选两个选项 (或根据需要勾选)


cook04 访问 Windows 共享文件夹

执行:nautilus-connect-server
填写你要访问的 Windows 共享文件夹的相关信息,这个文件夹就会被 mount 到你的 Desktop 下。同样的方法可以 mount FTP 文件夹等等。


cook05 使 Windows 能访问 ubuntu 的文件 (samba)

执行:shares-admin
按需要设置


cook06 播放各种视频

(1) 下载 mplayer 的 Codec Package: http://www.mplayerhq.hu/design7/dload.html#binary_codecs
(2) 将下载的 Codec Package 解压到 /usr/lib/win32
(3) 安装 mplayer 或各种 mplayer 的前端程序,我用的是 mplayer 的一个前端: smplayer
(4) 如果你的 mplayer 的播放画面不正常,请检查你的 Video Output Driver 是否为 x11
(5) 若要显示中文字幕,需要在播放器内设置字幕用字体和字幕编码


cook07 使用 fcitx 替换 scim

由于使用习惯和兼容性原因,许多人不得不使用 fcitx,安装方法如下:

sudo apt-get install im-switch fcitx
im-switch -s fcitx -z default

如果你要在 en 的 locale 下使用 fcitx,请将 /etc/gtk-2.0/gtk.immodules 中的:

“xim” “X Input Method” “gtk20″ “/usr/share/locale” “ko:ja:th:zh”

替换为

“xim” “X Input Method” “gtk20″ “/usr/share/locale” “en:ko:ja:th:zh”


cook08 Panel 中的好东东

ubuntu 桌面上下各有一个 Panel。其实,我们可以自定义 Panel 上面的内容,比如说:
天气预报,本本的电量显示、亮度调节,CPU 频率监视,系统负载监视,还有一个强制终止程序的按钮 (Force Quit)等等。
你也可以把自己建立的 Laucher 拖动到 Panel 上,当然,你也可以在别的位置建立自己的 Panel。


cook09 使用 HP 打印机

ubuntu 自带了 HP 系列打印机的驱动 oo2zjs,但奇怪的是,这个驱动居然是不能用的。
用户需要卸载掉 ubuntu 自带的 oo2zjs,安装新的 oo2zjs。

具体过程如下:

确认编译环境已安装:
sudo apt-get install build-essential

下载 oo2zjs:
wget -O foo2zjs.tar.gz http://foo2zjs.rkkda.com/foo2zjs.tar.gz

解压:
tar zxf foo2zjs.tar.gz
cd foo2zjs

卸载原有 foo2zjs:
make uninstall

编译,安装:
make
./getweb 1020 这里是你的打印机型号
sudo make install install-hotplug cups

在 ubuntu 的打印机管理中添加你的打印机 (不要选 suggest 的那个驱动):
sudo gnome-cups-manager

最后,重启 cups:
sudo make cups

cook10 开启 Vim 的“简易模式”

ubuntu 中 Vim 只有 console 的版本,且是传统 Unix 的行为模式,即在 INSERT MODE 下,方向键和退格键是不起作用的。可以手动开启“类 Windows”模式,即在 COMMAND MODE 下输入:

:behave mswin


[附录1]

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">

<fontconfig>

    <!-- use SimSun to display all Asia character -->
    <match target="font">
        <test compare="contains" name="lang" >
            <string>zh-cn</string>
            <string>zh-tw</string>
            <string>ja</string>
            <string>ko</string>
        </test>
        <edit name="family"><string>SimSun</string></edit>
    </match>

    <!-- open anti-alias for all font -->
    <match target="font" >
        <edit mode="assign" name="antialias"><bool>true</bool></edit>
        <edit mode="assign" name="hintstyle"><const>hintslight</const></edit>
        <edit mode="assign" name="hinting"><bool>true</bool></edit>
        <edit mode="assign" name="autohint"><bool>false</bool></edit>       
    </match>

    <!-- disable anti-alias for fonts between 8 to 17 pixels -->
    <match target="font" >
        <test compare="more_eq" name="pixelsize" qual="any"><double>8</double></test>
        <test compare="less_eq" name="pixelsize" qual="any"><double>17</double></test>
        <edit mode="assign" name="antialias"><bool>false</bool></edit>
    </match>

    <!-- set the minimum size for SimSun and Tahoma -->
    <match target="font" >
        <test name="family" qual="any">
            <string>SimSun</string>
            <string>NSimSun</string>
            <string>Tahoma</string>
        </test>
        <test compare="more_eq" name="pixelsize"><int>8</int></test>
        <test compare="less_eq" name="pixelsize"><int>12</int></test>
        <edit compare="eq" name="pixelsize"><int>12</int></edit>
    </match>

</fontconfig>



August 20

gbk_string - minimal implementation

在国际化编码方面,虽然 UTF-8 是大趋势,但由于种种历史原因,平时工作中不免要处理一些 GBK 的字符串,于是写了一个简单的类 gbk_string。

正如其名,这是一个用于处理 GBK 字符串的 C++ 类。该类对标准 C++ 的 STL 做到了最大的复用,只用了寥寥几行代码,便能让程序员像使用标准的 string 类一样操纵 GBK 字符串。

源代码如下:

=== gbk_string.h 文件 ===

#include <string>
#include <ostream>

using std::ostream;
using std::string;
using std::basic_string;

typedef wchar_t gbk_char;

class gbk_string : public basic_string<gbk_char>
{
public:
    gbk_string() : basic_string<gbk_char>::basic_string() {};
    gbk_string(string str);
    gbk_string& operator =(string str);   
};

ostream& operator <<(ostream& out, gbk_char& ch);
ostream& operator <<(ostream& out, basic_string<gbk_char>& str);

=== gbk_string.cpp 文件 ===

#include "gbk_string.h"

gbk_string::gbk_string(string str)
{
    *this = str;
}

gbk_string& gbk_string::operator =(string str)
{
    unsigned i;
    gbk_char ch;
    clear();
    for (i = 0; i < str.length(); i++)
    {
        ch = (gbk_char)str[i] & 0xff;
        if (ch & 0x80) ch |= ((gbk_char)str[++i] & 0xff) << 8;
        push_back(ch);
    }
    return *this;
}

ostream& operator <<(ostream& out, gbk_char& ch)
{
    out.put(ch & 0xff);
    if (ch & 0x80) out.put((ch & 0xff00) >> 8);
    return out;
}

ostream& operator <<(ostream& out, basic_string<gbk_char>& str)
{
    gbk_string::iterator i;
    for (i = str.begin(); i != str.end(); i++) out << *i;
    return out;
}

该 gbk_string 类使用了 basic_string<gbk_char> 作为基类。gbk_char 在这里定义为 wchar_t,所以 basic_string<gbk> 实际上相当于 wstring,其中每个“字符”最多可容纳 16-bit 的数据。剩下的只有从 string 到 wstring 、从 wstring 到 string 以及从 gbk_char 到 string 的转换。在这个类中,这三个转换分别由重载运算符 = 和 << 来实现。

注意到其中 ostream& operator <<(ostream& out, basic_string<gbk_char>& str) 的第二个参数并不是 gbk_string。这是因为 basic_string 模板类中 substr 之类的函数返回类型为 basic_string<charT, traits, Alloc>,即返回的实际为 gbk_string 的父类。而父类不能自动转换到子类,所以这里的参数类型使用的是父类 basic_string<gbk_char> 而不是 gbk_string。

gbk_string 的使用方法和标准的 string 类完全一样,只不过 gbk_string 的每个“字符”都是一个 GBK 字符 (gbk_char)。下面的例子详细的说明的这一点:

=== Synopsis ===

#include <iostream>
#include <sstream>
#include "gbk_string.h"

using std::cout;
using std::endl;
using std::stringstream;

int main()
{
    gbk_string s1("Hi,世界。");
    cout << s1.length() << endl;      // 6
   
    gbk_string s2;
    s2 = "世界";
    cout << s1.find(s2) << endl;      // 3

    cout << s1.substr(3, 2) << endl;  // 世界

    cout << s1 << endl;               // Hi,世界。

    stringstream ss;
    ss << s1;
    cout << ss.str() << endl;         // Hi,世界。

    cout << s1[0] << endl;            // H
    cout << s1[3] << endl;            // 世

    return 0;
}

August 13

New Site Powered by Laye

最近帮朋友的单位做了一个网站 ~ 说来,计算机系的人还真是万能的,又能修电脑,又能做网站。。。

http://szdpjws.cn

因为很久没接触过了,对业界流行的东西都不太熟悉,无奈朋友之托,只能接下。以前曾用过 ASP 和 PHP,这次用了 Perl,目的也很明确,借此机会进一步熟悉 Perl。但是,用的却是最古老的模块 CGI 和 HTML::Template,另外还用 GD 做了一个最简单的验证码。至于最先进的 Jifty 还有 Catalyst,之前只是知道名字,没有怎么去学。这次时间又紧,不能现学现用了。

根据这次工作的经验,用 CGI 和 HTML::Template 来写网站的确不是什么好主意。首先,没有 framework,一切都从空气中产生,充斥着大量的基础的,重复的劳动。开始还好,后面越写越不耐烦。其次,同样的一件东西,需要在不同的地方描述许多遍。比如:提交某一表单,表单的字段需要在 database 里,template 里,接受 form 得程序里重复的出现。这一点违反了程序设计文化中 DRY (Don't Repeat Yourself) 原则。之外,HTML::Template 也只是一个简单的模板模块。本来 HTML 看起来就比较乱,如果嵌入了大量的模板控制命令比如 IF ELSE FOR 等等,可读性就更差了,而且,在一定程度上,程序逻辑还是和外观混在了一起(这一点我后来才发现)。

刚写完这个网站,我就迫不及待的开始学习 Jifty 还有 HTML::Mason。多亏了 Agent,我才能得以知道世界上还有 Jifty 这样的东东。刚学了一点,按照例子编了一个简单的 webblog,的确是非常的 DRY,呵呵,一点多余的代码都没有。学完以后,如果有时间,我打算用 Jifty 重写这个网站作为练习。另外,Perl 也的确够诡异的,因为 Jifty 的程序,我怎么看都不像 Perl 嘛,呵呵,看来还要请教 Agent。

P.S. 前几天去了新华书店,买了平均律键盘曲集的乐谱和一本 Kernel Method 的书,哎,不知道能不能看得下去。另外还买了动新做的 Code Gease 专刊,非常精美哦,里面两张巨幅海报更是非常的赞,可惜海报后面还有人设的素描图,挂墙上就可惜了,最好买个卷轴什么的。。

 
在这里踩上你的脚印 ^_^
Please wait...
Sorry, the comment you entered is too long. Please shorten it.
You didn't enter anything. Please try again.
Sorry, we can't add your comment right now. Please try again later.
To add a comment, you need permission from your parent. Ask for permission
Your parent has turned off comments.
Sorry, we can't delete your comment right now. Please try again later.
You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
Complete the security check below to finish leaving your comment.
The characters you type in the security check must match the characters in the picture or audio.
blackjack wrote:
希望与你交流catalyst 的应用。blackjack.xu@gmail.com
June 25
磊 汪wrote:
踩,必须要踩......
Mar. 17
No namewrote:
Hi, laye.
我看了你的"Call Stanford Parser in Perl"日志。有些问题想问问你,可以的话,加我吧,我的MSN:nauticus@Live.cn。谢谢!
Jan. 30
Photo 1 of 6