terminator配置文件

基于terminator 0.14进行配置,配色方案模仿konsole的一个配色。
~/.config/terminator/config

[code lang="text" wraplines="false"]
audible_bell = False
force_no_bell = True #这两个都是禁止一切形式的响铃(包括视觉上的)
enable_real_transparency = True #开启透明效果
background_color = #2C2C2C
font = Consolas 12 #强烈推荐程序员使用这个字体
foreground_color = #DCDCCD
scrollback_lines = 5000
#palette是颜色表,12位,6位的每位重复一次即可
palette=#33FF33FF33FF:#770055005500:#6600BB4488AA:#DDFFAAFF88FF:#99AABB99DD77:#DDCC88CCCC44:#88CCDD11DD33:#DDCCDDCCCCDD:#770099008800:#DDCCAA33AA33:#7722DD55AA22:#FF00DDFFAAFF:#9944CC00FF33:#EECC9933DD55:#9933EE11EE33:#FFFFFFFFFFFF
maximise = True
background_darkness = 0.8 #透明程度
background_type = transparent #这样设置才能启用透明
[/code]

ps1:vim里面如果偏暗,在vimrc里面添加:set background=dark
ps2:详细的配置选项说明见 man terminator_config
ps3:terminator的可视化配置菜单是摆设么……居然不能保存……

Posted in 应用 | Tagged , , | 2 Comments

雷死人的skype

skype客服:skype最新的4.1版本无法使用国内卡,请使用4.0.4版本

ps:经常用360升级软件的后果出来了……

Posted in 应用 | Tagged , | Leave a comment

cfengine3获取本机ip

项目需要获取本机ip,在文档中没有找到相应的内建变量,而cfengine2是有的,于是上邮件列表问。

答案是有这么个变量的:sys.ipv4 sys.ipv4[eth0]

sys.ipv4 is mentioned a couple of times en passent in the cf3
reference, see for example

http://www.cfengine.org/manuals/cf3-reference.html#Function-splayclass.

I tried a simple report:

bundle agent dev{
reports:
solaris::
“my ip is ${sys.ipv4}”
}

which gave the expected result.

