分类存档: Tech/技术-Ubuntu

Linux下的一些视频编辑软件

pitivi
lives
openmovieeditor
openshotvideo
avidemux
kdenlive
kinodv
cinelerra-cv

禁止WordPress自动将半角标点符号替换为全角

打开 wp-includes/formatting.php 文件,找到代码:

// static strings
$curl = str_replace($static_characters, $static_replacements, $curl);
// regular expressions
$curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);

将以上两行注释掉就可以了

Linux下mencoder转换视频格式的简单命令

仅介绍mencoder的基本转换方法,格式参数采用的是默认设置

mencoder进行操作基本方法:

mencoder inputfile -o outputfile -ovc 目标视频格式 -oac 目标音频格式 -of 目标文件格式

例如:

转换为flv格式

mencoder input.avi -o outfile.flv -of lavf -oac mp3lame -ovc lavc

转换为avi

mencoder infile.avi -o outfile.avi -of avi -oac mp3lame  -ovc xvid

转换为wmv

mencoder infile.avi -o outfile.wmv -of lavf -oac mp3lame -ovc lavc

截图方法

mplayer infile -ss START_TIME -noframedrop -nosound -vo jpeg -frames N

将视频中的音频抽取下来存成mp3的方法

1 先把音频存成wav:mplayer -vo null -vc null -ao pcm:file=/data/outfile.wav -srate 44100 -noframedrop infile

2 用lame压缩为mp3:lame /data/outfile.wav /data/outfile.mp3

Linux下GostScript(gs)打印gs文件的方法

需要转换几个ps文件,在ArchLinux下man了一下gs,简单的总结下gs的用法,备忘。

将a.ps文件打印成b.pdf,dpi为300,命令:

gs -o b.pdf -r300 -sDEVICE=pdfwrite a.ps

打印成b.jpg,命令:

gs -o b.jpg -r300 -sDEVICE=jpeg a.ps

打印成b.png,命令:

gs -o b.png -r300 -sDEVICE=png256 a.ps

分页打印,命令

gs -o b%d.pdf -r300 sDEVICE=pdfwrite a.ps

也可以利用gs把pdf转换成图片,命令:

gs -o b.jpg -r300 -sDEVICE=jpeg a.pdf

文件编码转换方法

转换文件内容编码的方法,例:

iconv -f utf8 -t gb2312 filename.txt >new.txt

转换文件名编码方法,例:

convmv -f utf8 -t gb2312 filename.txt

我学习emacs总结的小技巧

1 开启拼写检查

emacs可以使用aspell进行拼写检查,archlinux下记得安装aspell-en,直接用aspell检查文件可以使用命令:

aspell --mode=ccpp -c test.cpp  检查c程序代码

aspell --mode=tex -c my.tex  检查tex

在emacs下开启aspell用:M-x flyspell-mode

2 单词补全

简单的可以用M-x /就可以补全,可以多按几次M-x / 找到合适的补全

此外,可以用auto-complete补全,可以显示一个列表公选择。从http://cx4a.org/software/auto-complete/下载auto-complete然后,安装它。安装方法:解压后make install DIR=/YourHome/.emacs.d

记得在.emacs文件中加入

