logo

utils

Old programs, got split in utils-std and utils-extra git clone https://anongit.hacktivis.me/git/utils.git/

zalgo (718B)


  1. #!/usr/bin/perl
  2. # SPDX-FileCopyrightText: 2017-2022 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  3. # SPDX-License-Identifier: MPL-2.0
  4. use strict;
  5. use warnings;
  6. no warnings 'utf8'; # Wide Character warning
  7. my $level = 10;
  8. if($#ARGV == 0) {
  9. $level = int($ARGV[0]) or die;
  10. }
  11. my $file = '/usr/share/unicode-data/UnicodeData.txt';
  12. open my $fh , '<:encoding(UTF-8)', $file or die;
  13. my @combinings = ();
  14. while(my $line = <$fh>) {
  15. if($line =~ /;COMBINING/) {
  16. my @fields = split ";", $line;
  17. push(@combinings, hex($fields[0]));
  18. }
  19. }
  20. close $fh;
  21. my @input;
  22. {
  23. undef $/;
  24. @input = split "", <STDIN>;
  25. }
  26. foreach(@input) {
  27. print $_;
  28. foreach(1..$level) {
  29. print pack("U", $combinings[rand @combinings]);
  30. }
  31. }