How can I create large ASCII text from a string? - html

Given a string, for example 'imgur', how can I generate large ASCII text like the following? Thanks.
_
(_)
_ _ __ ___ __ _ _ _ _ __
| | '_ ` _ \ / _` | | | | '__|
| | | | | | | (_| | |_| | |
|_|_| |_| |_|\__, |\__,_|_|
__/ |
|___/

You can use ASCII text generator like FIGlet which uses FIGlet fonts. TOIlet is like FIGlet and can use FIGlet fonts but as additional capabilities including Unicode handling, colour fonts, filters and various export formats. Specific logos may need to be created as their own font.
Here are some links:
FIGlet: http://www.figlet.org/
TOIlet: https://apps.ubuntu.com/cat/applications/toilet/
FIGlet fonts: http://www.figlet.org/fontdb.cgi
FIGlet web demo: http://www.kammerl.de/ascii/AsciiSignature.php

Related

U-Boot with OpenSBI on HiFive Unleashed in QEMU: Store/AMO access fault

I've been trying to get U-Boot to work in QEMU for the sifive_u machine. I've tried using both the built in OpenSBI 'BIOS' and building my own OpenSBI, but I keep running into the same issue.
I'm building U-Boot using the riscv64 toolchain from the Arch repos:
➜ u-boot git:(0b0c6af387) riscv64-linux-gnu-gcc --version
riscv64-linux-gnu-gcc (GCC) 9.2.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
➜ u-boot git:(0b0c6af387) export CROSS_COMPILE=riscv64-linux-gnu-
➜ u-boot git:(0b0c6af387) export ARCH=riscv
➜ u-boot git:(0b0c6af387) make sifive_fu540_defconfig
...
➜ u-boot git:(0b0c6af387) make
I've tried to run this as follows:
➜ opensbi git:(master) ✗ qemu-system-riscv64 -M sifive_u -m 256M -bios default -display none -serial stdio -device loader,addr=0x80200000,file=../u-boot/u-boot.bin
OpenSBI v0.5 (Oct 9 2019 12:03:04)
____ _____ ____ _____
/ __ \ / ____| _ \_ _|
| | | |_ __ ___ _ __ | (___ | |_) || |
| | | | '_ \ / _ \ '_ \ \___ \| _ < | |
| |__| | |_) | __/ | | |____) | |_) || |_
\____/| .__/ \___|_| |_|_____/|____/_____|
| |
|_|
Platform Name : SiFive Freedom U540
Platform HART Features : RV64ACDFIMSU
Platform Max HARTs : 5
Current Hart : 1
Firmware Base : 0x80000000
Firmware Size : 96 KB
Runtime SBI Version : 0.2
PMP0: 0x0000000080000000-0x000000008001ffff (A)
PMP1: 0x0000000000000000-0xffffffffffffffff (A,R,W,X)
U-Boot 2020.01 (Jan 20 2020 - 18:14:27 +0000)
CPU: rv64imafdc
Model: SiFive HiFive Unleashed A00
DRAM: exception code: 7 , Store/AMO access fault , epc 8023cbdc , ra 8020c670
### ERROR ### Please RESET the board ###
I've also tried bundling U-Boot as a payload into my own build of OpenSBI:
➜ opensbi git:(master) ✗ export CROSS_COMPILE=riscv64-unknown-elf-
➜ opensbi git:(master) ✗ make PLATFORM=sifive/fu540 FW_PAYLOAD_PATH=../u-boot/u-boot.bin
➜ opensbi git:(master) ✗ qemu-system-riscv64 -M sifive_u -m 256M -bios none -display none -serial stdio -device loader,addr=0x80000000,file=./build/platform/sifive/fu540/firmware/fw_payload.bin
OpenSBI v0.5-32-gc0849cd
____ _____ ____ _____
/ __ \ / ____| _ \_ _|
| | | |_ __ ___ _ __ | (___ | |_) || |
| | | | '_ \ / _ \ '_ \ \___ \| _ < | |
| |__| | |_) | __/ | | |____) | |_) || |_
\____/| .__/ \___|_| |_|_____/|____/_____|
| |
|_|
Platform Name : SiFive Freedom U540
Platform HART Features : RV64ACDFIMSU
Platform Max HARTs : 5
Current Hart : 1
Firmware Base : 0x80000000
Firmware Size : 100 KB
Runtime SBI Version : 0.2
PMP0: 0x0000000080000000-0x000000008001ffff (A)
PMP1: 0x0000000000000000-0xffffffffffffffff (A,R,W,X)
U-Boot 2020.01 (Jan 20 2020 - 18:14:27 +0000)
CPU: rv64imafdc
Model: SiFive HiFive Unleashed A00
DRAM: exception code: 7 , Store/AMO access fault , epc 8023cbdc , ra 8020c670
### ERROR ### Please RESET the board ###
I've tried looking at the offending instruction (which I presume is at 0x8023cbdc) based on the error message:
➜ u-boot git:(0b0c6af387) riscv64-unknown-elf-objdump --start-address=0x8023cbdc -d ./u-boot | head -8
./u-boot: file format elf64-littleriscv
Disassembly of section .text_rest:
000000008023cbdc <memset+0x40>:
8023cbdc: fee7bc23 sd a4,-8(a5)
It's a store, so it's plausible that this is indeed accessing an invalid location; I'm trying to get GDB working so I can examine what's actually happening in more detail, but that's causing issues of its own...
Has anyone had any success with this?
UPDATE
I've managed to fix this specific error by changing the amount of memory with -M 2G; I presume the address it's trying to access lies outside the 256M range, but I'm not sure what it's doing that requires this much RAM.
Now I'm getting the following error:
➜ opensbi git:(master) ✗ qemu-system-riscv64 -M sifive_u -m 8G -bios default -display none -serial stdio -device loader,addr=0x80200000,file=../u-boot/u-boot-dtb.bin
OpenSBI v0.5 (Oct 9 2019 12:03:04)
____ _____ ____ _____
/ __ \ / ____| _ \_ _|
| | | |_ __ ___ _ __ | (___ | |_) || |
| | | | '_ \ / _ \ '_ \ \___ \| _ < | |
| |__| | |_) | __/ | | |____) | |_) || |_
\____/| .__/ \___|_| |_|_____/|____/_____|
| |
|_|
Platform Name : SiFive Freedom U540
Platform HART Features : RV64ACDFIMSU
Platform Max HARTs : 5
Current Hart : 1
Firmware Base : 0x80000000
Firmware Size : 96 KB
Runtime SBI Version : 0.2
PMP0: 0x0000000080000000-0x000000008001ffff (A)
PMP1: 0x0000000000000000-0xffffffffffffffff (A,R,W,X)
U-Boot 2020.01 (Jan 20 2020 - 21:40:02 +0000)
CPU: rv64imafdc
Model: SiFive HiFive Unleashed A00
DRAM: 8 GiB
MMC: exception code: 5 , Load access fault , epc fffadbd6 , ra fffadbd2
### ERROR ### Please RESET the board ###
qemu-system-riscv64: terminating on signal 2
Again it's similar (although a load this time); interestingly, the address fffadbd6 isn't part of U-Boot so I've no idea what's happening here; I very much doubt it's running off the end, because then I would expect undefined behaviour as opposed to consistently getting the same bad load.

