<commit_before>/*
 * minimOS palette generator
 * (c) 2019 <NAME>
 */

#include <stdio.h>

int bin(int d7, int d6, int d5, int d4, int d3, int d2, int d1, int d0) {
	return d7<<7|d6<<6|d5<<5|d4<<4|d3<<3|d2<<2|d1<<1|d0;
}

int main(void) {
	int r0, r1, r2, g0, g1, g2, b0, b1;
	int R, G, B;
	char tr, tg, tb;
	FILE* f;

/* open output file and abort if error */
	f=fopen("256col.html","w");
	if (f==NULL) {
		printf("No file!\n");
		return 1;
	}
/* create awful HTML header */
	fprintf(f,"<html>\n\t<head>\n\t\t");
	fprintf(f,"<title>minimOS palette</title>");
	fprintf(f,"\n\t\</head>\n\t<body>\n");
	fprintf(f,"\t\t<table border='0'>\n");
/* non-indented code follows... do not attempt this at home, kids! */
/* high nibble */
	for (r1=0; r1<2; r1++) {
	for (g0=0; g0<2; g0++) {
	for (r0=0; r0<2; r0++) {
	for (b0=0; b0<2; b0++) {
/* low nibble, switch row here */
		fprintf(f,"<tr>");
		for (g2=0; g2<2; g2++) {
		for (r2=0; r2<2; r2++) {
		for (g1=0; g1<2; g1++) {
		for (b1=0; b1<2; b1++) {
//			fprintf(f,"<td>%d%d%d%d%d%d%d%d</td>",r1,g0,r0,b0,g2,r2,g1,b1);
//			fprintf(f,"<td>%d</td>",bin(r1,g0,r0,b0,g2,r2,g1,b1));

			R=bin(r2,r1,r0,r2,r2,r2,r2,r2);
			G=bin(g2,g1,g0,g2,g2,g2,g2,g2);
			B=bin(b1,b0,b1,b0,b1,b0,b1,b0);

			tr=48+bin(0,0,0,0,0,r2,r1,r0);
			tg=48+bin(0,0,0,0,0,g2,g1,g0);
			tb=48+bin(0,0,0,0,0,0,b1,b0);

			if(tg>'3') {
				fprintf(f,"<td style='color:black;background-color:rgb(%d,%d,%d);'>%c%c%c</td>",R,G,B,tr,tg,tb);
			} else {
				fprintf(f,"<td style='color:white;background-color:rgb(%d,%d,%d);'>%c%c%c</td>",R,G,B,tr,tg,tb);
			}
		}}}}
		fprintf(f,"</tr>\n");
	}}}}
/* complete HTML table */
	fprintf(f,"</table></body></html>");
	fclose(f);

	return 0;
}
<commit_msg>improved palette HTML code<commit_after>/*
 * minimOS palette generator
 * (c) 2019 <NAME>
 */

#include <stdio.h>

int bin(int d7, int d6, int d5, int d4, int d3, int d2, int d1, int d0) {
	return d7<<7|d6<<6|d5<<5|d4<<4|d3<<3|d2<<2|d1<<1|d0;
}

int main(void) {
	int r0, r1, r2, g0, g1, g2, b0, b1;
	int R, G, B;
	char tr, tg, tb;
	FILE* f;

/* open output file and abort if error */
	f=fopen("256col.html","w");
	if (f==NULL) {
		printf("No file!\n");
		return 1;
	}
/* create basic HTML header */
	fprintf(f,"<html>\n\t<head>\n");
	fprintf(f,"\t\t<title>minimOS palette</title>\n");
	fprintf(f,"\t\</head>\n\t<body>\n");
	fprintf(f,"\t\t<table border='0'>\n");
/* high nibble */
	for (r1=0; r1<2; r1++) {
		for (g0=0; g0<2; g0++) {
			for (r0=0; r0<2; r0++) {
				for (b0=0; b0<2; b0++) {
/* low nibble, switch row here */
					fprintf(f,"\t\t\t<tr>\n");
					for (g2=0; g2<2; g2++) {
						for (r2=0; r2<2; r2++) {
							for (g1=0; g1<2; g1++) {
								for (b1=0; b1<2; b1++) {
/* compute colour values and labels */
									R=bin(r2,r1,r0,r2,r1,r0,r2,r1);
									G=bin(g2,g1,g0,g2,g1,g0,g2,g1);
									B=bin(b1,b0,b1,b0,b1,b0,b1,b0);

									tr=48+bin(0,0,0,0,0,r2,r1,r0);
									tg=48+bin(0,0,0,0,0,g2,g1,g0);
									tb=48+bin(0,0,0,0,0,0,b1,b0);
/* generate table cells */
									fprintf(f,"\t\t\t\t");
									if(tg>'3') {
										fprintf(f,"<td style='color:black;background-color:rgb(%d,%d,%d);'>%c%c%c</td>\n",R,G,B,tr,tg,tb);
									} else {
										fprintf(f,"<td style='color:white;background-color:rgb(%d,%d,%d);'>%c%c%c</td>\n",R,G,B,tr,tg,tb);
									}
								}
							}
						}
					}
					fprintf(f,"\t\t\t</tr>\n");
				}
			}
		}
	}
/* complete HTML table */
	fprintf(f,"\t\t</table>\n\t</body>\n</html>");
	fclose(f);

	return 0;
}

{'fraction_non_alphanumeric': 0.27788930312589616, 'fraction_numerical': 0.08259248637797534, 'mean_word_length': 3.398486759142497, 'pattern_counts': {'":': 0, '<': 87, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2587830', 'n_tokens_mistral': 2076, 'n_tokens_neox': 1850, 'n_words': 290}