Name: Anonymous 2012-10-07 19:34
SUPERBOLD
#!/usr/bin/perl -l40
use encoding utf8;
y/!-~/\x{ff01}-\x{ff5e}/ and print for @ARGV
kindabad () {
if [ -z "$1" ]
then
perl -M'encoding(utf8)' -p -e 'y/!-~/\x{ff01}-\x{ff5e}/'
else
echo $@ | perl -M'encoding(utf8)' -p -e 'y/!-~/\x{ff01}-\x{ff5e}/'
fi
}#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <math.h>
#include <time.h>
#include <stdlib.h>
const char a = "[]!@#$%^&*()1234567890-=abcdefghjklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
const char b = "[]!@#$%^&*()1234567890-=abcdefghjklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(void)
{
char * c = (char*) malloc(10000000 * sizeof(char)); // no one will type ten mibibytes
char * d = (char*) malloc(10000000 * sizeof(char)); // output
for(int i = 0; i < 10000000 * sizeof(char) - 1; i++) d[i] = c[i] = '\0';
printf("String:");
scanf("%s", &c);
int l = strlen(c);
int l2 = strlen(a);
int matched = 0;
for(int j = 0; j < l - 1; j++)
{
matched = 0;
for(int k = 0; k < l2 - 1; k++)
{
if(c[j] == a[k])
{
d[j] = b[k];
matched = 1;
break; // we are done here :)
}
}
if(matched == 0) // we didn't match anything :(
{
d[j] = c[j];
continue;
}
}
printf("\a\a\a\a\nDone!\n\n%s%d\r%s",c,sleep(5),d); // show the original, sleep a bit, then use \r to overright the the first with the output
}
printf("\a\a\a\a\nDone!\n\n%s%d\r%s",c,sleep(5),d);const char a = "[]!@#$%^&*()1234567890-=abcdefghjklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";i < 10000000 * sizeof(char) - 1; i++) d[i] = c[i] = '\0';
scanf over simple getchar or ... wait, why aren't you just using constant offsets what the fuck are you doing.
#include <locale.h>
#include <stdio.h>
int main(void)
{
int c;
if (setlocale(LC_ALL, "") == NULL)
return -1;
while (EOF != (c = getchar())) {
if (c <= '~' && c >= '`')
printf("%c%c%c", -17, -67, (-128 + (c - '`')));
else if (c < '`' && c >= '!')
printf("%c%c%c", -17, -68, (-128 + (c - ' ')));
else
printf("%c", c);
}
}[b]HAX MY Un1[0d3 MY ANUS[/b]
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <ctype.h>
// transform an integer (up to 16 bits) to a 3 byte utf-8 block and print it
// 1110xxxx 10xxxxxx 10xxxxxx
void printtchar(uint32_t u) {
putchar(u >> 12 & 0x0F | 0xE0);
putchar(u >> 6 & 0x3F | 0x80);
putchar(u & 0x3F | 0x80);
}
// transform an integer (up to 21 bits) to a 4 byte utf-8 block and print it
// 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
void printqchar(uint32_t u) {
putchar(u >> 18 & 0x07 | 0xF0);
putchar(u >> 12 & 0x3F | 0x80);
putchar(u >> 6 & 0x3F | 0x80);
putchar(u & 0x3F | 0x80);
}
// transform a string to a special area (1D400..1D7FF) string and print it
void transformq(const char *s, uint32_t u) {
size_t i;
if(s == NULL)
return;
for(i = 0; s[i] != '\0'; i++) {
if(isupper(s[i]))
printqchar(s[i] - 'A' + u);
else if(islower(s[i]))
printqchar(s[i] - 'a' + u + 26);
else
putchar(s[i]);
}
}
// transform a string to a superbold string and print it
void superbold(const char *s) {
size_t i;
if(s == NULL)
return;
for(i = 0; s[i] != '\0'; i++) {
if(s[i] >= '!' && s[i] <= '~')
printtchar(s[i] - '!' + 0xFF01);
else
putchar(s[i]);
}
}
int main(int argc, char *argv[]) {
// not enough args
if(argc < 2) {
printf("Usage: superfont text [font]\n"
" font options:\n"
" -f for fraktur\n"
" -h for helvetica style\n"
" -H for helvetica bold style\n"
" -i for italic\n"
" -m for monospace\n"
" defaults to superbold\n");
return 0;
}
// 2+ args -> try to get option in third arg
else if(argc > 2) {
if(!strcmp("-f", argv[2]))
transformq(argv[1], 0x1D56C);
else if(!strcmp("-h", argv[2]))
transformq(argv[1], 0x1D5A0);
else if(!strcmp("-H", argv[2]))
transformq(argv[1], 0x1D5D4);
else if(!strcmp("-i", argv[2]))
transformq(argv[1], 0x1D4D0);
else if(!strcmp("-m", argv[2]))
transformq(argv[1], 0x1D670);
else
superbold(argv[1]);
}
// 2 args -> superbold
else {
superbold(argv[1]);
}
return 0;
}
main().