is there a way to choose the width of a pdf created from a txt file with cupsfilter

i try to find a command line to convert files .txt to .pdf using a tool that most computer running on mac and linux have, like (i think) cupsfilter. but I can't seem to control the width of the output
I don't understand how cupsfilter choose the format it chould print, like how much characters define the width in the text file, it seems to be 80. But the output of 80 characters width on a A4 size page looks absurdely huge..
if my text looks like this :
|_| |_| | || |_ | | / . \ | |
_ _ _ _ _ _ _ _ _ _ _ _ _| || _|| |_ \ / | | |
/_ _ || |\_ _ \| ._ _| \ \ / /| || ( ] || | | _ \ / . \ | | |
/_ _ /|_|\_ _ \ \ _ _| \_/\_/ |_| \ _ _||_| |_| |_| \_ _/ |_ _|
the command cupsfilter file.txt > file.pdf will give me the same look, but in huge, in pdf format
however, if my text is longer it will look like this :
_ _ _ _
|_| |_| | || |_ | |
/ . \ | |
_ _ _ _ _ _ _ _ _ _ _ _ _| || _|| |_
\ / | | |
/_ _ || |\_ _ \| ._ _| \ \ / /| || ( ] || | | _ \
/ . \ | | |
/_ _ /|_|\_ _ \ \ _ _| \_/\_/ |_| \ _ _||_| |_| |_|
\_ _/ |_ _|
I would tel cupsfilter to consider a page width to be more than 80 characters long, or to use another tool to do that ?

Change color of diffrent sections of pre

