Skip to content

Instantly share code, notes, and snippets.

@stjordanis
Forked from neoeno/sad.c
Created November 6, 2024 23:10
Show Gist options
  • Save stjordanis/3a6f0cd47e041b770128fcab6087cd05 to your computer and use it in GitHub Desktop.
Save stjordanis/3a6f0cd47e041b770128fcab6087cd05 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
const char* RESET = "\x1B[0m";
const char *COLORS[] = { "\x1B[31m", "\x1B[32m", "\x1B[33m", "\x1B[34m", "\x1B[35m", "\x1B[36m" };
int main() {
srand(time(NULL));
for(;;) {
int colorIdx = rand() % 6;
printf("%s:(%s", COLORS[colorIdx], RESET);
int spacing = rand() % 10;
for(int i = 0; i < spacing; i++) {
printf(" ");
}
fflush(stdout);
usleep(5000);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment