/* skibidi brainrot
Copyright © 2024 翠星石
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define SKIBIDI_PATH "/dev/skibidirandom"
const char *words[] = {"skibidi", "gyatt", "rizz", "only", "in", "ohio", "duke", "dennis", "did", "you", "pray", "today", "livvy", "dunne", "rizzing", "up", "baby", "gronk", "sussy", \
"imposter", "pibby", "glitch", "in", "real", "life", "sigma", "alpha", "omega", "male", "grindset", "andrew", "tate", "goon", "cave", "freddy", "fazbear", "colleen", "ballinger", "smurf", \
"vs", "strawberry", "elephant", "blud", "dawg", "shmlawg", "ishowspeed", "a", "whole", "bunch", "of", "turbulence", "ambatukam", "bro", "really", "thinks", "he's", "carti", "literally", \
"hitting", "the", "griddy", "the", "ocky", "way", "kai", "cenat", "fanum", "tax", "garten", "of", "banban", "no", "edging", "in", "class", "not", "the", "mosquito", "again", "bussing", \
"axel", "in", "harlem", "whopper", "whopper", "whopper", "whopper", "0", "1", "2", "buckle", "my", "shoe", "goofy", "ahh", "aiden", "ross", "sin", "city", "monday", "left", "me", "broken", \
"quirked", "up", "white", "boy", "busting", "it", "down", "sexual", "style", "goated", "with", "the", "sauce", "john", "pork", "grimace", "shake", "kiki", "do", "you", "love", "me", \
"huggy", "wuggy", "nathaniel", "b", "lightskin", "stare", "biggest", "bird", "omar", "the", "referee", "amogus", "uncanny", "wholesome", "reddit", "chungus", "keanu", "reeves", "pizza", \
"tower", "zesty", "poggers", "kumalala", "savesta", "quandale", "dingle", "glizzy", "rose", "toy", "ankha", "zone", "thug", "shaker", "morbin", "time", "dj", "khaled", "sisyphus", \
"oceangate", "shadow", "wizard", "money", "gang", "ayo", "the", "pizza", "here", "PLUH", "nair", "butthole", "waxing", "t-pose", "ugandan", "knuckles", "family", "guy", "funny", "cat", \
"moments", "compilation", "with", "subway", "surfers", "gameplay", "at", "the", "bottom", "nickeh30", "ratio", "uwu", "delulu", "opium", "bird", "cg5", "mewing", "fortnite", "battle",
"pass", "all", "my", "fellas", "gta", "6", "backrooms", "gigachad", "based", "cringe", "kino", "redpilled", "no", "nut", "november", "pokénut", "november", "foot", "fetish", "F", "in", \
"the", "chat", "i", "love", "lean", "looksmaxxing", "gassy", "social", "credit", "bing", "chilling", "xbox", "live", "mrbeast", "kid", "named", "finger", "better", "caul", "saul", "i", \
"am", "a", "surgeon", "hit", "or", "miss", "i", "guess", "they", "never", "miss", "huh", "i", "like", "ya", "cut", "g", "ice", "spice", "gooning", "fr", "we", "go", "gym", "kevin", \
"james", "josh", "hutcherson", "coffin", "of", "andy", "and", "leyley", "metal", "pipe", "falling", "nod"};
int skibidi_fifo;
void skibidi_handler(int signal) {
/* once software stops reading a fifo, the pipe will be torn down and the SIGPIPE signal will be sent - in response we just close and reopen the fifo */
if (signal == SIGPIPE)
{
close(skibidi_fifo);
skibidi_fifo = open(SKIBIDI_PATH, O_WRONLY);
if (skibidi_fifo < 0){perror(""); exit(EXIT_FAILURE);}
}
/* remove the fifo on C-c */
else if (signal == SIGINT){
unlink(SKIBIDI_PATH);
exit(EXIT_SUCCESS);
}
}
int main()
{
if (getuid() != 0){printf("Cannot open fifo special file under /dev without root.\n"); exit(EXIT_FAILURE);}
if (signal(SIGINT, skibidi_handler) == SIG_ERR){printf("Cannot catch SIGINT, C-c will not delete %s", SKIBIDI_PATH);}
if (signal(SIGPIPE, skibidi_handler) == SIG_ERR){printf("Cannot catch SIGPIPE, will exit on reader exit %s", SKIBIDI_PATH);}
/* read-only for everyone as root can open whatever it likes for writing */
int result = mkfifo(SKIBIDI_PATH, S_IRUSR|S_IRGRP|S_IROTH);
if (result == -1){perror(""); exit(EXIT_FAILURE);}
skibidi_fifo = open(SKIBIDI_PATH, O_WRONLY);
if (skibidi_fifo < 0){perror(""); exit(EXIT_FAILURE);}
/* maximum of 2 combined words */
int random[2];
int conn_fd;
/* deliver skibidi brainrot endlessly */
while (1)
{
/* 2 bytes for word range, as 280 > 256 */
uint16_t selection;
(void)getrandom(&selection, sizeof(selection), 0);
random[0] = (uint16_t)selection % sizeof(words)/sizeof(words[0]);
(void)getrandom(&selection, sizeof(selection), 0);
/* 0-3 and >0 is true, so 25% chance word is combined */
bool notcombined = (uint16_t)selection % 3;
/* reuse the same high-quality random number */
if (!notcombined){random[1] = (uint16_t)selection % sizeof(words)/sizeof(words[0]);}
/* dprintf will fail as pipe is torn down, so ignore failures */
if (notcombined)
{
dprintf(skibidi_fifo, "%s\n", words[random[0]]);
}
else
{
dprintf(skibidi_fifo, "%s-%s\n", words[random[0]], words[random[1]]);
}
}
return 0;
}