Geek as a platform

Sharing images like a "Pr0"

Disclaimer: it's summer, we are under a really long heat wave in Spain, so I didn't feel like moving from the couch (you will understand later :D)

Yesterday evening I was laying on the couch surfing Amazon website using an old laptop (very old) that I barely use, and at some point, I took an screenshot I needed to share with a friend via corporate email... (my idea was to send it to my email account, and this morning, send it from my corporate account)

Anyway, after taking the screenshot I realized:

  • I was no logged in gmail, dropbox, github, etc , and in order to login, I would need a token from my cellphone (and my smartphone was in a different room!!!)
  • No USB drives around
  • The image sharing alternatives that I know of, requires you to create an user and login… Too much for a onetime thing

So I decided to use pastebin to store the image in text format:

  1. Take the screenshot (I used scrot, feel free to use any other tool…) : scrot -d 5 ~/amazon.jpg

  2. Gzip the file: gzip ~/amazon.jpg

  3. Convert to base64: base64 ~/amazon.jpg.gz > ~/amazon.b64

  4. Cat the file and paste the (long) result into pastebin and write down the url

This morning from my corporate laptop:

  1. Download the file from pastebin (save it as amazon.b64)

  2. Set file format UNIX... For instance, using vi: ESC:set ff=unix

  3. Decode it:base64 -d amazon.b64 > amazon.jpg.gz

  4. Unzip it: gunzip amazon.jpg.gz

Et voila, we have the same picture….


I know this doesn't seem very useful (or yes, who knows?) but you might follow the same approach for other things… For instance, I use pretty much the same thing in Python for embedding an old version of pexpect module in my scripts


Issues with Synology 2FA

Hi there

After a few months in the shelf, today I reconnected my Synology DS215j, and to my surprise, I wasn't able to login via DiskStation GUI due to a problem with my autenthication:

'DSM Error'

It was weird because:

a) (you are going to love this one...) "It was working before"
b) I could login to my NAS via SSH with the same user/pass, so it was clearly a problem with the 2 Factor Authethication

Once in SYNOLOGY CLI, I realized the system time was wrong:

'ntp mismatch'

As you can (hopefully) see in the picture, the time in the SYNOLOGY CLI (23:58:13) differs from the one in web GUI (23:54) (and the system time in my MBP as well)

So I connected to the NAS with root password (rather sooner than later I would need to "enable" sudo and block root user in SSH) and updated the date by running:

ntpdate -u

(If this isn't working, try killing ntpd and run ntpdate -u again)

After that, I managed to login using my 2FA code as expected...


PS: First post using github as text editor... Let's see how this goes.

Problems installing IPython Notebook in Cygwin (W7)

While trying to "pip install ipython[notebook]" in my Cygwin installation (W7), I got this error due to libzmq:

 Collecting ipython[notebook]


 Running install for pyzmq


gcc -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -ggdb -O2 -pipe -Wimplicit-function-declaration 
-DZMQ_USE_POLL=1 -DHAVE_LIBSODIUM=1 -Ibundled/zeromq/include -Ibundled -Ibundled/libsodium/src/libsodium/include 
-Ibundled/libsodium/src/libsodium/include/sodium -I/usr/include/python3.4m -c bundled/zeromq/src/address.cpp 
-o build/temp.cygwin-2.0.4-i686-3.4/bundled/zeromq/src/address.o

gcc: error: spawn: No such file or directory
error: command 'gcc' failed with exit status 1


Command "/usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-l4nkh9zq/pyzmq/';
exec(compile(getattr(tokenize,'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" 
install --record /tmp/pip-jicpjqak-record/install-record.txt --single-version-externally-managed --compile" 
failed with error code 1 in /tmp/pip-build-l4nkh9zq/pyzmq

It took me a while to figure it out... In case you were in a similar situation, this is what I did:

1) Install some tools (via apt-cyg or setup.exe)

apt-cyg install libtool automake autoconf   

(you will need the usual tools for compiling C/C++ code, such as gcc,g++,make, etc,etc)


export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

3) Download and compile libsodium

make && make install

4) Download and compile libzmq

make && make install

5) Finally, try to install ipython[notebook] again:

pip install ipython[notebook]

It worked for me... Hope it helps you.


From Octopress to Pelican

Finally I had some time to move away from Octopress... After trying a couple of Python static web generators I decided to give Pelican a try.

The "migration" was pretty easy. Install it via pip, configure your list of plugins and pages, update your posts (you have to do slightly modifications to your Octopress header posts) and you are good to go... I even managed to keep the same design I already had (thanks to this octopress theme)

So far, it feels good to have an easy bloggin platform in Python, so I totally recommend the change!


Bye 2014 && Hello 2015

It is time to say goodbye to 2014... This is how I saw it from my old Samsung Galaxy S3:


(50% business/50% leisure)

Happy New Year 2015!!! I'll see you around!