Category: IT

Raspberry Pi as NAS + Media Server + VPN server

I have an old Raspberry Pi ( the first generation of Raspberry Pi model B), which has been used as my home media center for years. I installed and run libreelec which is a ” ‘Just enough OS’ Linux distribution for running the ultimate entertainment center application Kodi.” I also use Kodi remote control mobile app to control my TV. So far I have been very satisfied with this little single board computer 🙂

Comparing the sizes of my Pi Model B and a card deck

Kodi on…


Read More »

“Closeable Kiosk” (2) — with user scripts

In my last blog post (http://www.smartpeer.net/2013/10/closeable-kiosk-with-firefox-user-styles/) I used user styles to create a “closeable kiosk” with firefox. Google chrome also supports user styles so similar styles can be applied to Chrome too.

Both firefox and Chrome support another “user scripts”, which “Allows you to customize the way a web page displays or behaves, by using small bits of JavaScript.”. it can be applied to selected pages only, or to all the sites/pages. Here is a way…


Read More »

“Closeable Kiosk” with firefox user styles

Recently I got request to create a “closeable browser-based kiosk”– basically a browser in full screen mode, can’t be minimized/resized/moved or returned to non-full screen mode, no browser file menus, no address bar/navigation bar so user have to be stay on the same page, and can’t go to other urls. However user should be able to close it using mouse. This is to be deployed on some real kiosk booths like the ones often seen in a museum. There is no keyboard on the kiosk so short cut key…


Read More »

 海归网 iphone app

my first iphone app, for haiguinet.com….

It’s in app store now: http://itunes.apple.com/us/app/id438046601

我得第一个iphone app : 海龟网iphone app正式上线, 可从app store 免费下载安装

大家可以在iphone上的app store 里搜索“归网”,然后免费下载安装。谢谢各位支持。

请在此报告问题或建议。

注: 在ios4.2 以上版本的iphone/ipod touch 上测试过。其他版本的ios未经测试。

开发感想:
-- 虽然海归网总的感觉是在没落中,但是还是有不少的新老id在这里玩。。。这种亲切感挥不掉。希望通过这个小程序让大家玩得更方便一点。
-- 很不喜欢apple的xcode, 特别是interface builder. 个人觉得很垃圾。
-- objective-c…


Read More »

[民工日记]简单服务器GEO-Routing: 根据ip自动分流

不通过应用程序而纯粹从服务器简单配置。。。transparent to your apps

1. 用 apache mod_rewrite 实现根据用户ip自动选择镜像

这是一个非常简单的实现–如果用户来自中国,自动重定向到位于中国的服务器,否则转到海外的服务器。并且自动检测服务器状态,如果一个服务器倒了所有traffic都会转到另外的server.

在 apache config 里加一个 virtual host:

ServerAdmin [email protected]
DocumentRoot /hosting/balance
ServerName balance
<filesmatch "\.(php|htm|html|pl|asp)"="">
Allow from all

RewriteEngine on
RewriteLog rewrite.log
RewriteLogLevel 9
RewriteMap lb prg:/hosting/balance/ip_prg.php
RewriteRule ^(.*)$…

Read More »

Cheap secondary storage options

Looking at cheap storage for hosting backup/archive… driving force: cost.  NetApp is too expensive.

The following can be taken into consideration:

— Amazon S3 web services. Since it’s only used for backup/archive the cost should not be too high. Need to analyze the cost though. Another potential issue is legal/privacy…

     Technically the best way is probably to use a S3 file system driver so the backup/access is transparent to the apps and existing apps doesn’ t need to be modified. the…


Read More »

[民工日记]LAMP网站建设 之性能优化篇(下)

7. reverse proxy/cache

reverse proxy又称http accelerator是在web server 前面加一道proxy, 所有request先经过proxy, 如果是在proxy缓存内的内容则不用经过web server直接就从缓存取出内容返回给用户的浏览器, 否则转给后面的web server.这样大大减轻了web server 的负担,从而使web server可以专注与处理动态页面,而可以缓存的静态页面则由更加快速轻便的proxy直接返回给用户, 从而提高了系统的总体处理能力和响应速度.

老牌open source proxy 软件Squid就可以用来做reverse proxy/http accelerator.

Apache 的mod_proxy 和mod_cache也可以结合起来达到相同功能.

squid 稳定版本现在是2.6和3.0. 2.6尚不支持http 1.1. 2.5问题较多,建议不要使用.

有一个比较新的开源软件 varnish是专门的reverse…


Read More »

[民工日记]LAMP网站建设 之性能优化篇(上)

LAMP网站建设 之性能优化篇(上)

开源的LAMP (linux/Apache/Mysql/PHP) 平台是流行的web application platform,不少网站,包括海归网都是建立在此平台上.

在帮助海归网正式转移到LAMP平台之前, 笔者虽然长期做网站设计和开发方面的工作,但主要是在J2EE 或者 ASP.NET /ASP方面的应用, 具体是在application 层面, 架构设计主要考虑功能/可扩充性和scalability, 而网站反应速度/性能方面一般不是问题–或者流量不大,或者硬件架构足够强(hardware load balancer, cluster, dedicated web/middle tier/DB tier/team等). 在海归网, 让我有机会在LAMP环境下接触和学习到许多以前做应用或自己玩操作系统时难以接触到的问题– 除了系统和网络管理外,…


Read More »

[民工日记]自己写个简单MP3 ID3 tag转码工具

MP3 ID3 tag自动转码工具

老版本ID3 tag的标准本来只支持ISO-8859-1,也就是只能用西方拉丁字母。新的ID3 tag还支持Utf-16, 所以中文啊越南文之类的都能支持了。

问题是许多网上的mp3歌曲id3 tag编码很不规范。。。拿我来说吧,我有7000多首中文mp3。。。而这些中文歌曲的Id3编码是五花八门:

Gb2312/big5/big5hkjcs 甚至utf-8都有,还有很多根本没有tag而是把作者和歌名都放在文件名上。 这样听歌的时候就比较头痛了--在播放器里不知道现在听的是什么歌, 哪个歌手、专辑等。浏览、搜索歌曲也很不方便。在windows还好点,因为许多windows上的jukebox支持GBK编码能看不少繁体字,但到了苹果的OSX上就无法忍受了:OSX只支持unicode,…


Read More »