Futurama: Bender – Robot Grace – or the Geek’s prayer

If you are a fan of Futurama, and Bender the bending robot in particular, you might like this audio clip where Bender says grace before eating:

In the name of all that is good and logical, we give thanks for the chemical energy we are about to absorb. To quote the prophet Jerematic, one zero zero zero one zero one zero one zero one zero one… [Time lapse.] Zero zero one… zero one one zero zero one…two.
Amen.

You might also like:

Life is Short – Forgive quickly

It is always cheesy when I enter a shop and find those cliché quotes hanging on the wall! 🙂

I like it, except for the “break the rules” one. I would encourage you to be responsible if you want to break the rules

You might also like:

The girls from Leisure Suit Larry Reloaded

If you’re a fan of Leisure Suit Larry, then you might recognize those ladies from the Larry Reloaded version:

 




You might also like:

Time: The most precious commodity

It does not take a movie, or reading a book to realize that our most precious asset or commodity is time…

I ran into this viral video about the topic of time scarcity:

I loved the metaphor in that movie. Here’s the full transcript:

Imagine there is a bank account that credits your account each morning with $86,400.
It carries over no balance from day to day.
Every evening the bank deletes whatever part of the balance you failed to used during the day.
What would you do?
Draw out every cent, of course?
Each of us has such a bank, its name is time.
Every morning, it credits you 86,400 seconds.
Every night it writes off at a lost, whatever of this you failed to invest to a good purpose.
It carries over no balance. It allows no over draft.
Each day it opens a new account for you. Each night it burns the remains of the day.
If you fail to use the day’s deposits, the loss is yours.
There is no drawing against ‘tomorrow.’
You must live in the present on today’s deposits. Invest it so as to get from it the utmost in health, happiness, and health.
The clock is running.

Make the most of today.

 

You might also like:

Did you like the Wonder Woman’s theme? Here’s why!

After Wonder Woman’s first appearance in Batman vs Superman movie, Wonder Woman theme was first revealed in the last battle against Doomsday. That theme was so awesome that I loved it immediately.

Little did I know that the theme is not very original, in fact it sounds similar to other songs and in particular the one from Led Zeppelin’s Immigrant song.

In all cases, this video explains all of this better than me:

 

Watch the theme performed by the fabulous and most talented Tina Guo here:

flower separator

flower separator

You might also like:

strtok() C++ wrapper

In this article, I share with you a simple C++ class that wraps the string tokenization function strtok(). The QuickTokenizer class makes it easy to tokenize and enumerate the tokens in a thread-safe manner.

The class code

//////////////////////////////////////////////////////////////////////////
class QuickTokenizer
{
private:
  char *buf;
  char *token;
  char *ctx;

  void FreeBuffers()
  {
    if (this->token != NULL)
    {
      free(this->token);
      this->token = NULL;
    }
    if (this->buf != NULL)
    {
      free(this->buf);
      this->buf = NULL;
    }
  }

public:
  QuickTokenizer() : buf(NULL), token(NULL)
  {

  }

  const char *Tokenize(
    const char *str,
    const char *tok)
  {

    this->buf = _strdup(str);
    this->token = _strdup(tok);

    return strtok_s(buf, token, &ctx);
  }

  const char *NextToken()
  {
    return strtok_s(NULL, token, &ctx);
  }

  ~QuickTokenizer()
  {
    FreeBuffers();
  }
};

Continue reading “strtok() C++ wrapper”

Detect executable format using Python

In this article, I am sharing with you a small Python script that lets you detect if a file is an executable file and what platform the executable is targeting.

The following formats for 32 bits and 64bits processors are supported:

  • Mach-O files: both regular and universal formats
  • Windows PE files
  • Linux ELF files

The script

#---------------------------------------------------------------------
EXEFLAG_NONE        = 0x0000
EXEFLAG_LINUX       = 0x0001
EXEFLAG_WINDOWS     = 0x0002
EXEFLAG_MACOS       = 0x0004
EXEFLAG_MACOS_FAT   = 0x0008
EXEFLAG_32BITS      = 0x0010
EXEFLAG_64BITS      = 0x0020

