Archive for 05月, 2009

crontab 啊 星期五, 05月 22nd, 2009

这么多年了,才发现没看过man 5 crontab
可以设置路径的哦。
可以设置用户的哦。
☎ cl
# m h dom mon dow command
SHELL=/bin/bash
PATH=/home/exp/应用/脚本/:/usr/local/bin:/bin:/usr/bin
*/30 * * * * msg 抽烟了,其他时间禁止吸烟。
50 17 * * 1-5 msg 下班了。
0 21 * * * msg 记账。

永中的字体 星期四, 05月 21st, 2009

新安装一个/home/exp/安装/EIO2009_Trial_ZH_Lin.tar.gz
结果jre字体都不设置,都方块。
/usr/local/Evermore/EIOffice/Jre/lib/fonts/fallback
☎ sudo ln -s /usr/share/fonts/zh_CN/TrueType/* .
居然要自己链接字体。

整理下字体 星期一, 05月 18th, 2009

2009-05-18 11:30:45 一 ~
☎ l /usr/share/fonts/
truetype/ type1/ X11/
2009-05-18 11:30:53 一 ~
☎ l /usr/share/fonts/truetype/
freefont/ ttf-dejavu/
2009-05-18 11:30:57 一 ~
☎ l .fonts/
fonts.cache-1 fonts.dir ●可用字体@
2009-05-18 11:31:12 一 ~
☎ l .fonts/●可用字体/
英文字体/ 中文字体/
2009-05-18 11:31:19 一 ~
☎ l .fonts/●可用字体/中文字体/
arphic/ 方正铁筋隶书简体.ttf 华康娃娃体-WaWaW5.ttf
YaHei.Consolas.1.11.ttf 汉仪萝卜体简-HYLuoBoJ.ttf 经典繁勘亭.TTF
YuanTi/ 汉仪雁翎体简-HYYanLingJ.ttf 经典繁毛楷.TTF
方正流行体简体.ttf 汉仪中隶书简-HYZhongLiShuJ.ttf 经典繁颜体.TTF

发现ubuntu现在即时的刷新字体列表了。
移动一个字体,gtk的字体列表马上刷新。

perl的缺点 星期一, 05月 18th, 2009

1. 没有打开文件,搜索,并在指定位置插入行的方法。
2. if的语法,后续单条语句,也必须使用{}包括,不灵活,不简洁。
3. 内部变量,晦涩难记的,每次查手册看。应该搞一个宏替换机制,比如 $& 宏替换成 $reg_result。

可怜的gnome下,这样切换xterm 星期二, 05月 12th, 2009

☎ dog jumporexec
exit if !$ARGV[0];
my @w=`wmctrl -l -x`;
my $l,$s;
foreach (@w){
if (/$ARGV[0]/i){($l)=split(" ");
$s=`xwininfo -id $l`;
if($s=~/IsViewable/){
`wmctrl -i -r $l -b add,shaded`;
}
else{
`wmctrl -i -a $l`;
}
}
}
if(!$l){`$ARGV[0] &`;}

托盘菜单:脚本集合 星期五, 05月 8th, 2009

☎ dog tm-托盘菜单.pl
use utf8;
use Gtk2 -init;
sub popM {
my ($widget, $button, $time, $menu) = @_;
if ($button == 3) {
my ($x,$y,$push_in)=Gtk2::StatusIcon::position_menu($menu, $widget);
$menu->show_all();
$menu->popup(undef,undef,sub{return($x,$y,0)},undef,0,$time);
}
}
open(CFGFILE,"$ENV{HOME}/.traymenu.rc") or die "不能打开配置文件。";
my $menu = Gtk2::Menu->new();
my $item;
my $defaultcmd;
while(<CFGFILE>){
chomp;
next if /^#/;
my($menuname,$iconfile,$command)=split(/,/);
if(!$defaultcmd){$defaultcmd=$command;}
$item = Gtk2::ImageMenuItem->new_with_label("执行 $menuname");
$item->set_image(Gtk2::Image->new_from_file($iconfile));
$item->signal_connect('activate', sub{`$_[1]`;},$command);
$menu->append($item);
}
close CFGFILE;
my $status_icon = Gtk2::StatusIcon->new_from_stock('gtk-home');
$item = Gtk2::ImageMenuItem->new_from_stock('gtk-quit');
$item->signal_connect('activate', sub{Gtk2->main_quit();}, $status_icon);
$menu->append($item);
$status_icon->set_tooltip("托盘菜单:脚本集合");
$status_icon->signal_connect('activate', sub{`$defaultcmd`;});
$status_icon->signal_connect('popup-menu', \&popM, $menu);
$status_icon->set_visible(1);
Gtk2->main();

改良的sdcv.pl 星期一, 05月 4th, 2009


 1 #!/usr/bin/perl

 2 use Getopt::Long;

 3

 4 # 参数:单行输出选择。屏幕提示输出选择。

 5 GetOptions(1 => \$oneline, n=>\$notify);

 6

 7 my $out,$in;

 8 # 无参数时,使用剪贴板内容。

 9 $in=$ARGV[0]; if(!$in){$in=`xsel -o`;} if(!$in){exit;}

10 open(SDCV,"sdcv -n $in|");

11 my $r;

12 while($l=<SDCV>){

13 if($l!~/^$/){$r=$l;chomp($r);$r=~s/–>//;}

14 else{$out="$r –> ";last;}

15 }

16 while($l=<SDCV>){

17 if($l=~/相关|^$/){

18 close(SDCV);

19 if($notify){`notify-send -i ‘/home/exp/媒体/128软件png/pidgin.png’ ’sdcv翻译’ "$out"`;}

20 else{print $out;}

21 exit;

22 }

23 chomp($l) if($oneline);

24 $out.=" ► $l";

25 }

26

27

xterm的5种最新背景色 星期一, 05月 4th, 2009

IndianRed4 SlateGray DarkGreen tan4 blue4