Samsung: We’ll refund your #MicrosoftTax

So I asked Samsung what the procedure would be in order to get a Microsoft Tax refund and they replied:

  1. once bought, don’t turn the laptop on
  2. don’t accept the license terms (which is kind of hard to do if you don’t turn it on, but I guess that’s just for the in case you turned it on… situation)
  3. go the nearest Samsung service center (that’s practically just downstairs, for me, yay!)

Since my laptop was the model on show it was a) already turned on and b) I never booted into Windows after bought and c) I completely erased Windows from my SSD.

I guess I’ll get my Microsoft Tax back. Yay! ūüôā

Exmo. Sr. Rui Seabra,

Em resposta √† sua consulta em que solicita informa√ß√£o sobre o port√°til Samsung, agradecemos o email que nos endere√ßou, que ser√° objecto da nossa melhor aten√ß√£o. Informamos que √© poss√≠vel obter um reembolso da licen√ßa do Windows, desde que assim que adquirir o equipamento n√£o ligue o port√°til nem aceite os termos de licen√ßa. Por outras palavras, assim que adquire o equipamento dever√° ser reencaminhado pela loja para o centro oficial da Samsung ou contactar a mesma para apagar todo o conte√ļdo do seu equipamento e que lhe seja devolvido o montante da chave OEM, caso contr√°rio, n√£o ser√° poss√≠vel. A assist√™ncia t√©cnica autorizada pela Samsung √©:

Assistencia 35, Lda Lisboa
Rua Jorge Barradas, N¬ļ30 C
1500-371 Lisboa
telf: 214107369

Don’t want no Microsoft tax!

So you might know I bough a Samsung NP900X3C. Yes, it came with Windows. No I don’t use it. Yes I want my money back on that item.

I’ve just asked Samsung Portugal what the procedure is.

Boa noite,

Adquiri um portátil NP900X3C e não utilizo Windows. Desejo devolver a licença de Windows que fui forçado a adquirir na compra do portátil em causa, bem como de todos os softwares incluídos no sistema operativo a devolver.

Desde que o arranquei pela primeira vez que corre GNU/Linux, neste momento Fedora e encontro-me muito satisfeito com o suporte, mas não concordo com a licença do Windows nem posso ser, legalmente, forçado a aceitá-la para comprar um portátil.

Como devo proceder?

Obrigado em avanço,
Rui Seabra

Screenshot from 2013-12-15 01:45:13

How to fix your pump.io site name

A newbie mistake that is quite easy to do on pump.io is to set a name for your instance, then decide to change and… oops, you changed /etc/pump.io.json but it doesn’t change! WTF!?

In my case I was particularly pissed off because there’s a bug on pump.io with certain characters, I had named my instance 1407’s Pumps but apparently pump.io doesn’t like that quote there… displayed instead 1407s Pumps. ANGRRRY!

After digging through all keys in my instance, I found out that mine was service:urn:uuid:b0f6e849-4a8b-4b8a-9f3d-1ee221d62d58 (faked uuid), but there may be a lot of service:urn:uuid: entries (234 when I did this)!

Here’s how you can fix it on your database as well (I’m using redis, you’ll have to adjust to your particular case if using another DB).

echo "keys service:urn:uuid:*" | redis-cli > uuids.txt
cat uuids.txt | while read KEY ; do
    echo "set $KEY '$(echo get $KEY | redis-cli)'" >> uuids-set.txt
done
grep "MISTAKEN TITLE" uuids-set.txt > title-fix.txt

So now you can edit title-fix.txt with your favorite text editor and fix the field displayName to your pleasure, and after saving your change you are now ready to apply it:

redis-cli < title-fix.txt

I doubt restarting is needed, but I did it anyway, you can try. ūüôā

Forgot to set email in your pump.io? Fix it!

Pump.io is an awesome distributed/federated social network, but it’s still green software and has many rough edges. One boring one is that when you’re setting up your instance you may run into the pitfall of not setting your email, and then after you posted more than you’d want to loose by resetting it… you can’t enable requireEmail anymore because you’ll be kept out of your own instance.

Sucks, innit? But there’s a fix, all you need to do is add the email field to your user’s data. In my example I’ll be using redis so your millage may vary according to your choice of databank, but the idea is the same, just figure out what your particular case needs to do to implement the same idea.

You can get your user’s data and fix it like this (note, lines broken for blog display):

redis your.ip.addr.ess:6379> get user:RuiSeabra
"{\"nickname\":\"RuiSeabra\",\"updated\":\"2013-08-15T20:42:58Z\",
   \"published\":\"2013-08-15T20:42:58Z\",\"_passwordHash\":\"haha",
   \"profile\":{\"objectType\":\"person\",
   \"id\":\"acct:RuiSeabra@p.1407.org\"}}"