# Keep signatures sorted by size
_EXE_SIGNATURES = (
    ("\x4D\x5A", EXEFLAG_WINDOWS),
    ("\xCE\xFA\xED\xFE", EXEFLAG_MACOS | EXEFLAG_32BITS),
    ("\xCF\xFA\xED\xFE", EXEFLAG_MACOS | EXEFLAG_64BITS),
    ("\xBE\xBA\xFE\xCA", EXEFLAG_MACOS | EXEFLAG_32BITS | EXEFLAG_MACOS_FAT),
    ("\xBF\xBA\xFE\xCA", EXEFLAG_MACOS | EXEFLAG_64BITS | EXEFLAG_MACOS_FAT),
    ("\x7F\x45\x4C\x46\x01", EXEFLAG_LINUX | EXEFLAG_32BITS),
    ("\x7F\x45\x4C\x46\x02", EXEFLAG_LINUX | EXEFLAG_64BITS)
)

def get_exeflags(filepath):
    try:
        with open(filepath, "rb") as f:
            buf = ""
            buf_len = 0
            for sig, flags in _EXE_SIGNATURES:
                sig_len = len(sig)
                if buf_len < sig_len:
                    buf += f.read(sig_len - buf_len)
                    buf_len = sig_len

                if buf == sig:
                    return flags
    except:
        pass

    return EXEFLAG_NONE

Continue reading “Detect executable format using Python”

Gun with a tracking device from the “Dreamcatcher” movie

I watched the Dreamcatcher movie a while back. It is a nice movie involving young boys, now adults, who have been gifted psychic abilities by an alien. That alien, in the hiding, looks like a human being and waits for the right moment to defend the Earth from other hostile aliens.

In the movie we see a gun with a tracking device in it, I like the concept (not that this is something new). You would never suspect that your gun is traceable:

Speaking of dreamcatchers, I found this nice dreamcatcher on Amazon, check it out:

Dreamcatcher

You might also like:

Jokes for the month of June, 2017

No wonder

A policeman stops a reckless and speeding young driver. The policeman tells the driver: “Do you know that you were driving beyond the speed limit?”

The young, with a smile on his face, replies: “No wonder, this is the first time I drive”

I will be right back

The wife to the husband: “I will go to my neighbor and grab some salt, keep an eye on the food while I am gone. I will be back soon, it will be just 5 minutes at most”

The husband: “How should I keep an eye on the food? What should I do?”
The wife: “It is not much, really! Just stir the pot every half an hour”

The Three Musketeers

Two friends were chatting.
The first one said: “My wife was reading the three musketeers and she gave birth to a triplet. Can you imagine that?!”

His friend replied back in amazement: “God forbids! I actually left my wife when she started reading Ali Baba and the 40 thieves”

True to her word

Man: My wife is one of the few women who stick to their words
The other man: How come?
Man: We have been married since 50 years already and every time I ask her how old is she, she answers 30 years old.

The inventor

The friend: “So tell me, what is the profession of the new tenant you have living in your apartment?”
The landlord: “Oh, an inventor”
The friend: “Really?! What does he invent?”
The landlord: “He keeps inventing excuses so he does not pay the rent!”
You might also like:

Introducing Ganxo v0.1 – An open source API hooking framework

Hello,

Today I release the first Alpha version of Ganxo (pronounced as “Gun Show” or “Gan Chou”), an open source API hooking framework. In Catalan, Ganxo means “hook”, thus the framework’s name.

Writing an API hooking framework was always on my to do list. I started developing Ganxo back in April 2016 and after two weeks of development during my free time, I got busy with other things and abandoned my efforts.

My initial goals were to accomplish the following before going public with it:

  • Support x86 and x64 hooking
  • Write a more extensive test suite
  • Fully document it

This past weekend, I decided to release Ganxo even though I have not met all my goals. As of today, Ganxo works on MS Windows and supports x86 API hooking. The groundwork is laid down and it should be easy to add x64 bits hooking support on Windows or even just port it to other operating systems.

Feel free to clone the code from here and start using it today.

Stay tuned, I plan more features in the coming future!

flower separator
batchography-good-resDo you want to master Batch Files programming? Look no further, the Batchography is the right book for you.

Available in print or e-book editions from Amazon.
flower separator

You might also like:

Wandering towards the sunset: My second painting

I am no artist but this is my second painting.
I enjoyed painting this one on 06/10/2017 at Pinot’s Palette

You might also like: