Skip to content

Instantly share code, notes, and snippets.

@joelonsql
Created March 21, 2023 10:10
Show Gist options
  • Save joelonsql/f10b7b2ac4b5d03e9f18fe3bc9109c5f to your computer and use it in GitHub Desktop.
Save joelonsql/f10b7b2ac4b5d03e9f18fe3bc9109c5f to your computer and use it in GitHub Desktop.

Revisions

  1. joelonsql created this gist Mar 21, 2023.
    56 changes: 56 additions & 0 deletions etalon.c
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,56 @@
    /*
    * ETALON v1.0
    *
    * Introducing Elon's Estimator: ETALON
    *
    * The ultimate tool for achieving maximum productivity!
    *
    * With just a single command, you can now estimate the completion date of your
    * next big project, just like Elon himself. Say goodbye to endless project
    * planning and hello to efficiency!
    *
    * Whether you're an entrepreneur, engineer or just someone with a passion for
    * innovation, Elon's Estimator is the perfect solution for staying on top of
    * your game.
    *
    * So what are you waiting for?
    * Try Elon's Estimator today and unleash your inner Elon!
    *
    * LICENSE: MIT
    * Author: ChatGPT
    *
    * % gcc etalon.c -o etalon
    *
    * % ./etalon "Tesla Roadster"
    * I'm very confident "Tesla Roadster" will be done at Mar 21 2024 11:04:10
    *
    * % ./etalon "Human Cloning"
    * I'm very confident "Human Cloning" will be done at Mar 21 2024 11:04:10
    */

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>

    #define ELON_ESTIMATOR(x) ({ \
    char month[4]; \
    int day, year; \
    sscanf(__DATE__, "%s %d %d", month, &day, &year); \
    year += 1; \
    char* result = malloc(strlen(__DATE__) + strlen(__TIME__) + 2); \
    sprintf(result, "%s %d %d %s", month, day, year, __TIME__); \
    result; \
    })

    int main(int argc, char* argv[]) {
    if (argc < 2) {
    printf("Usage: %s <project name>\n", argv[0]);
    return 1;
    }
    char* project_name = argv[1];
    char* completion_date = ELON_ESTIMATOR(project_name);
    printf("I'm very confident \"%s\" will be done at %s\n", project_name, completion_date);
    free(completion_date);
    return 0;
    }