Skip to content

Instantly share code, notes, and snippets.

@hron84
Forked from neoeno/sad.c
Last active July 31, 2018 10:00
Show Gist options
  • Save hron84/788ea318b1564ef8e94f9e7bb47a808d to your computer and use it in GitHub Desktop.
Save hron84/788ea318b1564ef8e94f9e7bb47a808d 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);
}
}
#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