Smokeping on nginx

nginx: include next config:# smokping nginx configuare# system os: debian 7.0location /smokeping { access_log /var/log/nginx/server.smokeping.access.log; error_log /var/log/nginx/server.smokeping.error.log; root /var/www; index smokeping.cgi; auth_basic “Restricted”; auth_basic_user_file /var/www/users.htpasswd; location ~ .cgi$ { root /var/www; include /etc/nginx/fastcgi_params; fastcgi_pass unix:/var/run/fcgiwrap.socket; fastcgi_index smokeping.cgi; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; }}new folder:mkdir /var/www/smokepinglink file to /var/www/smokeping:ln -s /usr/share/smokeping/www/* /var/www/smokeping/create htpasswd filehtpasswod /var/www/users.htpasswdreload the sevice configureservice nginx reload

[配机]APU-E450

按照同事的要求1k内完成。玩页游,看电影~0 CPU: APU E2-1800 这个比较划算,近两年出来比较超值的U了,Intel的U就烂在GPU上,这个是事实。200 内存: 4G足够看看电影玩玩网页游戏了,本身收到主板限制120 硬盘: 120G很小?用完再加,这个简单,二手~250 显示器: 19寸,很简单很普通的国产A+屏幕350 主板:APXD1-DM 50 电源:19V适配器60 键盘鼠标1030 完成~

tw_cli 在 3.10 kernel 出现的崩溃原因

http://serverfault.com/questions/525923/lsi-3ware-tw-cli-and-tdm2-segfault-with-debian-linux-kernels-after-3-8?answertab=votes#tab-topThe problem isn’t the date, it’s that tw_cli is looking for X.Y.Z(-R-arch) in the release and it’s only getting X.Y(-R-arch) - 3.2.0-4-amd64 vs 3.10-2-amd64. When the release is set to 3.10.0-2-amd64 it runs fine. They may be doing a sscanf() with limited formats, and little or no error checking.jam:~# uname -r3.10-2-amd64jam:~# tw_cli /c0 show firmwareSegmentation faultjam:~# echo 3.10.0-2-amd64 > /sys/module/utsname/parameters/releasejam:~# uname -r3.10.0-2-amd64jam:~# tw_cli /c0 show firmware/c0 Firmware Version = FE9X 4.

sqlalchemy + pyodbc 读取MSSQL数据的UTF-8处理

这段时间需要直接读取MSSQL 2000的数据(都是那些行业霸王害的!)。因为一直用SA读取,所以就配置了pyodbc + freetds进行处理。可是正常的配置,可以在命令内进行,问题出现在代码中。既是代码链接部分了。详细注意一点:engine = engine = sa.create_engine(dsn, connect_args={‘unicode_results’:True})就是这么简单,增加一个链接用参数:‘unicode_results’:True

DD-Wrt关于VPN客户端注意问题

dd wrt具备的功能是非常完整的,我现在用的asus一款过气路由(13U B1)做场外监控。基本依靠VPN(openvpn)客户端链接,发现一个非常容易被人忽略的问题时间。一般来说小路由上面的时间非常容易被人遗忘,提醒自己,并且作为意见写下。对应问题: tls error 客户端证书验证失败。解决方法: 设置ntp同步时间公开的ntp 服务器如下:http://support.ntp.org

Magento with python connect

近期一直在接触Magento这个PHP的商贸平台。非常强大的后台,同时也带来了非产大的维护量。好像我这种已经被Python污染到简单至上的人,用起来,绝对是噩梦。找到了一个非常好的支持库:python-magento: https://github.com/zikzakmedia/python-magento这个库本身是为了对接OpenERP开发的,顺手借用,觉得非常适合来作为后台支持。毕竟社区版的Magento后台功能非常有限。

sqlalchemy relationship实例添加顺序

近来一直埋头到python的编程中。用到了sqlalchemy这个库,记录下以下一个案例。定义两个Model类class A(Model): … child = relationship(‘B’, backref=‘parent’)class B(Model): … a_id = Column(…, ForeignKey(A.id))然后我们要将B实例添加到A实例child中,正确的做法是,先读取A实例到会话中后操作B实例:>>> a = A.query.filter(…).first()>>> b = B() or B.query.filter(…).first()>>> a.child.append(b)>>> db.session.commit() OK这样是没有问题,当然留意,让建立B后再读取A实例到会话,提交的时候会提示A实例已经有变化的错误,如下:>>> b = B() or B.query.filter(…).first()>>> a = A.query.filter(…).first()>>> a.child.append(b)>>> db.session.commit() ObjectDereferencedError: Can’t emit change event for attribute ‘A.child’ - parent object of type has been garbage collected

OpenVPN Client in Windows

拥有一个OpenVPN的认证帐号或者个人证书;2. 下载一个Windows客户端:http://openvpn.se/files/install_packages/openvpn-2.0.9-gui-1.0.3-install.exe3. 安装客户端4. 编写合格的配置文件:xxxx.ovpn,内容(因应你的服务器来变化):clientdev tap2proto udptls-clientnobindca /etc/openvpn/keys/ca.crtcert /etc/openvpn/keys/single.crtkey /etc/openvpn/keys/single.keycomp-lzopersist-keypersist-tun# 需要的route# route 192.168.0.0 255.255.0.0 192.168.252.254remote [VPN 服务器地址] [VPN 服务器端口]5. 最后点击右下角的图表,选择你刚才配置,启动VPN客户端吧。

Bind9 Dynamic DNS

Dyndns is so nice!1.KeyGen:#dnssec-keygen -a HMAC-MD5 -b 128 -n HOST ddns-keyKddns-key.+157+17069.keyKddns-key.+157+17069.private2.Configure bind name.conf.local. add blow lines:key ddns-key { algorithm HMAC-MD5.SIG-ALG.REG.INT; secret “[key in public file]“;};zone “example.com” { … allow-update { key ddns-key; };};3.Use public key to update zone filensupdate -v << EOFserver ns1.example.comkey ddns-key [key in public file]zone example.com.update delete test.example.com. 300 Aupdate add test.example.com. 300 A 192.168.0.22showsendEOF

simulate www browser with python

Simulate www browser with python. So easy with these libraries: spynner: base on libQtNetwork splinter: base on selenium WebDriver but not stable. Spynner: #!/usr/bin/python # -*- coding: utf-8 -*- import spynner import pyquery browser = spynner.Browser(debug_level=spynner.INFO) browser.create_webview() browser.show() browser.load('http://www.wordreference.com') browser.load_jquery(True) browser.choose('input[name=lr=lang_es]') browser.click('input[name=enit]') browser.click('a[class=l]:first') d = pyquery.PyQuery(browser.html) d.make_links_absolute(base_url=browser.url) href = d('a:last').attr('href') print href print len(browser.download(href)) browser.browse() Splinter install splinter: easy_install splinter install depend google chrome or firefox; install depend webdriver google chrome server wrap, download some package in https://code.