sys.ipv4 should probably have been listed in the section on sys
variables (at http://www.cfengine.org/manuals/cf3-reference.html#Variable-context-sys),
but isn’t there because “There are too many possibilities to document
in the manual”, hehe. However, you should be able to figure it out
with the examples given in the docs and in this thread.

然后另一位boss说:

I’ll look into a workaround for this. Clearly it needs to be fixed.

The documentation is built automatically from the code, so all the different
interfaces make it tricky in this case.

怪不得我觉得cfengine3的手册如此之烂……

Posted in cfengine | Tagged , | Leave a comment

关于linux中ulimit中的max user processes

今天在邮件列表里有人问,为什么一个多线程的python程序运行后,再运行shell程序会出现:

-bash: fork: retry: Resource temporarily unavailable

ulimit -a显示对max user processes进行了限制,然而从字面上看这是对进程数的限制啊……
翻手册最后在man 2 setrlimit中找到:

RLIMIT_NPROC
The maximum number of processes (or, more precisely on Linux, threads) that can be created for the real user ID of the calling process.
Upon encountering this limit, fork(2) fails with the error EAGAIN.

原来在linux里,nproc(在/etc/security/limits.conf中的nproc即对应ulimit的max user processes)限制的是线程数。当然因为在linux里一个进程至少包含一个线程,所以间接也起到了对进程数的限制。

Posted in 运维 | Tagged , , | 1 Comment

Xorg-1.5 鼠标键盘失灵

Gentoo的xorg升级至1.5后进入桌面键盘鼠标失灵,解决办法:

1.启动的时候按I进入交互界面,中止xdm的启动。

2.检查xorg-server的use,加上hal、evdev。

3.内核中需要启用evdev。

4.鼠标的驱动换成evdev。

5.若启动后发现截屏或切换控制台等快捷键失灵,尝试去点keybord的所有Option。

Posted in gentoo | Tagged , | Leave a comment

Gentoo下Virtualbox的Host interface上网模式的设置

需要SSH到虚拟机中的linux,所以需要使用host interface模式来绑定虚拟机网卡。网上的方法大多是使用网桥,比较复杂。这里介绍一个使用tun+iptables的方法:

1. 先在内核中启用TUN

Symbol: TUN [=y]
Prompt: Universal TUN/TAP device driver support
Defined at drivers/net/Kconfig:120
Depends on: NETDEVICES
Location:
-> Device Drivers
-> Network device support (NETDEVICES [=y])

重新编译内核,同时要重新编译iptables和virtualbox的内核module

2.在/etc/conf.d/net中添加:

[code lang="plain" gutter="false"]
tuntap_vbox0=("tap")         //虚拟机使用的网卡接口名
config_vbox0=("10.0.0.1/24")   //此接口的IP
tunctl_vbox0="-u flex"             //flex替换成需给与权限的相应用户名
[/code]

3.在/etc/init.d/下
[code lang="shell" gutter="false"]
ln -s net.lo net.vbox0
[/code]

4.启动net.vbox0

5.将虚拟机的网卡模式选为host interface,下面的接口选择vbox0

6.在iptables的nat表中添加snat

[code lang="plain" gutter="false"]
-A POSTROUTING -s 10.0.0.0/24 -j SNAT --to-source hostip
[/code]

7.打开端口转发

在/etc/sysctl.conf中设置

[code lang="plain" gutter="false"]
net.ipv4.ip_forward = 1
[/code]

[code lang="shell" gutter="false"]
sysctl -p
[/code]

8.在虚拟机中设置相应的ip和网关

Posted in gentoo | Tagged , , , | Leave a comment

pulse audio

alsa声卡驱动经常会出现独占现象,即一个音频播放程序打开声卡后其他程序就不能再访问声卡了。以前只在linux下面听歌,还无所谓,但是现在要开着虚拟机就不行了。

寻找到的解决方案就是pulse audio,emerge这个包,注意去掉”X”的USE,否则不能启动服务。

然后将使用者用户添加至pulse和pulse-access组,同时编译audacious-plugins启用”pulseaudio”的USE。

重登录后,audacious的输出插件选择pulse audio,Virtual Box的audio也选择pulse audio。这样两个系统就都能发声了。

后记:经过今天的使用,发现pulse不稳定,daemon经常挂掉,只能重启所有相关服务和应用程序。另外,我的Virtualbox选择alsa无声,只能选择pulse,哪怕根本没装pulse的包。Orz……

Posted in gentoo | Tagged , , , , | 1 Comment

gnome2.24.3在gentoo的问题

3月16号,gentoo的portage全面把gnome-2.24.3的包unmask了,即使我装的是gnome-light,也是一次大升级。

成功升级后发现问题,gnome-screensaver锁定桌面后解锁时输入框无法跳出,使用revdep-rebuild后发现gnome-settings-daemon的一个so文件损坏,修复后重启gnome,直接弹出错误报告gnome-settings-daemon无法启动,themes失效。
在gentoo的buglist中发现解决办法,将x11-libs/libxklavier由3.8降为3.6。

Posted in gentoo | Tagged , | Leave a comment

debian(lenny) eclipse不能启动

前几天升级debian后,发现eclipse不能启动了,无论是最新的ganymede还是以前的europa,都不能启动。错误日志开头如下:

# An unexpected error has been detected by Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0xb25eb463, pid=7017, tid=3074991792
#
# Java VM: Java HotSpot(TM) Client VM (10.0-b23 mixed mode, sharing linux-x86)
# Problematic frame:
# C  [libxul.so+0x8cc463]

 开始以为是libxul的问题,但是重装xulrunner后无效 。Google了一通,发现一个解决办法:

 在eclipse.ini中加上:
[code lang="plain" gutter="false"]
-Dorg.eclipse.swt.browser.XULRunnerPath=/usr/lib/xulrunner-1.9/
[/code]
然后就OK啦。

Posted in 未分类 | Tagged , | 1 Comment

phpwind5.3的系统邮件被QQ邮箱拒收

今天有同学反应说用论坛找回密码功能QQ邮箱收不到邮件,于是研究了一番,在日志里发现如下记录:

0BD38B4AB6: to=<xxx@qq.com>, relay=mx0.qq.com[222.202.96.161]:25, delay=0.53, delays=0.01/0/0.23/0.29, dsn=5.0.0, status=bounced (host mx0.qq.com[222.202.96.161] said: 550 Error: content rejected.http://mail.qq.com/zh_CN/help/content/rejectedmail.html (in reply to end of DATA command))

然后在记录指明的连接里看了下原因,竟然是被怀疑成垃圾邮件了,难道是因为我没设置域名的MX记录么?于是在服务器上手动发了封邮件,发现能收到。于是转而怀疑内容,经过替换法后最终定位在/template/wind/lang_email.php中的email_additional变量,把它的内容改成别的就行了。

PS:中间的小插曲就是系统总能成功发邮件,论坛确不行,后来才想到是权限问题,ssmtp是750的权限……

Posted in 运维 | Leave a comment