Outside access to the GAE-powered XMPP bots


Origin: Enabling chat outside Google Apps

To use XMPP bots, deployed on Google AppEngine (thanks to the new AppEngine SDK 1.2.5) from non-Google XMPP accounts (jabber.org etc.), in the DNS records for your domain (example.com) add:

_xmpp-server._tcp.example.com. IN SRV 5 0 5269 xmpp-server.l.google.com.
_xmpp-server._tcp.example.com. IN SRV 20 0 5269 xmpp-server1.l.google.com.
_jabber._tcp.example.com. IN SRV 5 0 5269 xmpp-server.l.google.com.
_jabber._tcp.example.com. IN SRV 20 0 5269 xmpp-server1.l.google.com.

[Web 2.0][Google][GWave] Google Wave Federation Protocol with Prosody XMPP server

To be “on the wave” I’ve done some experiments with Google Wave Federation Protocol. Other people already made it working with OpenFire (and another OpenFire install) and ejabberd, so I decided to try with Prosody - very easy to install Lua-based XMPP server, I’m enjoing recently. From version 0.4.0 Prosody have support for external components. My experiments was with the current (0.5.0) version.


Like always in the beginning RTFM - "Components in Prosody". For the Wave protocol - no differences from the other manuals - create fedone war, generate certificates, corect the run-server.sh script etc.


For the Prosody XMPP server (/etc/prosody/prosody.cfg.lua):

Host "*"
    ...
    -- External components
    component_ports = { 5275 }
    component_interface = "0.0.0.0"
    ...

-- Google Wave experiments
Component "wave.example.com"
    component_secret = "some_secret"

Restart the Prosody server and execute the run-server.sh (be sure the secret in the Prosody config file and in the run script are the same).


Done. Enjoy.

Ruby Sinatra: uninitialized constant Rack::File::MIME_TYPES

Original: rack newb problem w/ 0.9.0

When tried to run a sinatra based application, I received an error message:

./sinatra/lib/sinatra.rb:1156:in `mime': uninitialized constant Rack::File::MIME_TYPES (NameError)

According to Ryan Tomayko "...MIME_TYPES constant got shuffled around in this release (rack release)...".

The solution (temporary) is to define Rack::File::MIME_TYPES by yourself before requiring sinatra:

require 'rack/file'
class Rack::File
   MIME_TYPES = Hash.new { |hash, key|
   Rack::Mime::MIME_TYPES[".#{key}"] }
end
require 'sinatra'
...

How to use Archlinux Pacman?

Packages installation:

pacman -Sy package_name - packages installation and local packages db sync
pacman -S package_name - packages installation along with dependencies
pacman -Sl repository_name - display packages list of a given repository
pacman -Sv package_name - information about operation

Removing packages:

pacman -R package_name - removing package without dependencies
pacman -Rs package_name - removing package along with dependencies
pacman -Rn package_name - purging package

System update:

pacman -Su - update all the packages
pacman -Syu - update all the packages and synchronize local packages database

Database queries:

pacman -Ss keyword - search for all packages matching the keyword
                                     (where the keyword is a part of the package name)
pacman -Qi package_name - information about package
pacman -Ql package_name - list files that a given package consist of
pacman -Qs package_name - search files installed on hard disk

Other commands:

pacman -Sw package_name - download package without installation
pacman -A /file/path/file.tar - install package
pacman -Sc - clean cache (old files)
pacman -Scc - clean cache (all files)

Original article

GMail backup

After the rumors about locked GMail accounts, decided to backup my important emails. The article How to back up your Gmail on Linux in four easy steps helped me a lot. My setting in ~/.getmail/getmail.gmail are (IMAP, Maildir):

[retriever]
type = SimpleIMAPSSLRetriever
server = imap.gmail.com
username = my_name
password = my_secret
mailboxes = (”personal”,”important”)

[destination]
type = Maildir
path = ~/gmail-archive/

[options]
verbose = 2
message_log = ~/.getmail/gmail.log

The backup itself was done via:

$ getmail -r ~/.getmail/getmail.gmail

github error: failed to push some refs

When trying to push to github received:

$ git push
To git@github.com:zh/laconica.git
 ! [rejected]        master -> master (non-fast forward)
error: failed to push some refs to 'git@github.com:zh/laconica.git'

The solution

$ git pull
....
$ git push