redis your.ip.addr.ess:6379> set user:RuiSeabra
"{\"nickname\":\"RuiSeabra\",\"updated\":\"2013-08-15T20:42:58Z\",
   \"published\":\"2013-08-15T20:42:58Z\",\"_passwordHash\":\"haha",
   \"profile\":{\"objectType\":\"person\",
   \"email\":\"my-rms-email@1407.org\",
   \"id\":\"acct:RuiSeabra@p.1407.org\"}}"

So now it’s fixed and you can re-enable requireEmail in your pump.io.json:

[rms@pump ~]$ sudo grep -i requir /etc/pump.io.json
    "requireEmail": true,

Raising awareness of Pump.io

Hey guys, let’s try to expand pump.io awareness ok?

  • Do make an effort to post to Public (Evan… grrr…. why can’t we have a default “To:”)
  • Plug your public activity url on your web page like I did here (check the “Follow me…” box on the right)! ūüôā
  • Link people’s names on your blog posts to their public activity urls

Come on, just do it!

pump.io as systemd service

So what’s wrong with this first very basic attempt to start pump.io as a systemd service?

[Unit]
Description=Pump.io
Requires=redis.service
After=redis.service

[Service]
Type=simple
ExecStart=/opt/pump.io/pump.io/bin/pump
Restart=on-abort

[Install]
WantedBy=multi-user.target

This is what’s wrong….

Sep 05 20:49:38 p.1407.org sudo[17482]: rms : TTY=pts/1 ; PWD=/opt/pump.io/pump.io ; USER=root ; COMMAND=/bin/systemctl start pumpio.service
Sep 05 20:49:38 p.1407.org systemd[1]: Starting Pump.io...
Sep 05 20:49:39 p.1407.org pump[17485]: path.js:360
Sep 05 20:49:39 p.1407.org pump[17485]: throw new TypeError('Arguments to path.join must be strings');
Sep 05 20:49:39 p.1407.org pump[17485]: ^
Sep 05 20:49:39 p.1407.org pump[17485]: TypeError: Arguments to path.join must be strings
Sep 05 20:49:39 p.1407.org pump[17485]: at path.js:360:15
Sep 05 20:49:39 p.1407.org pump[17485]: at Array.filter (native)
Sep 05 20:49:39 p.1407.org pump[17485]: at Object.exports.join (path.js:358:36)
Sep 05 20:49:39 p.1407.org pump[17485]: at getConfig (/opt/pump.io/pump.io/bin/pump:58:23)
Sep 05 20:49:39 p.1407.org pump[17485]: at main (/opt/pump.io/pump.io/bin/pump:40:18)
Sep 05 20:49:39 p.1407.org pump[17485]: at Object.<anonymous> (/opt/pump.io/pump.io/bin/pump:151:1)
Sep 05 20:49:39 p.1407.org pump[17485]: at Module._compile (module.js:456:26)
Sep 05 20:49:39 p.1407.org pump[17485]: at Object.Module._extensions..js (module.js:474:10)
Sep 05 20:49:39 p.1407.org pump[17485]: at Module.load (module.js:356:32)
Sep 05 20:49:39 p.1407.org pump[17485]: at Function.Module._load (module.js:312:12)
Sep 05 20:49:39 p.1407.org systemd[1]: pumpio.service: control process exited, code=exited status=8
Sep 05 20:49:39 p.1407.org systemd[1]: Failed to start Pump.io.
Sep 05 20:49:39 p.1407.org systemd[1]: Unit pumpio.service entered failed state.

An ideas why? Starting from the console with sudo /opt/pump.io/pump.io/bin/pump works fine.

Grrr…

HOWTO: pump.io behind Apache

Pump.io is very interesting, but it used to be very hard to put to work behind a frontend, mostly because of web sockets and being designed to be directly connected.

This means that your nodejs-enabled pump.io consumed an IP:port pair and since pump.io is an https oriented application (can be run in http but you really don’t want that) that means your https port (who has more than one IP either at home or his VPS?) is now BUSY with one single application… sucks and I gave up for some time and wasted my connection’s IP address at the standard https port.

Meanwhile… Good news, everyone!

I recently came up a new Apache module for web sockets: mod_proxy_wstunnel.

Searching for pump.io and wstunnel… it turns out my irrational friend Mark Jaroski also published a note about that! Please note that you may not need to build the module, if you have a recent enough Apache 2.4.x version it may already be there, check your bundled modules!

So here’s my setup: the OpenWRT router forwards port 443 incoming into a frontend KVM guest running Apache httpd which then forwards to some of my sites, one of which is my pump at https://p.1407.org/

The frontend’s web site looks like this:

