domingo, 29 de diciembre de 2013

Hide mouse cursor while typing

Long time ago I already blogged about an emacs way to move the mouse cursor when you are typing close to it.


Yesterday I discovered that there's a much more simple way to unclutter your screen making the cursor invisible.

(setq make-pointer-invisible t)
Voilà, that's it.

jueves, 19 de diciembre de 2013

lua and luajit

In the lua workshop, lots of nice topics were raised, but something that striked me was when everyone agreed that writting lua for luajit or for the official lua VM was totally different, and ppl had different mindsets when writting for one or the other.  I know there's a big difference on how to write bindings to C (luajit being more fond of ffi and stock lua prefering the Lua C Api.


If you wanna know a bit more on how luajit works and where it gets its blazing speed, here you have some links to explore it, and to get a grasp of differences between lua implementations.

Agentzh talking about why he (and cloudflare) are targeting mostly luajit:

Nice introduction to luajit. In fact it's mostly lua, but maybe the second part will be more targeted to luajit

Mike Pall has written a few times about how luajit tracer works.

And here it's a functional library which, not being directly linked to luajit, it makes a really nice usage of iterators to build code structures lazily and make the traces jittable by luajit. nice code read.

If you're on the stock lua vm, here you have a paper with a good overview of how lua 5.0 was implemented.

Also, there are a lot of libraries and apps that are targeting just the luajit implementation. It creates some nasty splits on the community, but you know... these things happen.

martes, 10 de diciembre de 2013

Reading lua source

As I'm digging deeper into lua, I'm from time to time looking at the lua C source code itself, to see how something is implemented.

It's nice to see a highly commented code with some quite clear parts which goes right to the point. Quite tough though and dense at many other parts.  The whole lua 5.2.2 has a bit more than 14K lines. Not bad for the language, compiler, vm, repl, C Api, and libs.

Anyway, here's a couple of links I found useful in case you want to have a deep look at the lua source:

lunes, 2 de diciembre de 2013

Lua Workshop 2013

I was lucky enough to be in the Lua Workshop 2013. Held in Toulouse.

I had lots of fun there, both in the conference and outside it. For me, one of the most important topics raised were the speciation of the Lua world.  Stock Lua, LuaJIT, openresty, luvit ... Many different environments for which lots of packages do not work in different environments (lua-redis and lua-resty-redis, for example). 

This 'problem' extends to other parts of the language and comunity, like packaging. You cannot use luarocks for Luvit, or, the openresty packages are not in LuaRocks. The community is aware of that, and trying to find some compromises to create a healthy ecosystem.  I loved when LuaDist, LuaRocks and the debian packager of lua started an 'impro' discussion on issues they had, pros and cons.

Other talks were also amazing, like Roberto's one: 'Lua, past present and future'. Great way to expose the Lua history and philosophy and reasoning behind some of the features that Lua came to have nowadays. (Spoiler for the future: They are working on Macros!!!)

People modifying the vm to adapt it to their needs were also really wicked cool things we saw there.

Thanks to 3scale for sponsoring my trip, and to the Lua community for being so awesome :).

miércoles, 20 de noviembre de 2013

martes, 12 de noviembre de 2013

Renaming 'used' directories in Zsh and Bash

I can't understand why, oh why, neither bash nor zsh can apply the same policy to mv that they apply to umount, so that when trying to umount a volume that is in use, it tells you so.

When the directory you're in is renamed (moved),the shell keeps showing the old path you were in without notifying you in any way that this directory you see in the prompt is not that anymore.

 Probably it's an inode thing: When you change the name to a file/dir, you probably just have to change the inode's name. And I'm fine with it. Anyway it'd be a waste of resources to try to communicate to other open terminals/shells that there's been a change in a remote directory in the system.

That, and probably for thousand reasons I don't even know its existence.

So the question would be. Why couldn't we make bash/zsh check for the existence of the cwd when displaying PS1 if in the PS1 itself there's the metachart to show the directory path (%~ in zsh)?

Sorry if it sounds a bit rude, I just had an amazing debugging session for 2 hours because I was debugging the wrong thing. My bad, I know, but.....


So here's the way to reproduce
[ /tmp ] %mkdir test
[ /tmp ] %cd test 
[ /tmp/test ] %ls
[ /tmp/test ] %mkdir foo
[ /tmp/test ] %echo OHAI >foo/bar
[ /tmp/test ] %cd foo 
[ /tmp/test/foo ] %ls
bar
                                     In another terminal
                                     [ ~ ] %cd /tmp/test 
                                     [ /tmp/test ] %ls
                                     foo
                                     [ /tmp/test ] %mv foo bar
                                     [ /tmp/test ] %ls bar 
                                     bar
[ /tmp/test/foo ] % ls
bar
[ /tmp/test/foo ] %pwd
/tmp/test/bar


Is there a reason for that?


PS: My real case was something even more tricky as I changed 'reponame' to 'reponame2', and then recreated 'reponame', so I had different shells pointing to 'the same' path, without being actually the same.

domingo, 10 de noviembre de 2013

Jekyll with basic auth in heroku

Dabbling with different systems to write a static site, I was wondering if there would be a way to build a jekyll like site with access control (basic auth is fine) at zero cost.

rack-jekyll is needed to turn jekyll to a rack-like app.  Once we're in rack universe, we can easily add basic auth to it.

Unfortunately, I can't show the repo itself (remember, I needed auth....), but most interesting stuff is just  in the following links. The job left to be done is the glue-ing part.

But If I could do it myself, it can't be any hard.