The Archives

  • 11.Jun.10
    hex2bin preserving endianness in C automated | pfortuny | (0)
    I cannot help copying this snippet. Assume f is a (char *) of length L, containing an hex string like '0aabdda' (without the leading "0x", like something coming from a sha function ---or like the sha1 stored by Leopard in the password files, which is the origin of this problem). You want to transform it into the corresponding sequence of bytes (that is, assuming the string is of even length, otherwise, we add a trailing, yes, trailing, at the end, '0'). We shall store the result in t, which points to a (char *) of length L/2. The following C code ...
  • 07.Dec.09
    Vim for programmers (I) shell | fernape | (1)
    Vim is suitable for a myriad of applications. However, it is in programming where it specially shines. Vim offers facilities that make the programming workflow especially easy and efficient. Some people use newer editors (or IDEs) just because they think Vim lacks some new cool features. That is not the case as I will show you in this issue. (I will use C source files in the examples, but most of the information in this post is applicable regardless of the language programming you use) Syntax highlighting Vim supports syntax highlighting for hundreds of file types. Having a look at /usr/share/vim/vim64/syntax (this is ...