(add-to-list 'load-path "/home/z/.emacs.d/")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "/home/z/.emacs.d/ac-dict")
(ac-config-default)

注意:archlinux若没有.emacs文件需要手动建立改文件,并把他拷贝到用户的根目录下,而非~/.emacd目录

~~待续

我的fvwm2配置文件

我配置的fvwm2主要是为了减少鼠标的操作,以求尽可能使用键盘满足大部分的工作需要。

主要功能键:

Ctrl + right   窗口最大化

Ctrl + Alt +up   窗口二分之一最大化并上移到屏幕顶部

Ctrl + Alt + down  窗口二分之一最大化并上移到屏幕顶部

Ctrl + Alt +left   窗口二分之一最大化并左移到屏幕左端

Ctrl + Alt + right  窗口二分之一最大化并右移到屏幕右端

Ctrl + Alt + a  窗口四分之一最大化并上移到屏幕顶部左上

Ctrl + Alt + b  窗口四分之一最大化并上移到屏幕顶部右上

Ctrl + Alt + c  窗口四分之一最大化并上移到屏幕顶部左下

Ctrl + Alt + d  窗口四分之一最大化并上移到屏幕顶部右下

Ctrl + Shift + a  鼠标上移到屏幕左上四分之一处

Ctrl + Shift + b  鼠标上移到屏幕右上四分之一处

Ctrl + Shift + c  鼠标上移到屏幕左下四分之一处

Ctrl + Shift + d  鼠标上移到屏幕右下四分之一处

Ctrl + Alt + f   切换虚拟桌面1

Ctrl + Alt + g  切换虚拟桌面2

Ctrl + Alt + r  将窗口移到虚拟桌面1

Ctrl + Alt + t  将窗口移到虚拟桌面2

Ctrl +Shift + q 当前窗口置于最底

Ctrl + left      者窗口最小化到标签

Ctrl + Shift + up 关闭窗口

Ctrl + Shift + Tab  启动xterm

该设置可能会与scim冲突,那么就修改下scim的快捷键吧。

我的配置文件.fvwm2rc如下:

# this is a bare bones sample .fvwm2rc/system.fvwm2rc file for fvwm.
# It should be customized before install.  See other sample .fvwm2rc files
# for hints, as well as pointers from the various links on the official
# fvwm web page (see the FAQ).

###EdgeResistance 250 10
###EdgeScroll 100 100
EdgeScroll 0 0
ClickTime 750

DeskTopSize 1x2

Menustyle * fvwm, Font -adobe-helvetica-bold-r-normal--*-100-*-*-*-*-*-*
MenuStyle * Foreground maroon, Background grey60, Greyed grey40

ColormapFocus FollowsMouse

# default Styles:
# make sure these fonts exist on your system:
Style *           Font -adobe-helvetica-bold-r-normal--*-130-*-*-*-*-*-*

Style *           IconFont -adobe-helvetica-bold-r-normal--*-150-*-*-*-*-*-*
Style *           HilightFore black, HilightBack palevioletred
Style *           BorderWidth 7, HandleWidth 7
Style *           Icon unknown1.xpm, Color lightgrey/dimgrey
Style *           MWMFunctions, MWMDecor, HintOverride
Style *           DecorateTransient, NoPPosition
Style *           IconBox 0 -10 -280 -1
Style *           FocusFollowsMouse
#Style *           TileCascadePlacement
Style *           MinOverlapPercentPlacement

# Styles for various Fvwm modules:
Style "Fvwm*"       NoTitle,  Sticky, WindowListSkip
Style "Fvwm*"       BorderWidth 2, CirculateSkipIcon, CirculateSkip
Style "FvwmPager"   StaysOnTop
Style "FvwmBanner"  StaysOnTop
Style "FvwmButtons" Icon toolbox.xpm, ClickToFocus

# Styles for your common terminal emulator programs:
Style "XTerm"       Icon xterm.xpm, SloppyFocus, IconBox -70 1 -1 -140
Style "rxvt"        Icon term.xpm, SloppyFocus, IconBox -70 1 -1 -140
Style "rxvt"        MWMBorder, MWMButtons

# Styles for various common programs:
Style "*lock"       NoTitle, NoHandles, Sticky, WindowListSkip, ClickToFocus
Style "xbiff"       NoTitle, Sticky, WindowListSkip, ClickToFocus
Style "xcalc"       Icon xcalc.xpm, NoButton 2,ClickToFocus
Style "xmh"         Icon mail1.xpm, NoIconTitle,StickyIcon
Style "xmh"        NoButton 2
Style "xman"        Icon xman.xpm, ClickToFocus
Style "xmag"        Icon mag_glass.xpm, ClickToFocus
Style "xgraph"      Icon graphs.xpm, ClickToFocus
Style "xmosaic"     Color Green/Yellow, ClickToFocus

##################

AddToFunc    MyUpSmall
+ I        Resize    98    48
+ I        Move    0    0
+ I        WindowId root 1 WarpToWindow 50 25
+ I        Raise

AddToFunc    MyDownSmall
+ I        Resize    98    45
+ I        Move    0    52
+ I        WindowId root 1 WarpToWindow 50 75
+ I        Raise

AddToFunc    MyLeftSmall
+ I        Resize    48    96
+ I        Move    0    0
+ I        WindowId root 1 WarpToWindow 25 50
+ I        Raise

AddToFunc    MyRightSmall
+ I        Resize    48    96
+ I        Move    49    0
+ I        WindowId root 1 WarpToWindow 75 50
+ I        Raise

AddToFunc    MyUp22
+ I        Resize    48    47
+ I        Move    49    50
+ I        WindowId root 1 WarpToWindow 75 75
+ I        Raise
AddToFunc    MyUp21
+ I        Resize    48    47
+ I        Move    0    50
+ I        WindowId root 1 WarpToWindow 25 75
+ I        Raise
AddToFunc    MyUp12
+ I        Resize    48    47
+ I        Move    49    0
+ I        WindowId root 1 WarpToWindow 75 25
+ I        Raise
AddToFunc    MyUp11
+ I        Resize    48    47
+ I        Move    0    0
+ I        WindowId root 1 WarpToWindow 25 25
+ I        Raise
AddToFunc    MyMaximize
+    I    Maximize
+ I        Raise
# some simple default key bindings:
#Key Next         A       SCM     Next (AcceptsFocus) Focus
#Key Prior        A       SCM     Prev (AcceptsFocus) Focus
Key Right     A     C     MyMaximize
Key Left     A     C     Iconify toggle
Key Up         A     SC     Close
Key Up         A     SMC     Delete

Key Tab         A     SC     Exec exec xterm
Key =         A     SC     Exec exec mixer pcm +5
Key -         A     SC     Exec exec mixer pcm -5

#Key Up         A     C     PackWrapperRight
#Key Down     A     C     Prev (AcceptsFocus) Focus
Key t          A     SC     MoveToPage 1 1
Key r         A     SC     MoveToPage 0 0
Key g         A      SC     GotoPage   1 1
Key f         A     SC     GotoPage   0 0

Key a         A     MC     MyUp11
Key b         A     MC     MyUp12
Key c         A     MC     MyUp21
Key d         A     MC     MyUp22

Key a         A     SC     WindowId root 1 WarpToWindow 25 25
Key b         A     SC     WindowId root 1 WarpToWindow 75 25
Key c         A     SC     WindowId root 1 WarpToWindow 25 75
Key d         A     SC     WindowId root 1 WarpToWindow 75 75

Key q         A     SC     Lower

Key Up         A     MC     MyUpSmall
Key Down     A     MC     MyDownSmall
Key Left     A     MC     MyLeftSmall
Key Right     A     MC     MyRightSmall
Key m         A     MC     All Iconify true
Key Tab         A     M WindowList c c CurrentAtEnd, IconifiedAtEnd
Key =         A     SC     Exec mixer pcm +5
Key -         A     SC     Exec mixer pcm -5

# some simple default mouse bindings:
#   for the root window:
Mouse 1    R       A       Menu RootMenu Nop
Mouse 2    R        A          Menu Window-Ops Nop
Mouse 3    R        A          WindowList

#   for the title bar buttons:
Mouse 0    1        A          Menu Window-Ops2 Close
Mouse 0    2        A         Maximize-Func
Mouse 0    4        A         Iconify

#   for other parts of the window/borders/icons:
Mouse 1    F    A    Resize-or-Raise
Mouse 1    TS    A    Move-or-Raise
Mouse 1    I    A    Move-or-Iconify
Mouse 2    I    A    Iconify
Mouse 2    FST    A    Menu Window-Ops2 Nop
Mouse 3    TSIF    A    RaiseLower

######################## Initialization Functions ############################
AddToFunc StartFunction
+ I Module FvwmButtons

#AddToFunc InitFunction
# + I exec xsetroot -mod 2 2 -fg rgb:55/40/55 -bg rgb:70/50/70

# For some SM-s (like gnome-session) there is an internal background setter.
AddToFunc SessionInitFunction
+ I Nop
#AddtoFunc InitFunction
#+ I Exec exec /usr/bin/gnome-settings-daemon

######################## Menus ###################
AddToMenu RootMenu    "Root Menu"    Title
+            "XTerm"        Exec exec xterm
+            "Rxvt"        Exec exec rxvt
+            ""        Nop
+            "Remote Logins"    Popup Remote-Logins
+            ""        Nop
+                       "Utilities"     Popup Utilities
+            ""        Nop
+            "Fvwm Modules"              Popup Module-Popup
+                       "Fvwm Window Ops"         Popup Window-Ops
+                       "Fvwm Simple Config Ops"  Popup Misc-Ops
+            ""        Nop
+                       "Refresh Screen"   Refresh
+                       "Recapture Screen" Recapture
+            ""        Nop
+            "Exit Fvwm"    Popup Quit-Verify

AddToMenu Utilities     "Utilities" Title
+            "Top"        Exec exec xterm -T Top -n Top -e top
+            "Calculator"    Exec exec xcalc
+            "Xman"        Exec exec xman
+            "Xmag"        Exec exec xmag
+                       "Editres"       Exec exec editres
+            ""        Nop
+            "XEmacs"    Exec exec xemacs
+                       "Mail"          MailFunction xmh "-font fixed"
+            ""        Nop
+                       "XLock"         Exec exec xlock -mode random
+            ""        Nop
+                       "Reset X defaults" Exec xrdb -load $HOME/.Xdefaults

AddToMenu Misc-Ops "Misc Config Opts" Title
+                  "Sloppy Focus"        ChangeDefaultFocus SloppyFocus
+                  "Click To Focus"      ChangeDefaultFocus ClickToFocus
+                  "Focus Follows Mouse" ChangeDefaultFocus FocusFollowsMouse
+                  "" Nop
+                  "Colormap Follows Mouse" ColormapFocus FollowsMouse
+                  "Colormap Follows Focus" ColormapFocus FollowsFocus
+                  "" Nop
+                  "Full Paging ON"         EdgeScroll 100 100
+                  "All Paging OFF"         EdgeScroll 0 0
+                  "Horizontal Paging Only" EdgeScroll 100 0
+                  "Vertical Paging Only"   EdgeScroll 0 100
+                  "Partial Paging"         EdgeScroll 50 50
+                  "Full Paging && Edge Wrap" EdgeScroll 100000 100000

AddToMenu Window-Ops    "Window Ops"    Title
+            "Move"        Move
+            "Resize"    Resize
+            "Raise"        Raise
+            "Lower"        Lower
+             "(De)Iconify"    Iconify
+            "(Un)Stick"    Stick
+            "(Un)Maximize"    Maximize
+            ""        Nop
+            "Delete"    Delete
+            "Close"        Close
+            "Destroy"    Destroy
+            ""        Nop
+            "Refresh Window" RefreshWindow

AddToMenu Window-Ops2    "&Move"        Move
+            "&Resize"    Resize
+            "R&aise"    Raise
+            "&Lower"    Lower
+            "(De)&Iconify"    Iconify
+            "(Un)&Stick"    Stick
+                       "(Un)Ma&ximize" Maximize
+            ""        Nop
+            "&Delete"    Delete
+            "&Close"    Close
+            "Destroy"    Destroy
+            ""        Nop
+            "ScrollBar"     Module FvwmScroll 2 2
+            "Print"         PrintFunction
+                       "Print Reverse" PrintReverseFunction

# be sure to fill these in with your correct machine names:
AddToMenu Remote-Logins    "dopey"     Exec rsh dopey rxvt -display $HOSTDISPLAY &
+            "snoopy" Exec rsh snoopy rxvt -display $HOSTDISPLAY &
+            "grumpy" Exec rsh grumpy rxvt -display $HOSTDISPLAY &
+            "happy"     Exec rsh happy rxvt -display $HOSTDISPLAY &
+            "bailey" Exec rsh bailey rxvt -display $HOSTDISPLAY &
+            "barnum" Exec rsh barnum rxvt -display $HOSTDISPLAY &
+            "joker"     Exec rsh joker rxvt -display $HOSTDISPLAY &
+            "signal" Exec rxterm signal

AddToMenu Module-Popup    "FvwmModules"    Title
+            "Identify"    Module    FvwmIdent
+            "Talk"      Module    FvwmTalk
+            ""        Nop
+            "Button-Bar"    Module    FvwmButtons
+            "Pager"        Module  FvwmPager 0 0
+            "Pager (2 desks)" Module  FvwmPager 0 1
+            "WinList"    Module  FvwmWinList
+            ""        Nop
+            "Banner"    Module    FvwmBanner
+                       "ScrollBar"     Module  FvwmScroll 50 50
+            "Background"    Module  FvwmBacker
+                       "AutoRaise"     Module  FvwmAuto 200 Raise Nop
+                       "Stop AutoRaise" KillModule FvwmAuto
+            ""        Nop
+            "IconBox"    Module    FvwmIconBox
+                       "IconMan"       Module  FvwmIconMan
+            ""        Nop
+                       "Form - Rlogin"      Module FvwmForm Rlogin
+                       "Form - MyFvwmTalk"  Module FvwmForm MyFvwmTalk
+                       "Form - QuitVerify"  Module FvwmForm QuitVerify

AddToMenu Quit-Verify     "Really Quit Fvwm?" Title
+                  "Yes, Really Quit"  Quit
+                  ""            Nop
+                       "Restart Fvwm"      Restart
+                  "Restart Fvwm 1.x"  Restart fvwm -s
+                  ""            Nop
+                  "Start twm"         Restart twm
+                  "Start ctwm"        Restart ctwm
+                "Start tvtwm"       Restart tvtwm
+                "Start vtwm"        Restart vtwm
+                  "Start mwm"            Restart mwm
+                        "Start olwm"        Restart /usr/openwin/bin/olwm
+                  ""            Nop
+                  "Start dummy"       Restart xterm
+                  ""            Nop
+                  "No, Don't Quit"    Nop

######################## Sample Functions ##########################

AddToFunc MailFunction       I Next (AcceptsFocus $0) Iconify -1
+                   I Next (AcceptsFocus $0) Focus
+               I None (AcceptsFocus $0) Exec $0 $1

AddToFunc Move-or-Raise        I Raise
+                M Move
+                  D Lower

AddToFunc Move-or-Raise2    M Raise
+                M Move
+                  D Lower

AddToFunc Maximize-Func        M Maximize     0 100
+                C Maximize     0 80
+                D Maximize     100 100

AddToFunc Move-or-Iconify    I Raise
+                M Move
+                D Iconify

AddToFunc Resize-or-Raise    I Raise
+                M Resize
+                D Lower

AddToFunc Resize-or-Raise2    M Raise
+                M Resize
+                D Lower

AddToFunc PrintFunction        I Raise
+                I Exec xdpr -id $w

AddToFunc PrintReverseFunction  I Raise
+                               I Exec xdpr 1/2 -h -rv -id $w

AddToFunc Iconify-and-Raise     I Iconify
+                               I Raise

# RLOGIN machine fg bg
AddToFunc RLOGIN I Exec xterm -fg $1 -bg $2 -e rlogin $0 -8

# TELNET machine fg bg
AddToFunc TELNET I Exec xterm -fg $1 -bg $2 -e telnet $0

AddToFunc FocusAndWarp I Focus
+                      I WarpToWindow 2p 2p

AddToFunc DeiconifyFocusAndWarp I Iconify -1
+                               I FocusAndWarp

AddToFunc ChangeDefaultFocus I Style * $0
+                            I Recapture
################## FvwmButtons button-bar ################################
*FvwmButtonsGeometry 500x65-1-1
*FvwmButtonsBack bisque3
*FvwmButtons(Frame 2 Padding 2 2 Container(Rows 4 Columns 10 Frame 1 \
Padding 10 0))
*FvwmButtons(8x2 Frame 2 Swallow "FvwmIconMan" "Module FvwmIconMan")
*FvwmButtons(1x2 Frame 2 Swallow(UseOld) "FvwmPager" "Module FvwmPager 0 0")
*FvwmButtons(1x2 Frame 0 Container(Rows 2 Columns 2 Frame 0))
#*FvwmButtons(Frame 2 Swallow(UseOld,NoHints,Respawn) "xbiff" `Exec exec xbiff -bg bisque3`)
*FvwmButtons(2x1 Frame 3 Swallow(UseOld,NoHints,Respawn) "xclock" `Exec exec xclock -d -brief -bg bisque3 -fg black -hd black -hl black -padding 0 -update 1`)
*FvwmButtons(2x1 Frame 2 Swallow(UseOld,NoHints,Respawn) "xload" `Exec exec xload -bg bisque3 -fg black -update 5 -nolabel`)
*FvwmButtons(End)
*FvwmButtons(End)

########################## Icon Manager ####################################
# this FvwmIconMan setup is for swallowing in above button bar example
*FvwmIconMan*numManagers 1
*FvwmIconMan*Resolution  page
*FvwmIconMan*background  bisque3
*FvwmIconMan*foreground  black
*FvwmIconMan*font        7x13bold
*FvwmIconMan*format      "%t"
*FvwmIconMan*action      Mouse   1 N sendcommand Focus, sendcommand "Iconify"
*FvwmIconMan*action      Mouse   2 N sendcommand "Iconify 1"
*FvwmIconMan*action      Mouse   3 N sendcommand "FvwmIdent"
*FvwmIconMan*followfocus true
#*FvwmIconMan*sort        name

*FvwmIconMan*plainbutton          up black bisque3
*FvwmIconMan*selectbutton         down black bisque3
*FvwmIconMan*focusbutton          up yellow firebrick
*FvwmIconMan*focusandselectButton down yellow firebrick
*FvwmIconMan*dontshow icon=Untitled title=Untitled
#*FvwmIconMan*drawicons true
*FvwmIconMan*buttongeometry  300x0
*FvwmIconMan*managergeometry 1x5
*FvwmIconMan*sort Id
########################## Window-Identifier ###############################
# Just choose colors and a fonts
*FvwmIdentBack MidnightBlue
*FvwmIdentFore Yellow
*FvwmIdentFont -adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*

########################### Pager #########################################
*FvwmPagerBack #908090
*FvwmPagerFore #484048
#*FvwmPagerFont -adobe-helvetica-bold-r-*-*-10-*-*-*-*-*-*-*
# turn off desktop names for swallowing in above button bar example:
*FvwmPagerFont none
*FvwmPagerHilight #cab3ca
*FvwmPagerGeometry -1-1
*FvwmPagerLabel 0 Misc
*FvwmPagerLabel 1 Maker
*FvwmPagerLabel 2 Mail
*FvwmPagerLabel 3 Matlab
*FvwmPagerSmallFont 5x8
*FvwmPagerBalloons            All
*FvwmPagerBalloonBack         Yellow
*FvwmPagerBalloonFore         Black
*FvwmPagerBalloonFont         lucidasanstypewriter-12
*FvwmPagerBalloonYOffset      +2
*FvwmPagerBalloonBorderWidth  1
*FvwmPagerBalloonBorderColor  Black

##########################FvwmWinList##################################
*FvwmWinListBack #908090
*FvwmWinListFore Black
*FvwmWinListFont -adobe-helvetica-bold-r-*-*-10-*-*-*-*-*-*-*
*FvwmWinListAction Click1 Iconify -1,Focus
*FvwmWinListAction Click2 Iconify
*FvwmWinListAction Click3 Module "FvwmIdent" FvwmIdent
*FvwmWinListUseSkipList
*FvwmWinListGeometry +0-1

*FvwmBackerDesk 0 -solid steelblue
*FvwmBackerDesk 1 -solid midnightblue

*FvwmScrollBack grey40
*FvwmScrollFore green

############################################################
############################################################
# Note that icons are shown in the module
#    only if NoIcon commnand is applied.
Style     *  NoIcon

############################################################
*FvwmIconBoxIconBack    #cfcfcf
*FvwmIconBoxIconHiFore  black
*FvwmIconBoxIconHiBack  LightSkyBlue
*FvwmIconBoxBack        #5f9ea0
#*FvwmIconBoxFore       blue
*FvwmIconBoxGeometry    5x1+0+0
*FvwmIconBoxMaxIconSize 64x38
*FvwmIconBoxFont        -adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*
*FvwmIconBoxSortIcons   IconName
*FvwmIconBoxPadding     4
*FvwmIconBoxLines       10
*FvwmIconBoxSBWidth     11
*FvwmIconBoxPlacement   Left Top
*FvwmIconBoxPixmap      fvwm.xpm
#*FvwmIconBoxHideSC Horizontal
*FvwmIconBoxSetWMIconSize
*FvwmIconBoxHilightFocusWin
#*FvwmIconBoxResolution          Desk
*FvwmIconBoxMouse       1       Click           RaiseLower
*FvwmIconBoxMouse       1       DoubleClick     Iconify
*FvwmIconBoxMouse       2       Click           Iconify -1, Focus
*FvwmIconBoxMouse       3       Click           Module FvwmIdent
*FvwmIconBoxKey         r       RaiseLower
*FvwmIconBoxKey         space   Iconify
*FvwmIconBoxKey         d       Close
*FvwmIconBoxKey         n       Next
*FvwmIconBoxKey         p       Prev
*FvwmIconBoxKey         h       Left
*FvwmIconBoxKey         j       Down
*FvwmIconBoxKey         k       Up
*FvwmIconBoxKey         l       Right

#
# Icon file specifications
#
# Mostly, you don't have to specify icon files, as FvwmIconBox now
# reads icon files specified in Style commands.
#
*FvwmIconBox            "Fvwm*"         -

# FvwmForm alias - rlogin or telnet to host via xterm
*RloginWarpPointer
*RloginFont         *helvetica*m*r*n*12*
*RloginButtonFont   *helvetica*m*o*n*12*
*RloginInputFont    *cour*m*r*n*12*
*RloginFore         Black
*RloginBack         Light Gray
*RloginItemFore          Wheat
*RloginItemBack          Gray50
# begin items
*RloginLine         center
*RloginText         "Login to Remote Host"
*RloginLine         center
*RloginText         "Host:"
*RloginInput        HostName  30   ""
*RloginLine         center
*RloginSelection    meth single
*RloginChoice       TN TN off "telnet"
*RloginChoice       RL RL on "rlogin"
*RloginSelection    UserSel   single
#*RloginChoice       Default   Default   on   "same user"
#*RloginChoice       Custom    Custom    off  "user:"
*RloginText         "(Userid:"
*RloginInput        UserName  10   ""
*RloginText         ")"
*RloginLine         center
*RloginText         "FG:"
*RloginInput        FgColor 15 ""
*RloginText         "BG:"
*RloginInput        BgColor 15 ""
*RloginLine         expand
*RloginButton       quit "Login" ^M
*RloginCommand Exec xterm  $(FgColor?-fg $(FgColor)) $(BgColor?-bg $(BgColor)) -T xterm@$(HostName) -e $(RL?rlogin) $(TN?telnet) $(HostName) $(RL?-8 $(UserName?-l $(UserName)))
*RloginButton       restart   "Clear"
*RloginCommand Beep
*RloginButton       quit "Cancel"
*RloginCommand Nop

# FvwmForm alias - query exit ala mwm
*QuitVerifyGrabServer
*QuitVerifyWarpPointer
*QuitVerifyFont          *helvetica*m*r*n*14*
#*QuitVerifyButtonFont    *helvetica*m*o*n*14*
*QuitVerifyButtonFont    7x13bold
*QuitVerifyFore          Black
*QuitVerifyBack          Light Gray
*QuitVerifyItemFore Wheat
*QuitVerifyItemBack Gray50
# begin items
*QuitVerifyLine          center
*QuitVerifyText          "Do you really want to exit FVWM?"
*QuitVerifyLine          expand
*QuitVerifyButton   quit      " Exit "
*QuitVerifyCommand  Quit
*QuitVerifyButton   quit      "Cancel"
*QuitVerifyCommand  Nop

# MyTalk & MyFvwmTalk from Dave Goldberg
# MyTalk Form - dissappears after use
*MyTalkWarpPointer
*MyTalkFont *helvetica*m*r*n*14*
*MyTalkButtonFont *helvetica*m*o*n*14*
*MyTalkInputFont *cour*m*r*n*14*
*MyTalkFore Red
*MyTalkBack Gray
*MyTalkItemFore Blue
*MyTalkItemBack Gray
*MyTalkLine center
*MyTalkText "Fvwm Function"
*MyTalkInput Func 40 ""
*MyTalkLine expand
*MyTalkButton quit "Run" ^M
*MyTalkCommand $(Func)
*MyTalkButton restart "Clear" ^R
*MyTalkButton quit "Cancel" ^C
*MyTalkCommand Nop
# MyFvwmTalk Form - sticks around
*MyFvwmTalkWarpPointer
*MyFvwmTalkFont *helvetica*m*r*n*14*
*MyFvwmTalkButtonFont *helvetica*m*o*n*14*
*MyFvwmTalkInputFont *cour*m*r*n*14*
*MyFvwmTalkFore Red
*MyFvwmTalkBack Gray
*MyFvwmTalkItemFore Blue
*MyFvwmTalkItemBack Gray
*MyFvwmTalkLine center
*MyFvwmTalkText "Fvwm Function"
*MyFvwmTalkInput Func 40 ""
*MyFvwmTalkLine expand
*MyFvwmTalkButton restart "Run" ^M
*MyFvwmTalkCommand $(Func)
*MyFvwmTalkButton restart "Clear" ^R
*MyFvwmTalkCommand Nop
*MyFvwmTalkButton restart "Iconify" ^Z
*MyFvwmTalkCommand Next [MyFvwmTalk] Iconify
*MyFvwmTalkButton quit "Quit" ^C
*MyFvwmTalkCommand Nop

# to change banner pixmap
#*FvwmBannerPixmap fvwm3.xpm
#*FvwmBannerTimeout 2

我的twm配置文件以及更换桌面背景

我配置的twm主要是为了减少鼠标的操作,以求尽可能使用键盘满足大部分的工作需要。twm默认的桌面背景很丑陋,在Freebsd下可以采用xli更换桌面背景,ArchLinuc下可以用feh更换背景。

例如在ArchLinux下更换背景:

feh --bg-scale /usr/share/archlinux/wallpaper/archlinux-carbonite-knight.jpg&

可以将上面命令写入.xinitrc中这样每次启动自动设置背景。

注意:如果你发现你的twm或者fvwm启动很慢,那么就把环境变量LANG、LC_TYPE、LC_ALL等设置为zh_CN.gb2312,因为twm和fvwm对其他汉字字符集支持的不够好。

该设置可能会与scim冲突,那么就修改下scim的快捷键吧。

我的twm主要快捷键定义如下:

Ctrl + right   窗口最大化

Ctrl + up       标签上移

Ctrl + down  标签下移

Ctrl + left      标签还原到窗口,或者窗口最小化到标签

Ctrl + Shift + up 关闭窗口

Ctrl + Shift + Tab  启动xterm

配置文件.twmrc如下:

#保存为.twmrc,并放置于用户根目录下

#AutoRaise {"iconmgr"}
RightTitleButton "/usr/X11R6/include/X11/bitmaps/term"=f.menu "defops"
RightTitleButton "/usr/X11R6/include/X11/bitmaps/boxes"=f.resize
LeftTitleButton "/usr/X11R6/include/X11/bitmaps/dot"=f.iconify
LeftTitleButton "/usr/X11R6/include/X11/bitmaps/cross_weave"=f.fullzoom
LeftTitleButton "/usr/X11R6/include/X11/bitmaps/xm_hour16"=f.delete
#ResizeFont    "*new century schoolbook-medium-i-*--24-*-iso8859-*"
#IconManagerFont    "*new century schoolbook-medium-r-*--12-*-iso8859-*"
#MenuFont    "*new century schoolbook-medium-r-*--18-*-iso8859-*"
#TitleFont    "*new century schoolbook-medium-r-*--14-*-iso8859-*"
#IconFont    "*new century schoolbook-medium-r-*--12-*-iso8859-*"
#DoorFont    "*new century schoolbook-medium-r-*--12-*-iso8859-*"

TitleFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*"
ResizeFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*"
MenuFont "-adobe-helvetica-bold-r-normal--*-100-*-*-*-*-*-*"
IconFont "-adobe-helvetica-bold-r-normal--*-100-*-*-*-*-*-*"
IconManagerFont "-adobe-helvetica-bold-r-normal--*-100-*-*-*"

IconifyByUnMapping
#don't show icon on desktop
RandomPlacement
AutoRelativeResize
NoGrabServer
RestartPreviousState
DecorateTransients
NoCaseSensitive
NoDefaults
MaxWindowSize "30000x30000"
#where to put icon an d how to place them
#IconRegion "140x684+0+0" North East 130 90 {}
#IconRegion "800x600+0+0" North West 10 10
IconRegion "800x600+0+0" South East 10 10
#ClientBorderWidth

#IconManagerGeometry "1024x20+0-0" 20
IconManagerGeometry "70x1-0+0" 1
ForceIcons
ShowIconManager
#SortIconManager
NoTitle {"IconManger"}
BorderWidth 4
IconBorderWidth 2
FramePadding 0
NoTitle {"TWM Icon Manager"}
NoTitleHighlight {"TWM Icon Manager"}
NoHighlight {"TWM Icon Manager"}
NoRaiseOnWarp
UsePPosition "on"
#NoRaiseOnDeiconify
#WarpUnmapped
#WarpCursor
TitleButtonBorderWidth 1
Cursors{

IconMgr "sb_left_arrow"
Frame  "hand2"

}

Color
{

BorderColor "rgb:e/7/7" {"TWM Icon Manager" "gray0"}
BorderTileBackground "gray0"
BorderTileForeground "gray60"
DefaultBackground "rgb:2/a/9"

DefaultForeground "gray45"
#TitleBackground "rgb:2/a/9"

#TitleBackground "LightSteelBlue"
TitleBackground "black"
#TitleForeground "gray0"
TitleForeground "gray85"

#    MenuBackground "rgb:2/a/9"
MenuBackground "black"
MenuForeground "gray85"
#MenuForeground "gray5"
MenuBorderColor "slategrey"
MenuTitleBackground "gray70"
MenuTitleForeground "rgb:2/a/9"
#   IconBackground "LightSteelBlue"
IconBackground "black"
#    IconForeground "gray0"
IconForeground "gray85"
IconBorderColor "gray5"
#   IconManagerBackground "LightSteelBlue"
IconManagerBackground "black"
IconManagerForeground "gray85"
#    IconManagerForeground "gray0"
IconManagerHighlight    "rgb:f/0/0"

}
NoStackMode {}

IconManagerDontShow {"TWM Icon Manager"}
#
# Define some useful functions for motion-based actions.
#
DefaultFunction f.beep
WindowFunction f.deiconify
MoveDelta 3
Function "downiconmgr-or-raise" {  f.downiconmgr}
Function "upiconmgr-or-raise" {f.upiconmgr   }
Function "iconify-or-raise" {f.iconify f.warptoiconmgr ""}
Function "move-or-lower" { f.move f.deltastop f.lower }
Function "move-or-raise" {
f.move
#f.deltastop
f.raise
}
Function "move-or-iconify" { f.move f.deltastop f.iconify }

#
# Set some useful bindings.  Sort of uwm-ish, sort of simple-button-ish
#
Button1 = : root : f.menu "defops"
Button1    = :frame: f.resize
Button3 = :icon:f.delete
Button3 = s : title : f.showiconmgr
Button1 = : title : f.function "move-or-raise"
Button3= :title:f.iconify
Button1=c:title:f.fullzoom
Button1 = : icon : f.function "move-or-icon"
Button2 = : icon : f.iconify

Button1 = : iconmgr : f.iconify
Button1=s:   iconmgr    :f.delete
Button3 = : iconmgr : f.delete
"F12"      =m:all:f.iconify
"F11"    =m:all:f.fullzoom
"F9"    =m:all:f.delete

"Right"    =c:all:f.fullzoom

"Down"    =c :all:f.function "downiconmgr-or-raise"
#"Up"    =c :all:f.backiconmgr
"Up"    =c :all:f.function "upiconmgr-or-raise"
#"Down"    =c :all:f.forwiconmgr
#"Left"    =c s:all:f.hideiconmgr
#"Right"    =c s:all:f.showiconmgr
"Left"  =c :all: f.function "iconify-or-raise"
"Right"  =c :all: f.fullzoom
"Up"     =c s:all:f.delete
"F5"    =m:    all:f.winrefresh
"Tab"     =c s:all:f.exec "exec xterm -fn -misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1 -geometry 80x19  -fg black -bg white &"

#"Tab"     =c s:all:f.exec "exec mlterm -g 80x19 &"

#"Left"  =m :all:f.raise
#
# And a menus with the usual things
#

menu "Program"
{

"firefox"    f.exec    "exec firefox3&"
"opera"        f.exec    "exec opera&"
"emacs"        f.exec    "exec emacs&"
"xmms"    f.exec    "exec xmms&"
"gmplayer"    f.exec    "exec gmplayer&"
"nautilus"    f.exec "nautilus --no-desktop&"
}
menu "System"
{

"Show IconMgr"  f.showiconmgr
"Hide IconMgr"    f.hideiconmgr
"Kill"        f.destroy
""        f.nop
#"VTWM"        f.startwm "vtwm"
"Restart"    f.restart

"Exit X"        f.quit
}
menu "defops"
{
#"Twm"    f.title
#"Iconify"    f.iconify
#"Resize"    f.resize
#"Move"        f.move
#"Raise"        f.raise
#"Lower"        f.lower
#""        f.nop
#"Focus"        f.focus
#"Unfocus"    f.unfocus
#"IcnMgr"    f.showiconmgr
#"Min"    f.iconify
#"Max"    f.fullzoom
man#"Exit"    f.delete
#"Hide Iconmgr"    f.hideiconmgr
#""        f.nop
#"Xterm"        f.exec "exec xterm -geometry 90x25 -fn 9x15 -fg gray -bg black &"

"Time"        f.exec "exec xmessage `date`&"
""        f.nop
"Prog"    f.menu "Program"

""        f.nop
"System" f.menu "System"

#"scim"        f.exec "exec scim -d"
#"emacs"        f.exec "exec emacs &"
#"wine opera"    f.exec "exec ./w_opera"
#"opera"        f.exec "exec opera &"

#"Delete"    f.delete
#""        f.nop

#"0"        f.warptoscreen "0"
#"1"        f.warptoscreen "1"
#"warp"        f.warpring "next"
}

GraphicsMagick图像处理系统使用方法

用linux一段时间了,不知道怎么在linux下截屏,搜了一下,最简单的方法就是用命令:

import a.jpg

然后用鼠标选择截屏区域即可,所截屏报存在a.jpg中,import是ImageMagick中的一个命令,要使用他要先安装ImageMagick。不过我找到了GraphicsMagick,和ImageMagick类似,感觉很好。

GraphicsMagick是一个Linux下的图像处理系统,最初起源于ImageMagick,可以支持几乎所有的图像格式,能够进行图像格式转换、处理等工作,号称图像处理中的瑞是军刀。据说其工作效率比ImageMagick要高,GraphicsMagick主页是:http://www.graphicsmagick.org/上面有详细的GraphicsMagick和ImageMagick的性能对比。

下面给出一些常用的GraphicsMagick的使用方法:

0. 显示图像文件详细信息

gm identify a.jpg

1.更改当前目录下*.jpg的尺寸大小,并保存于目录.thumb里面

gm mogrify -output-directory .thumbs -resize 320x200 *.jpg

2. 将三幅图像和并为一副图像

gm montage -mode concatenate -tile 3x1 image1.ppm image2.ppm image3.ppm concatenated.miff

3. 显示图像

gm display 'vid:*.jpg'

4. 格式转换

gm convert a.bmp a.jpg

gm convert a.bmp a.pdf(转换为pdf)

5. 调整图像dpi和大小

gm convert -density 288 -geometry 25% image.gif image.gif

(缩小为原先的1/4,并且dpi为288)

gm convert -resize 640x480 image.gif image.gif

(转换为640x480的图像)

6. 在图像上添加文字

gm convert -font Arial -fill blue -pointsize 18 -draw "text 10,10 'your text here'" test.tif test.png

7. 从gif文件中抽取一帧

gm convert "Image.gif[0]" first.gif

8. 建立gif图像

gm convert -delay 20 frame*.gif animation.gif

gm convert -loop 50 frame*.gif animation.gif

(让动画循环50次)

gm convert -delay 20 frame1.gif -delay 10 frame2.gif -delay 5 frame3.gif animation.gif

(对每一帧手动指定延时)

9. 截屏

gm import a.jpg

用鼠标点击所要截取的窗口,或者选择截屏区域,保存为a.jpg

gm import -frame a.jpg

保留窗口的边框

Apache22中配置虚拟主机(Apache VirtualHost)

Apache VirtualHost的作用就是可以让一个apache为多个域名服务,相当于一个服务器挂了N多个网站,举个例子:

我的apache服务器,ip为x.x.x.x,我有两个域名www.tootoogo.org和lp.tootoogo.org,设置这两个域名都指向x.x.x.x,在apache服务器上设置virtual host后,apache服务器可以实现同时为这两个域名服务,使得这两个域名分别指向不同的网页,于是我的一个服务器上就同时有了两个网站。

Apache VirtualHost配置方法:
在httpd.conf文件末尾添加以下内容

NameVirtualHost *:80

<VirtualHost *:80>
ServerAlias www.tootoogo.org  #貌似这一行没必要
DirectoryIndex index.html index.php
DocumentRoot "/var/www/data1/“
ServerName www.tootoogo.org
ErrorLog "log/tootoogo-error_log"

CustomLog "logs/tootoogo.access"

</VirtualHost>

<VirtualHost *:80>
DirectoryIndex index.html index.php
DocumentRoot /var/www/data2/

ServerName lp.tootoogo.org

ErrorLog "log/lp.tootoogo-error_log"

CustomLog "logs/lp.tootoogo.access"

</VirtualHost>

这样就可以使用两个域名解析到同一IP上却得到不同页面。

如果要禁止用户直接用IP进行访问,只要在
NameVirtualHost *:80
这句之后插入以下内容:

<VirtualHost *:80>
ServerName YourIpAddress
<Location />
Order Allow,Deny
Deny from all
</Location>
</VirtualHost>

备注:

修改httpd.conf中的
<Directory "/usr/local/www/apache22/data">

<Directory "/usr/local/www/apache22/">
那么就可以
使用下面的目录分别放置这两个域名对应的网页了
DocumentRoot /usr/local/www/apache22/data1
DocumentRoot /usr/local/www/apache22/data1

////////////////题外话////////////

如果需要监听其他端口号,可以加入

Listen yourIP:port,例如Listen 192.168.1.1:8081,那么对应的

NameVIrtualHost *:8081<VirtualHost *:8081>

ServerName www.tootoogo.org:8081

//////////////////////////////////

第 1 页,共 2 页12