Pavol Rusnak #cypherpunk #hacker #openhw #privacy #bitcoin #newmediaart

Make your emails more colorful

I use Mozilla Thunderbird as my e-mail client and I prefer plain-text messages over HTML format. When you view a threaded conversation it looks like this:

img

I found a little hack on Mozilla website which adds different colors for various quote levels in messages. Unfortunately the example is no longer valid for Thunderbird 3, because the default color scheme had changed. I modified the CSS to fit the new look and ended up with this:

img

If you like it, just run the following command to create the userContents.css file:

mkdir -p ~/.thunderbird/*.default/chrome
touch ~/.thunderbird/*.default/chrome/userContent.css

and put the following contents there:

/* Quote Levels Colors */
/* bar color: #729fcf */
blockquote[type=cite] {
    color: #394f67 !important;
    background-color: #edf3f9 !important;
}
/* bar color: #ad7fa8 */
blockquote[type=cite] blockquote {
    color: #563f54 !important;
    background-color: #f4eff4 !important;
}
/* bar color: #8ae234 */
blockquote[type=cite] blockquote blockquote {
    color: #45711a !important;
    background-color: #f0fbe5 !important;
}
/* bar color: #fcaf3e */
blockquote[type=cite] blockquote blockquote blockquote {
    color: #7e571f !important;
    background-color: #fef5e6 !important;
}
/* bar color: #e9b96e */
blockquote[type=cite] blockquote blockquote blockquote blockquote {
    color: #745c37 !important;
    background-color: #fcf6ec !important;
}

Don’t forget to restart Thunderbird! :-)

Gemcutter + openSUSE Build Service cooperation (idea)

gemcutter

If you are closely following Ruby development and especially the situation around ruby gems, you might already know of Gemcutter. It is a new service, which provides a very easy way how to publish gems and also a good API to deal with them. It is not trying to replace RubyForge as whole, just its gem hosting (+ now defunct GitHub gem hosting) and will soon become the central and the only place for Ruby gems. The whole site is MIT licensed and the code is available on GitHub.

During the winter holidays I wrote a simple script which utilizes the Gemcutter API and prints versions of rubygem-* packages in our devel:languages:ruby:extensions Build Service repository compared with the corresponding gem versions on Gemcutter. Using this script and a great gem2rpm (more particularly gem2rpm-opensuse command which applies openSUSE template and is available from rubygem-gem2rpm package), I was able to update nearly a hundred of gems in just two hours. Rails rubygems have a specific packaging in openSUSE, so I left them out, but more than 90% of the rest didn’t need any changes in autogenerated spec file.

This brought me an idea. If only Gemcutter had an option to somehow send out notification that a new gem has been pushed, we could automate the process and have up-to-date rubygems in our devel:languages:ruby:extensions repository almost instantly. (We would still need to keep the list of “dirty” rubygems that need to be updated manually, though. For example, Rails packages I mentioned earlier, where we keep multiple versions, or others where we need to add a patch replacing /usr/local/bin/ruby with /usr/bin/ruby in scripts).

Few days later, Gemcutter gained RSS feed support, but only for the gems one is interested in. I didn’t find the option to have RSS feed for all gems. This could have helped in creating such mechanism, but that won’t be needed anymore because …

… yesterday Nick Quaranto of Gemcutter announced webhook support. I’m really excited, because that’s exactly what we need! When one registers a webhook, Gemcutter emits a POST request on a certain URL when a gem is pushed or updated. This request is a JSON document containing the info about gem. What we need is to create a mechanism that:

  • receives notification via POST JSON request
  • checks whether the package is not “dirty” -> exit if it is (and probably send some email …)
  • fetches the package from the Build Service or create a new one
  • fetches the new gem, removes the old one
  • runs gem2rpm-opensuse to create a spec file replacing the old one
  • adds changelog entry
  • pushes the updated package back into the Build Service

Last but not least: If Fedora and Mandriva had gem2rpm templates in a perfect shape too, Build Service could provide packaged gems also for their distributions.

So what do you think? Any volunteers for this? Right now, I’m off to fix some small bugs I found in gem2rpm while fiddling with it … :-)

image_url function in Ruby on Rails

If you need to get the full URL of an image, just put the following code snippet into ApplicationHelper module in your app/helpers/application_helper.rb:

def image_url(source)
  abs_path = image_path(source)
  unless abs_path =~ /^http/
    abs_path = "#{request.protocol}#{request.host_with_port}#{abs_path}"
  end
 abs_path
end

I wonder why this function is not already a standard part of Rails.

(Idea by Rob Biedenharn)

Avatars in openSUSE Build Service

Thanks to Tom we now have avatars in openSUSE Build Service, so e.g. Involved Users list looks like this:

involved-users

If you have a shady man instead of your nice photo, go to gravatar.com and setup your own one. Don’t forget to add the email address you are using in the Build Service!