๐พ Archived View for anjune.lol โบ gmi โบ quab.gmi captured on 2023-12-28 at 15:22:09. Gemini links have been rewritten to link to archived content
โฌ ๏ธ Previous capture (2023-09-08)
-=-=-=-=-=-=-
Not a programmer, but I wrote a little helper script with the intention of decking my Gemini capsule out with Unicode art (โQuabโ stands for โquarter blocksโ, allowing crude graphics with 2x2 โpixelsโ per character). Was slightly proud of it for a little bit.
#!/usr/bin/env php <?php $ingrid = array(); $unich = array( "-- " => "โ", "| | " => "โ", " --" => "โ", " | |" => "โ", "+ + " => "โผ", "++ " => "โผ", " + +" => "โผ", " ++" => "โผ", "/-| " => "โ", "-\ |" => "โ", "| \-" => "โ", " |-/" => "โ", "| --" => "โด", "--| " => "โฌ", "-+ |" => "โค", "+-| " => "โ", "/-|r" => "โญ", "-\\r|" => "โฎ", "|r\-" => "โฐ", "r|-/" => "โฏ", ".. " => "โ", ". . " => "โ", " .." => "โ", " . ." => "โ", "----" => "โ", "||||" => "โ", "++++" => "โฌ", "/-||" => "โ", "-\||" => "โ", "||\-" => "โ", "||-/" => "โ", "||--" => "โฉ", "--||" => "โฆ", "-|-|" => "โฃ", "|-|-" => "โ ", "-- b" => "โ", "| |b" => "โ", " -b" => "โ", " | b" => "โ", "+++b" => "โ", "/-|b" => "โ", "-\ b" => "โ", "| \b" => "โ", " |-b" => "โ", "| -b" => "โป", "--|b" => "โณ", "-+ b" => "โซ", "+-|b" => "โฃ", ".. b" => "โ", ". .b" => "โ", "b .." => "โ", " .b." => "โ", "\//\\" => "โณ", "\ \\" => "โฒ", " // " => "โฑ", " " => " ", "# " => "โ", " # " => "โ", " # " => "โ", " #" => "โ", "## " => "โ", " ##" => "โ", "# # " => "โ", " # #" => "โ", "# #" => "โ", " ## " => "โ", "### " => "โ", "## #" => "โ", "# ##" => "โ", " ###" => "โ", "####" => "โ", "!!!!" => "โ", "::::" => "โ", "...." => "โ", " : :" => "๐ฎ", ": : " => "๐ฎ", ":: " => "๐ฎ", " ::" => "๐ฎ", ":// " => "๐ฎ", "\: \\" => "๐ฎ", " //:" => "๐ฎ", "\ :\\" => "๐ฎ", "#// " => "โค", "\# \\" => "โฅ", " //#" => "โข", "\ #\\" => "โฃ", "\//v" => "๐ฎ", "\//h" => "๐ฎ", "\ / " => "๐ญฌ", "\/ " => "๐ญญ", " / \\" => "๐ญฎ", " /\\" => "๐ญฏ" ); function trim_lines(&$line) { $line = trim($line, "\n"); } function pad_lines(&$line) { global $maxlen; $line = str_pad($line, $maxlen); } /******************************************************************************/ $infile = file($argv[1]); // get an array of the lines in our input file array_walk($infile, 'trim_lines'); // clean up newlines and tabs and whatnot if ( (count($infile)/2) != (int)(count($infile)/2) ) // uneven line count? $infile[] = ""; // then add an empty line // longest line a length not divisible by 4? if (($maxlen = max(array_map('strlen', $infile)))/4 != (int)($maxlen/4) ) $maxlen += 4 - ($maxlen % 4); // then adjust target length array_walk($infile, 'pad_lines'); // pad infile's strings to target length // massage $ingrid into an y,x grid of chars, each line space-padded to $maxlen while ($line = array_shift($infile)) { $linearray = str_split($line); if (count($linearray) < $maxlen) $linearray = array_pad($linearray, $maxlen, " "); $ingrid[] = $linearray; } for ($y=0; $y<count($ingrid); $y+=2) { for ($x=0; $x<$maxlen; $x+=2) { $searchkey = $ingrid[$y][$x] . $ingrid[$y][$x+1] . $ingrid[$y+1][$x] . $ingrid[$y+1][$x+1]; // print("[".$searchkey."]["); if (array_key_exists($searchkey, $unich)) print($unich[$searchkey]); else print($searchkey[0]); // print("]"); } print "\n"; } ?>
Example inputs:
\/\ / /\ \/ \ /\/ / / /\/ \/ /\/ / / /\ \ /\ \/\/\/\/\/\/\/ / / \/ \/\/\/\/\/\/\/\/ / \ \/\/\ \/\/\/\/\/\/\/\/\/\ / \ /\/\ \/\/\/\/\/\/\/\/\/\ \/ \/\ \/\/\/\/\/\/\/\/ \/\/\/\/\/\ \/ /\ \/\/\/\/\/\/\/\/\##/\/\/\/\/\ \/\ ## .................................................. # # ................ # # ...................... .................................................. # # ................ # # ...................... .... ### ### .... ###### .... ###### .... ###### .. # # ...... ###### .. # # .... #### .. ###### .... ....# ## #....# #....# #....# #.. # # ......# #.. # # .... # # ..# #.... .. #.. .. ..# #.. ## ..# #.. ## ..# #.. ## ..# #..# .... #.. ## ..# #..# .... #..# #.. ## ..# .. .. #..# .. #..# #..# #..# #..# #..# #..# #..# #..# .... #..# #..# #..# .... #..# #..# #..# .. .. #::# :: #::# #::# #::# #::# #::# #::# #::# #::# .... #### #::# #::# .... #::# #### #::# .. .. #::# :: #::# #::# #::# #::# #::# #::# #::# #::# .... #::# #::# .... #::# #::# .. .. #!!# ## #!!# #!!# #!!# #!!# #!!# #!!# #!!# #!!# ...... #####!!# #!!# .... #!!# .. #####!!# .. .. #!!# #!!# #!!# #!!# #!!# #!!# #!!# #!!# #!!# ......# !!# #!!# .... #!!# ..# !!# .. .. #::# .. #::# #::# #::# #::# #::# #::# #::# #::# ### #:: ###::# #::# ### #::# #:: ###::# .. .. #::# .. #::# #::# #::# #::# #::# #::# #::# #::# # # #::# #::# #::# # # #::# #::# #::# .. .. #..# .. #..# #..# #..# #..# #..# #..# #..# #..# # # #..# #..# #..# # # #..# #..# #..# .. .. #..# .. #..# #.. ## ..# #..# #..# #.. ## ..# #.. ## # #.. ###..# #.. ## # #..# #.. ###..# .. .. # # .. # # ..# #.. # # # # ..# #....# # ..# # ..# # # # ..# # .. .. ## .. ## .. ###### .. ## ## .. ###### .... ##### .. ####### .. ##### #### .. ####### .. .................................................................................................... .................................................................................................... \/\/\/ /\/\/ /\/\/\/\/\/\/\/\/ /\ \/\/\/\/\/\/\/\/\/\/ /\/\/\ / /\/\/ /\/\/\/\/\/\/\/\ / \/\/\/\/\/\/\/\/\/\/\ /\/\/ / /\/\/\/\/\/\/ \ \/\/ \ \ \ \/\/\/\/\/\/\ / /\/\ / / /\/\/\/\/\/\ \/\/\ \ \ \/\/\/\/\/\/\ \ \/ /\/\/\/\/\/\/\ /\/\ \/\/\/\/\/ /\ /\/ /\/\/\/\/\/\ \ / /\ \/\/\/\/\/\/ \ ## ## ##### #### ## #### ## ## ## #### ## #### ##### ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ###### ## ###### #### ## #### ## ## ## ## ## ## ## ## ## ## ## ## ## #### ## ##
Example outputs:
โณโฒโฑ โฒโฑโณโฑโฑโฑโณ โฒโฑโฒโณโณโณโณโณโณโณโฑโฑ โฒ โณโณโฒโณโณโณโณโณโณโณโณโณโฒโฑ โณโฒโณโณโณโณโณโณโณโณโโณโณโณโณโณโฒโณ โ โโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโ โโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โณโณโณ โฑโณโณโฑโณโณโณโณโณโณโณโณ โฑโฒโณโณโณโณโณโณโณโณโณโณ โฑโณโณ โฑโฑโณโณโณโณโณโณ โฒโณโณ โฒโฒโฒโณโณโณโณโณโณโฒ โณโฑโณโณโณโณโณโณโฒ โฑโณโฒโณโณโณโณโณโฑโฒ โ โโ โโโ โโโโ โโ โโโ โ โ โ โโโ โ โโโโ โโโโ โโ โโโโ โโ โโโ โโโ โโ โโโ โโ โโโโ โโโโ
Displays best if your terminal has its own line- and block-drawing characters rather than using the fontโs (Konsole and Kitty both do this admirably fwiw)โฆ