05
Ago 13

Makefile Macro for Testing External Tools

Quick & Dirty macro for testing the existence of external tools within a Makefile.

If this is reused correctly, one can avoid repeating test and set code for each tool required by a build-system.

The first argument is the variable used to store the tool path and the second argument is the name of the executable. The usage of which(1) presumes a reasonable PATH set by the user.


02
Set 12

Finding the root device on linux

This is an example on how to find which device corresponds to your root filesystem on linux. This code was inspired by Michael Opdenacker post and related questions on StackOverflow.

The output will mark the root device partition with an asterisk.

This code has the advantage of not touching all the entries at /dev as done by rdev(8) nor recursing the files under /sys/block to find the exact device, which would be a bit more complex than parsing /proc/partitions.


08
Ago 12

Quick Recipe to Enable clang_complete on Vim

It’s been a long time since my friend Thiago wisely taunted me to start using clang on vim scripts (and on everywhere else too). I finally made some time to take a look on it, mostly because of this excellent rant on the subject.

The core of the problem is that OmniCppComplete isn’t a compiler and you can’t expect something that isn’t a compiler to fully understand code. — Guy Rutenberg

So, here comes my quick recipe to get it running on vim7.3+ with python support. I assume you already have your vim setup under revision control and use pathogen to group multiple bundles (these requirements are so lame that I refuse to spend any time to justify them ;-) ).

  1. install clang and partners
  2. remove omnicppcomplete bundle as in this answer
  3. create new bundle
  4. fine tune clang_complete settings
  5. profits ;-)

Done! C/C++ code completion at the tip of your fingers.

Just as disclaimer, there are still some rough edges on the clang_complete script, e.g.

  1. the preview window is not informative at all (better to disable with :set completeopt-=preview)
  2. you need to manually reload source files after updating .clang_complete files (just a problem on initial setups)

However, these do not spoil the overall experience at all. The next step will be to install Ubuntu 12.04 for libclang-dev usage (much faster than using clang command).


20
Jan 11

Escondendo a horrível barra de abas no Vim

Muito tempo sem postar por aqui, desculpem-me.

Desde que tive a chance de revisar o e-livro Hacking Vim 7.2 de Kim Schulz1 e um amigo meu começou a usar o vim como sua principal ferramenta de desenvolvimento, fuçar nas configurações e funcionalidades do Vim tornou-se algo ainda mais agradável.

Na tentativa de melhorar o meu desempenho quanto a edição de vários arquivos, estou tentando usar tabpages ao invés de apenas algumas janelas. Está funcionando como uma espécie de pilha de contexto para mim, já que posso usar uma tabpage (provavelmente com poucas janelas) para modificar arquivos de um projeto e outra tabpage pra outro, mas que estão relacionados (ou uma tarefa não-relacionada no mesmo projeto ). Além disso, usando mais tabpages e menos janelas pode economizar um espaço precioso na tela.

Mas o que fazer sobre aquela tabline horrível que, além de ferir meu senso de estética, gasta uma linha completa da tela? Graças a natureza extremamente flexível do Vim, não demorou muito para encontrar uma resposta. Ele veio em forma de desabilitar o tabline inteira e colocar a sua única informação útil no statusline. Usei um pouco de scripting para superar a única exceção que consegui prever e tive a chance de experimentar minhas habilidades enferrujadas em python + vim. Praticamente tudo que alguém precisará pra unir os dois domínios está neste pequeno exemplo (além da API completa do módulo vim, facilmente acessível através do comando :h python).

Aí você vê como passar argumentos para métodos de python e como alimentar os valores de volta ao ambiente do vim. Eventualmente, publicarei meu vimrc. completo com comentários para que todos possam fazer aquele discurso sobre o quanto a sua solução é melhor. ;-)

[1] como perdi meu notebook devido a um assalto na assistência técnica, as anotações da revisão também foram perdidos. Vou precisar re-revisar o livro para ter algo publicado sobre o mesmo.


28
Mai 10

gource: OpenGL-based 3D visualisation tool for source control repositories

Too much fun the tool I’ve came to know through my friend Adenilson’s blog1. In a glance one can explore effort put into a project in a way much better than any other command-line or graphical application known.

The only boring thing is to use it in my machine, a hp pavilion dv4-2167sb, which, AFAIK, still lacks a good graphical acceleration support.

I’ve made a basic debian package (using checkinstall2) for people too lazy to compile by themselves. Enjoy it3 and have fun!

[1] http://savago.wordpress.com/2010/05/21/6-months-of-plasma-in-10-minutes/
2 ???
3 ???


05
Mai 09

(English) Old School Techniques

Página disponível somente em English.


25
Mar 09

Git References’ Pointers

Earlier this year I’ve spent some time gathering references to study Git, the version control system everybody seems to love nowadays.

Thankfully, someone took the time to bind several useful links in one central webpage. If you wanna start studying Git, that’s the place to start. Kudos for such practical people (more specifically Scott Charcon and Petr Baudis).

http://git-scm.com/documentation

Just for reference, I’ll paste below the stuff I had.

Forwarded conversation
Subject: Git Documentation Pointers
————————
From: Milton Soares
Date: Mon, Jan 19, 2009 at 12:33 PM

Hi.

Just to organize and share all the references I’ve gathered about Git learning.

On-line Resources

$ git help git
$ man gittutorial

Git Homepage Resources

http://www.kernel.org/pub/software/scm/git/docs/everyday.html
http://www.kernel.org/pub/software/scm/git/docs/user-manual.html

SVN to Git crash course

http://git.or.cz/course/svn.html

Recording of the Git tutorial given by Bart Trojanowski for the OGRE

http://excess.org/article/2008/07/ogre-git-tutorial/

Palestra Git para o Google by Linux Torvalds

http://br.youtube.com/watch?v=4XpnKHJAok8

Git from the bottom up

http://www.newartisans.com/blog_files/git.from.bottom.up.php

———-
From: Milton Soares
Date: Tue, Jan 20, 2009 at 4:36 PM

More pointers:

GitWine – git tips by wine people

http://wiki.winehq.org/GitWine#head-079f5369fdb9346845a4a8c82475eb7a198312be

Git Wizardry

http://www-cs-students.stanford.edu/~blynn/gitmagic/index.html

Git Wiki

http://git.or.cz/gitwiki/

Git Cheat Sheet

http://ktown.kde.org/~zrusin/git/

———-
From: Milton Soares Filho
Date: Sat, Feb 21, 2009 at 11:15 AM

Yet another usefull link (pretty graphical explanations on git objects).

Tv’s cobweb: Git for Computer Scientists

http://eagain.net/articles/git-for-computer-scientists/