<VirtualHost *:443>
        ServerName p.1407.org
        CustomLog logs/https-p.1407.org-access_log common
        ErrorLog logs/https-p.1407.org-error_log
        DocumentRoot /var/www/html/default

        SSLEngine On
        SSLCertificateFile conf/ssl.crt/p.1407.org.crt
        SSLCertificateKeyFile conf/ssl.key/p.1407.org.key
        SSLCertificateChainFile conf/ssl.crt/startssl-chain.crt
        SSLCACertificateFile conf/ssl.crt/startssl-chain.crt

        SSLProxyEngine On

        <Location /main/realtime/sockjs>
                ProxyPass wss://192.168.x.y/main/realtime/sockjs
                ProxyPassReverse wss://192.168.x.y/main/realtime/sockjs
        </Location>

        <LocationMatch ".*\.(jpg|png|gif)$">
                CacheEnable disk
        </LocationMatch>

        ProxyPreserveHost On

        ProxyPass               /       https://192.168.x.y/
        ProxyPassReverse        /       https://192.168.x.y/
</VirtualHost>

And at my pump.io KVM guest, 192.168.x.y, I have…

{
    "driver":  "redis",
    "noweb":  false,
    "site":  "1407 Pump",
    "owner":  "Rui Seabra",
    "ownerURL":  "https://blog.1407.org/",
    "port":  443,
    "hostname":  "p.1407.org",
    "nologger":  false,
    "serverUser":  "pumpio",
    "key":  "/etc/pump.io/p.1407.org.key",
    "cert":  "/etc/pump.io/unified-p.1407.org.crt",
    "uploaddir": "/opt/pump.io/uploads",
    "logfile": "/var/log/pump.io/activity.json",
    "debugClient": false,
    "firehose": "ofirehose.com",
    "disableRegistration": true,
    "requireEmail": false,
    "smtpserver": "put.your.own.here",
    "smtpuser": "aLoginAtYourServer",
    "smtppass": "some good password",
    "smtpusetls": true,
    "smtpport": 587,
    "smtpfrom": "pump@1407.org",
    "secret": "some good secret"
}

So there you go…

 

Fixing the FirefoxOS default search provider

WTF? FirefoxOS uses Bing as default search provider?

Yuck, I must fix that. Finally after almost a week I have had some time for me and that’s the first thing I must fix. Thanks to the very helpful comment from Mathieu in this blog post, I wrote a very small shell script that replaces the search provider to your favorite one, defaulting to Google.

It uses sudo for the privileged commands but doesn’t need to completely run as root. Its your choice, run ./fix-ffos-search-provider.sh or sudo ./fix-ffos-search-provider.sh taking as optional arguments (in this order), the Title, the URL and it’s Favicon url. Miss one and the Google default will be used ūüôā eg:

./fix-ffos-search-provider.sh \
  "Duck Duck Go" https://duckduckgo.com/ https://duckduckgo.com/favicon.ico

First, it sets the options, then starts adb-server and fetches the browser application (note that you need the android-tools package in Fedora or the Android SDK):

#!/bin/sh

TITLE=${1:-Google}
URL=${2:-www.google.com/m}
ICO=${3:-https://www.google.com/favicon.ico}

sudo adb start-server

sudo adb pull \
  /system/b2g/webapps/browser.gaiamobile.org/application.zip
sudo chown $USER:$GROUP application.zip

mkdir application
cd application/
unzip ../application.zip

Then, it does the magic with the help of Perl:

perl -pi -e " \
    s|(DEFAULT_SEARCH_PROVIDER_URL: ?)'.*?'|\$1'$URL'|; \
    s|(DEFAULT_SEARCH_PROVIDER_TITLE: ?)'.*?'|\$1'$TITLE'|; \
    s|(DEFAULT_SEARCH_PROVIDER_ICON: ?)'.*?'|\$1'$URL'|; \
    " js/browser.js gaia_build_defer_index.js

Finally, it rebuilds the browser application and pushes it back to the phone and reboots it (it shouldn’t need a reboot, maybe there’s a way to avoid this?):

zip -fr ../application.zip .
cd ..

sudo adb remount
sudo adb push application.zip \
   /system/b2g/webapps/browser.gaiamobile.org/application.zip
sudo adb reboot

So, here it is, finally fixed ūüôā Well, temporarily (it will be better fixed following the results of https://github.com/mozilla-b2g/gaia/pull/9454 and https://github.com/gasolin/gaia/commit/47072a825d9e7c2859f4f8de4fb200cc7450e10b or something similar) at least.

Screenshot of FirefoxOS browser googling for 'test'
Googling for ‘test’


CC0
To the extent possible under law, Rui Miguel Silva Seabra has waived all copyright and related or neighboring rights to Fix FirefoxOS Default Search Provider. This work is published from Portugal.