I am trying to make some ASCII art different colors in different sections.
Example the color of the ghosts and the text be different:
<pre>
.-') _ ('-. .-') .-') _
( OO) ) _( OO) ( OO ). ( OO) )
/ '._(,------.(_)---\_)/ '._
|'--...__)| .---'/ _ | |'--...__)
'--. .--'| | \ :` `. '--. .--'
| | (| '--. '..`''.) | |
| | | .--' .-._) \ | |
| | | `---.\ / | |
`--' `------' `-----' `--'
</pre>
Umm.. Since the ghosts' and texts' heights were unequal, that's really hard(merely impossible) to do.
But here's a (semi)solution that's close to your requirements.
Use the combination of linear-gradient and background-clip properties.
Try this
pre{background: -webkit-linear-gradient(blue 44px, red 10%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;}
<pre>
.-') _ ('-. .-') .-') _
( OO) ) _( OO) ( OO ). ( OO) )
/ '._(,------.(_)---\_)/ '._
|'--...__)| .---'/ _ | |'--...__)
'--. .--'| | \ :` `. '--. .--'
| | (| '--. '..`''.) | |
| | | .--' .-._) \ | |
| | | `---.\ / | |
`--' `------' `-----' `--'
</pre>
A codepen: https://codepen.io/Ev1tw1n/pen/NEoxRe
You can consider multiple background and you will be able to easily adjust color of each part of the pre element. You may also consider the em unit so that it will work with any value of font-size:
pre {
background:
linear-gradient(blue, blue) 0 0/5em 5em,
linear-gradient(red, red) 0 100%/5em calc(100% - 5em),
linear-gradient(green, green) 5em 0/10em 3em,
linear-gradient(orange, orange) 5em 100%/10em calc(100% - 3em),
linear-gradient(purple, purple) 15em 0/5em 5em,
linear-gradient(#22eeff, #22eeff) 15em 100%/10em calc(100% - 5em);
background-repeat:no-repeat;
-webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent;
color: transparent;
}
<pre>
.-') _ ('-. .-') .-') _
( OO) ) _( OO) ( OO ). ( OO) )
/ '._(,------.(_)---\_)/ '._
|'--...__)| .---'/ _ | |'--...__)
'--. .--'| | \ :` `. '--. .--'
| | (| '--. '..`''.) | |
| | | .--' .-._) \ | |
| | | `---.\ / | |
`--' `------' `-----' `--'
</pre>
<pre style="font-size:20px">
.-') _ ('-. .-') .-') _
( OO) ) _( OO) ( OO ). ( OO) )
/ '._(,------.(_)---\_)/ '._
|'--...__)| .---'/ _ | |'--...__)
'--. .--'| | \ :` `. '--. .--'
| | (| '--. '..`''.) | |
| | | .--' .-._) \ | |
| | | `---.\ / | |
`--' `------' `-----' `--'
</pre>

How to create big style comment for HTML templates

If you look at the source code of some HTML sites, they use some giant alphabets to comment out or to provide their site name. Something where you write the word and it converts to to HTML like below:
<!--
------
-
---
-
------
!-->
anyone know how to create these types of comments?
Just Google "Big ASCII text art" and you'll find several online generators.
For example, here's one from bigtext.org:
_ _
/ \ __| | __ _ _ __ ___
/ _ \ / _` |/ _` | '_ ` _ \
/ ___ \ (_| | (_| | | | | | |
/_/ \_\__,_|\__,_|_| |_| |_|
Here's another website that lets you customize the font and a few other things. Example (using the font 'tinker-toy'):
O o
/ \ |
o---o o-O oo o-O-o
| || | | | | | |
o o o-o o-o-o o o

Is the at-sign (#) a valid HTML/XML tag character?

I'm doing some HTML stripping using regular expressions (yes, I know, never parse HTML with regexes, but I'm just stripping it, and I also unfortunately cannot use any external libraries). I'm using a regex from the Regular Expressions Cookbook, and it has worked great, except I just ran into this problem:
In the string Bob Saget <bobs#aol.com>, my regex is matching the email as a tag.
So my question is, is the # sign a valid XML or HTML tag character? (I'm not asking whether or not it is valid within an attribute; I know that it is) If it is not, I will be able to successfully exclude it in my regex.
I'm not sure where to look this up. I looked here and I think that says that in XML, the at-sign is not allowed in a tag; however, I would appreciate some concrete proof.
After another look at the XML Specification:
A tag consists of:
'<' Name (S Attribute)* S? '>'
A Name consists of:
NameStartChar (NameChar)*
A NameStartChar consists of:
":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
A NameChar consists of:
NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
The # sign is U+0040
So the # sign is not valid in a NameChar or a NameStartChar, and thus not valid in a Name.