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:

Are you a fan of The Reverse-Flash character? I am!

Ever since I watched “The Flash” series on Netflix, I fell in love with the Reverse-Flash character. Why not love the regular The Flash character you ask?

Well because, unlike The Flash who got his powers by accident, the Reverse-Flash used knowledge to acquire his powers and go back in time. Another simpler answer: I just love the yellow on red color! 🙂

I bought the Reverse-Flash T-shirt from Amazon. It looks good and has very good quality:

I also got the action figure:

You might also like:

Takeaways from the “California Driver Handbook 2017”

In this article, I share with you my notes from the “California Driver Handbook 2017“. Perhaps it will come in handy when you are preparing for the driving test in California:

Notes:

  • Speed limit
    • The maximum speed limit on most California highways is 65 mph. You may drive 70 mph where posted. Unless otherwise posted, the maximum speed limit is 55 mph on a two-lane undivided highway and for vehicles towing trailers.
    • California has a “Basic Speed Law.” This law means that you may never drive faster than is safe for current conditions. For example, if you are driving 45 mph in a 55 mph speed zone during a dense fog, you may be cited for driving “too fast for conditions.”
    • The speed limit in any alley is 15 mph.
    • Business or Residential Districts: The speed limit is 25 mph, unless otherwise posted.
  • Stopping and safe distance
    • At 55mph, it takes about 400 feet to react and bring the vehicle to a complete stop, and at 35mph, it takes about 210 feet.
  • Pedestrians, bicyclists
    • Pedestrians, bicyclists, or other vehicles alongside you may experience sudden strong winds when passing or being passed. Slow down and pass safely, and pass only at a safe distance (typically 3 feet or more for bicyclists).
  • Blind Intersections
      The speed limit for a blind intersection is 15 mph. An intersection is considered “blind” if there are no stop signs at any corner and you cannot see for 100 feet in either direction during the last 100 feet before crossing.
  • Near animals
    • If you see a stray animal in your path, slow down or stop if it’s safe. Do not swerve as you may lose control of your vehicle and cause an accident.

Continue reading “Takeaways from the “California Driver Handbook 2017””

Batchography: Batch files and Unicode

Recently, I had to update my popular utility that resets NTFS files permission to support Unicode paths. I had to investigate how to add Unicode support in Batch scripts. It seems that this was a topic I forgot to add into my comprehensive Batch files programming book.

This article is the result of my investigation, in which I am going to show you how to add Unicode support to your Batch file scripts in 3 easy steps.

Continue reading “Batchography: Batch files and Unicode”

How many faces you see?

One of my readers (thank you very much) left a comment saying that the people in this picture represent the faces of Indian freedom fighter and politicians:

  • Mahatma Gandhi
  • Rabindranath Tagore
  • Bala Gangadhara Tilak
  • Bhagat Singh
  • Jawahara Lal Nehru
  • Lal Bhadur Shastri
  • Subhash Chandra Bose
  • Indira Gandhi
  • Rajiv Gandhi

You might also like:

The Iceberg Illusion of Success

I found this picture on the internet and I really loved it and as usual, I would like to use it as a launching pad for today’s article.

I still remember my self when I was young, between the ages of 14 to 23, I used to envy people of my age or slightly older who seemed to have achieved the success that I want for myself.

If I saw another guy with a fancy car, I would immediately justify that by telling myself that he must have rich parents.

If I see a smart guy from a good university, I would say to myself that his parents could afford to educate him in such a prestigious university and then I would say to myself: only if I had the means, then I would have been more successful.

If I saw a guy with a hot looking girl, I would say to myself: “He must have money because that’s why the girl is hanging out with him. I don’t have a car or the money to take her out and give her a nice time”.

Back then, I could not afford to buy all the material possessions that I wanted. I remember when my peers used to have a Game Boy or a Sega Mega drive. They used to come to school and play with those game consoles and it made me feel sad and unhappy because I don’t have one myself. Often times, I would think about my parents with a bit of childish resentment. I had the sense of entitlement because I was immature.

Back then, I could not afford to take vacations or travel wherever I wanted. I was living in a continuous state of perceived lack, holding my happiness hostage to external situations. For a big part of my childhood and adulthood, It felt that my self worth really depends on how others perceive me, how much I have, what car I have, what cloth I wear, what kind of a girl friend I had. Continue reading “The Iceberg Illusion of Success”