Daniele Esposti's Blog

Install Ubuntu without PAE support

Last night I brought to a new life my old laptop to be used during my commuting time to write posts, to experiments some technologies and last but not least show how old hardware can be recycled and used efficiently. With my great surprise I discovered most of the 32-bit...


Hamming weight's Python implementation

Counting the number of 1ā€™s in a binary representation of a number (aka Hamming weight aka popcount when binary numbers are involved) with Python using different implementations (naive implementations are obviously excluded :-) ). Implementation and benchmarking To compute the Hamming weight of a number in binary representation two implementations...


Disassembly C code for fun ā€“ Part 7: buffer overflow protection

Originally this article was about strings but as soon as I disassembled the first C test code I saw an interesting bit of assembly code so I switched the topic: today we will talk about buffer overflow protection and the canary (obviously Iā€™m not talking about the little bird but...


Disassembly C code for fun ā€“ Part 6: inlining expansion

Today we will talk about code inlining which means the ability of the compiler to replace a function call with the body of the called function. The sample code and disassembly The code outputs the power of two between 0 to 9 by colling a power() function: #include <stdio.h> int...


Timestamp and microseconds on Windows platforms

The datetime.datetime object can return the current date and time with a resolution up to microseconds which is true on *nix platforms but not completely true on Windows platforms. The problem On both platforms, and at least with Python 2.7, the minimum resolution reported by datetime is 1 microsecond: >>>...