Get your conky location aware

2010-02-19-225826_188x44_scrot

Add this in your conkyrc

${exec curl -s "http://api.hostip.info" | xpath -e "//gml:featureMember/Hostip/gml:name/text()" -q} ${exec curl -s "http://api.hostip.info" | xpath -e "//gml:featureMember/Hostip//gml:coordinates/text()" -q}

Hostip is well known as a service provider of the geoclue framework. It translates IP address to geolocation information. The API we use will return a GML document like

<?xml version="1.0" encoding="ISO-8859-1" ?>
<hostipLookupResultSet version="1.0.1" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.hostip.info/api/hostip-1.0.1.xsd">
 <gml:description>This is the Hostip Lookup Service</gml:description>
 <gml:name>hostip</gml:name>
 <gml:boundedBy>
  <gml:Null>inapplicable</gml:Null>
 </gml:boundedBy>
 <gml:featureMember>
  <hostip>
   <ip>58.212.88.212</ip>
   <gml:name>Nanjing</gml:name>
   <countryName>CHINA</countryName>
   <countryAbbrev>CN</countryAbbrev>
   <!-- Co-ordinates are available as lng,lat -->
   <ipLocation>
    <gml:pointProperty>
     <gml:Point srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
      <gml:coordinates>118.883,32.05</gml:coordinates>
     </gml:Point>
    </gml:pointProperty>
   </ipLocation>
  </hostip>
 </gml:featureMember>
</hostipLookupResultSet>

Because it uses ip to lookup your address, you cannot expect higher resolution and precision currently.

Using weather

Ubuntu仓库里有个weather-util包,可以用来查看天气信息。weather工具从weather.noaa.gov网站获得天气信息,对美国的城市可以直接用名字查询,其他国家只能使用id查询。id的规则和weather.com不太相同。

中国的天气站点id可以在这个页面上查到。比如南京ZSNJ,上海浦东ZSPD。使用weather工具查询:
weather -i ZSNJ

Current conditions at China (ZSNJ) 32-00N 118-48E 12M (ZSNJ)
Last updated Feb 18, 2010 – 08:00 AM EST / 2010.02.18 1300 UTC
Temperature: 35 F (2 C)
Relative Humidity: 59%
Wind: from the SSW (210 degrees) at 4 MPH (4 KT)

简化操作,可以在$HOME下创建.weatherrc文件,形如

[default]
ID = ZSPD
[nj]
ID = ZSNJ

就可以直接使用
weather

Current conditions at China (ZSPD) 31-07N 121-46E (ZSPD)
Last updated Feb 18, 2010 – 08:00 AM EST / 2010.02.18 1300 UTC
Temperature: 35 F (2 C)
Relative Humidity: 47%
Wind: from the NE (050 degrees) at 7 MPH (6 KT) (direction variable)


weather nj

Current conditions at China (ZSNJ) 32-00N 118-48E 12M (ZSNJ)
Last updated Feb 18, 2010 – 08:00 AM EST / 2010.02.18 1300 UTC
Temperature: 35 F (2 C)
Relative Humidity: 59%
Wind: from the SSW (210 degrees) at 4 MPH (4 KT)

老物什 / Old Stuff

大年初一翻旧物,找到一些让人颇有感触的旧物件。2004年买的RH9,2005年夏天买的Fedora 4。前者至今还安装在我家最旧的电脑里,虽然我都忘了它的样子了。

包装
00011
00012
00014
00013
00018

手册
00016
00022
00021

CDs
00015
00017
00019
00020

这个代理商里仁软件似乎已经倒闭了。

Virtual Machine Searcher for Gnome Deskbar Applet

Very glad to announce another daily-coding work: an extension for gnome deskbar applet to search and launch virtual machine. There is a plugin for gnome-do that does the same job. That’s what I create the the plugin for. I switched to deskbar because gnome-do’s Do.exe reminds me nightmares when I was a M$ Windows user. The deskbar applet has been a great replacement, however, the virtualbox plugin in Do is really impressive while deskbar doesn’t provide me the same functionality.

You can ignore words above and just take a look at the screenshot:
deskbar-virtualbox

Download

Download the extension from (the highlighted one):
http://bitbucket.org/sunng/daily-coding/downloads/?highlight=5137

You can also trace the development at bitbucket project. However, the repository is mixed with other small code snippets. Currently, mercurial doesn’t support subdirectory pull. So there is no way to grab the deskbar-applet individually.

Installation

copy this file to /usr/lib/deskbar-applet/deskbar-applet/modules-2.20-compatible/ (Ubuntu installation for example) with super user privilege. Right click desktbar applet, select Preference, Searchers tab, hit “Reload” button, then check the Virtualbox Deskbar Module.
deskbar-preference

Issue

Feel free the report issues on bitbucket:
http://bitbucket.org/sunng/daily-coding/issues/