senooken JP Social
  • FAQ
  • Login
senooken JP Socialはsenookenの専用分散SNSです。
  • Public

    • Public
    • Network
    • Groups
    • Popular
    • People

Conversation

Notices

  1. Eugen (gargron@mastodon.social)'s status on Friday, 28-Jan-2022 11:47:29 JST Eugen Eugen
    in reply to
    • zunda

    @zundan Cat shuffle ????

    In conversation Friday, 28-Jan-2022 11:47:29 JST from mastodon.social permalink
    • zunda (zundan@mastodon.zunda.ninja)'s status on Friday, 28-Jan-2022 11:47:51 JST zunda zunda

      $ cat shuffle.c #include <stdlib.h>#include <stdio.h>#include <ctype.h>#include <time.h>

      #define utf8_head(c) (((c) & 0xC0) != 0x80)

      intmain(void){ char input[BUFSIZ], *runes[BUFSIZ]; char output[BUFSIZ]; size_t len, i, j; char *ptr;

      fgets(input, sizeof(input), stdin); fclose(stdin);

      ptr = input; while(*ptr) { if (utf8_head(*ptr) && *ptr != '\n') { runes[len] = ptr; len++; } ptr++; }

      srand((unsigned)time(NULL)); for(i = 0; i < len - 1; i++) { j = i + rand() % (len - i); ptr = runes[j]; runes[j] = runes[i]; runes[i] = ptr; }

      ptr = output; for(i = 0, ptr = output; i < len; i++) { j = 0; do { *ptr = *(runes[i] + j); j++; ptr++; } while(!utf8_head(*(runes[i] + j))); } *ptr = '\n'; *(ptr + 1) = '\0';

      fputs(output, stdout); return EXIT_SUCCESS;}$ gcc -Wall shuffle.c && echo ねむいね | ./a.outいむねね

      むっちゃ長くなったw

      In conversation Friday, 28-Jan-2022 11:47:51 JST permalink
      もちゃ(あと-4.00Kg) repeated this.

Feeds

  • Activity Streams
  • RSS 2.0
  • Atom
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

senooken JP Social is a social network, courtesy of senooken. It runs on GNU social, version 2.0.2-beta0, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All senooken JP Social content and data are available under the Creative Commons Attribution 3.0 license.