Generate English words using special characters in the comments - comments

I want to generate a English word with pure characters like |, /, \, (, ) etc. in my code comments.
For example,
_
(_)
__ __ __ _ ___ ___ _
\ \ / / / _` | / __| / __| | |
\ V / | (_| | | (__ | (__ | |
\_/ \__,_| \___| \___| |_|
I wonder if there is a tool that automatically does the job? I don't know how to properly google it.

This tool might be helpful: https://patorjk.com/software/taag/#p=display&h=1&v=1&f=Big&t=vaccine
You can choose your favorite font, character width/height, and copy the wonderful ASCII art to your clipboard.

Related

How can I create superuser in EC2 after contact using SSH(There is no app folder in EC2 instance)

I connect to my EC2 instance and I use Django and deploy with elasticbeanstalk.
I'd like to check how many Users in my service...but There is no app folder in EC2 instance and don't know how to make superuser like using console
python manage.py createsuperuser
Is there any solution to check my users?(except make admin page or container_commands <- I already tried but it doesn't work. so I'd like to try the other way.)
Warning: Permanently added '15.164.165.224' (ECDSA) to the list of known hosts.
_____ _ _ _ ____ _ _ _
| ____| | __ _ ___| |_(_) ___| __ ) ___ __ _ _ __ ___| |_ __ _| | | __
| _| | |/ _` / __| __| |/ __| _ \ / _ \/ _` | '_ \/ __| __/ _` | | |/ /
| |___| | (_| \__ \ |_| | (__| |_) | __/ (_| | | | \__ \ || (_| | | <
|_____|_|\__,_|___/\__|_|\___|____/ \___|\__,_|_| |_|___/\__\__,_|_|_|\_\
Amazon Linux AMI
This EC2 instance is managed by AWS Elastic Beanstalk. Changes made via SSH
How to run manage.py from AWS Elastic Beanstalk AMI.
SSH login to Linux
(optional may need to run sudo su - to have proper permissions)
source /opt/python/run/venv/bin/activate
source /opt/python/current/env
cd /opt/python/current/app
python manage.py <commands>
Or, you can run command as like the below:
cd /opt/python/current/app
/opt/python/run/venv/bin/python manage.py <command>
I have referenced the article below.
Run manage.py from AWS EB Linux instance

(Shell Script) Set value of numbers from current time

(Shell Script) Set value of numbers from current time
Im trying to make a shell script to take the output from the current time (HH:MM) and assign a variable (font) to each number 0-9. This essentially is a clock, which I need to run in realtime (changes when the time changes). for example if I run this command:
date +"%T"
I will get an output (results may vary):
12:30:27
How can I make it so instead it will output this (without the "seconds")
_ ____ _____ ___
/ |___ \ _ |___ / / _ \
| | __) | (_) |_ \| | | |
| |/ __/ _ ___) | |_| |
|_|_____| (_) |____/ \___/
The only way I can think of achieving this is by assigning the numbers individually with the font being used. The link to the font i am using is:
http://patorjk.com/software/taag/#p=display&f=Standard&t=12%20%3A%2030
Is there anyway I can output the time (in realtime) using numbers like this?
To show a realtime ASCII art clock, use
watch 'date "+%H:%M" | figlet'
to save the current time in a variable, use
myVariable="$(date "+%H:%M" | figlet)"
As long as your cursor is not at the bottom of the screen, and you are in a terminal emulator that supports these cursor motions:
#!/bin/sh
f() { echo -n "\\033[$1D\\033[1B"; }
_c=" _$(f 2)(_)$(f 2)_$(f 2)(_)$(f 1) "
_0=" ___$(f 4)/ _ \\ $(f 7)| | | |$(f 7)| |_| |$(f 6)\\___/ "
_1=" _$(f 2)/ |$(f 3)| |$(f 3)| |$(f 3)|_| "
_2=" ____$(f 5)|___ \\ $(f 5)__) | $(f 7)/ __/ $(f 8)|_____| "
_3=" _____$(f 6)|___ / $(f 7) |_ \\ $(f 7) ___) | $(f 9)|____/ "
_4=" _ _ $(f 10) | || | $(f 10) | || |_ $(f 10) |__ _| $(f 7) |_| "
_5=" ____ $(f 9) | ___| $(f 9) |___ \ $(f 9) ___) | $(f 9) |____/ "
_6=" __ $(f 9) / /_ $(f 9)| '_ \ $(f 9)| (_) | $(f 9) \___/ "
_7=" _____ $(f 9) |___ | $(f 9) / / $(f 9) / / $(f 9) /_/ "
_8=" ___ $(f 9) ( _ ) $(f 9) / _ \ $(f 9)| (_) |$(f 9) \___/ "
_9=" ___ $(f 9) / _ \ $(f 9) | (_) |$(f 9) \__, |$(f 7) /_/ "
eval echo -e '"'$(date +"%T" | tr : c | cut -b 1-5 | sed 's/./${_&}\\033[4A/g')'"'
echo -e "\\033[5B"
Try this:
Host#User> date +"%H:%M"
09:47
Host#User>

Echo in Bash: Escape Apostrophes?

I'm trying to use echo in bash inside of quotes.
When I try from a command line, it works fine.
For example: echo "I'm testing the apostrophe functionality."
yields I'm testing the apostrophe functionality.
Yet, when I write this in a script, it doesn't seem to work.
Here's a snippet of my code: (I'm trying to integrate ASCII art into my program)
if [ "$2" == "-s" ]
then echo " ___ __ _ _ "
echo " / _ \__ _ _ __ ___ ___ / _\ |_ __ _ _ __| |_ ___ _ __ "
echo " / /_\/ _` | '_ ` _ \ / _ \_____\ \| __/ _` | '__| __/ _ \ '__|"
echo "/ /_\\ (_| | | | | | | __/_____|\ \ || (_| | | | || __/ | "
echo "\____/\__,_|_| |_| |_|\___| \__/\__\__,_|_| \__\___|_| "
echo ""
echo "Hello! My name is Siri."
echo "I'm not actually the Siri you're probably used to."
echo "I'm actually Apple's Siri's sister, the no-voice one."
echo "Sorry, but I'm in development right now."
echo "Come back later and maybe Eric will bring me out of beta."
echo "Thanks for reading this long debug message!"
fi
I've checked and double-checked all my quotes...
Yet it still yields:
./game-starter.sh: line 7: unexpected EOF while looking for matching ``'
./game-starter.sh: line 88: syntax error: unexpected end of file
Please help soon!
-HewwoCraziness
As you're using double quotes around your strings, certain characters are interpreted by the shell. One example is the backtick, as mentioned in Ryan's answer.
One option would be to use single quotes around your strings, although then you would have to escape the apostrophes in your message. I think that the best solution would be to use a heredoc instead:
cat <<'EOF'
___ __ _ _
/ _ \__ _ _ __ ___ ___ / _\ |_ __ _ _ __| |_ ___ _ __
/ /_\/ _` | '_ ` _ \ / _ \_____\ \| __/ _` | '__| __/ _ \ '__|
/ /_\\ (_| | | | | | | __/_____|\ \ || (_| | | | || __/ |
\____/\__,_|_| |_| |_|\___| \__/\__\__,_|_| \__\___|_|
Hello! My name is Siri.
I'm not actually the Siri you're probably used to.
I'm actually Apple's Siri's sister, the no-voice one.
Sorry, but I'm in development right now.
Come back later and maybe Eric will bring me out of beta.
Thanks for reading this long debug message!
EOF
The quotes around the EOF mean that the string is interpreted literally, so characters such as | don't cause problems.
I don't think it's the apostrophes that are causing your issue; is it the ` character (you know, on the ~ key). It is used for running commands in place and other things, and is probably what's causing the issue, if I had to guess based on that error message.

Trouble making ascii art in .bashrc file

I get these errors when trying to use: export PS1='ascii text at bottom'.
bash: command substitution: line 1: syntax error near unexpected token |'
bash: command substitution: line 1:/ ^ \ | |_) |'
bash: command substitution: line 3: syntax error near unexpected token |'
bash: command substitution: line 3: \ /\ / / _____ \ | |\ ---) |'
Could someone explain why this doesn't work?
________________. ___ .______
/ | / \ | _ \
| (-----| |----`/ ^ \ | |_) |
\ \ | | / /_\ \ | /
.------) | | | / _____ \ | |\ \-------.
|_________/ |__| /__/ \__\| _| `.________|
____ __ ____ ___ .______ ________.
\ \ / \ / / / \ | _ \ / |
\ \/ \/ / / ^ \ | |_) || (-----`
\ / / /_\ \ | / \ \
\ /\ / / _____ \ | |\ \---) |
\__/ \__/ /__/ \__\|__| `._______/
PS1 is not just a plain string; in it, certain characters have meaning to them. You can find a surprisingly long document telling you more about bash prompts than you ever wanted to know here; it's a bit dated, but most of it should still hold. The particular problem you run into is that backslashes and backticks need to be escaped -- backslashes because they're used to escape things, and backticks because they're used for command substitutions -- and newlines are best replaced with the \n control sequence to avoid mishaps with lines that end in \. Ultimately, you want the effect of writing
export PS1=' ________________. ___ .______ \n / | / \\ | _ \\\n | (-----| |----\`/ ^ \\ | |_) |\n \\ \\ | | / /_\\ \\ | /\n.------) | | | / _____ \\ | |\\ \\-------.\n|_________/ |__| /__/ \\__\\| _| \`.________|\n____ __ ____ ___ .______ ________.\n\\ \\ / \\ / / / \\ | _ \\ / |\n \\ \\/ \\/ / / ^ \\ | |_) || (-----\`\n \\ / / /_\\ \\ | / \\ \\\n \\ /\\ / / _____ \\ | |\\ \\---) |\n \\__/ \\__/ /__/ \\__\\|__| \`._______/'
...which is somewhat unwieldy. A way to do this on the fly so that it is easier on the eyes is
PS1=' ________________. ___ .______
/ | / \ | _ \
| (-----| |----`/ ^ \ | |_) |
\ \ | | / /_\ \ | /
.------) | | | / _____ \ | |\ \-------.
|_________/ |__| /__/ \__\| _| `.________|
____ __ ____ ___ .______ ________.
\ \ / \ / / / \ | _ \ / |
\ \/ \/ / / ^ \ | |_) || (-----`
\ / / /_\ \ | / \ \
\ /\ / / _____ \ | |\ \---) |
\__/ \__/ /__/ \__\|__| `._______/'
PS1="${PS1//\\/\\\\}"
PS1="${PS1//\`/\\\`}"
PS1="${PS1//
/\\n}"
export PS1 # <-- this isn't really necessary, by the way. PS1 is not
# usually used by processes the shell spawns.
Here ${variable//pattern/replacement} is a bash-specific parameter expansion that expands to the value of $variable with all occurrences of pattern replaced with replacement. That is to say:
PS1="${PS1//\\/\\\\}" # replaces \ with \\
PS1="${PS1//\`/\\\`}" # replaces ` with \`
PS1="${PS1// # replaces newlines with \n
/\\n}"

How can I add color between \/ in terminal?

I am making text ASCII art for my .profile in terminal, and trying to colorize it. At first I as going to use the cat command and heredoc for printing out my art, but then I couldn't get the colors inside of the heredoc to work. So I went with the dirty fix, I am using echo -e for each line and then coloring it. If there's a better way, please let me know! Right now, I am having this problem.
Full picture:
_ _
__| |_ __ __ _| |__
/ _` | ' \/ _` | / /
\__,_|_|_|_\__,_|_\_\
Part that I am coloring:
/ _` | ' \/ _` | / /
Coloring:
echo -e "\033[37m/ _\` |\033[36m ' \\\033[1;35m/ _\` | / /";
Outputs:
/ _` | ' \033[1;35m/ _` | / /
As you can see, I am trying to insert a new color in between the \/. The \ is treating the \033[1;35m literally. Is there a way to color the change the color between the \/ without altering the image?
Also, I am using Mac OSX Lion.
Instead of a heredoc you may use the $'string' feature of Bash which makes it possible to directly use ANSI C escape sequences for colouring output.
man bash | less -p "\\$'string'"
(
asciiart=$'
_ _
__| |_ __ __ _| |__
\033[37m/ _` |\033[36m \' \\\033[1;35m/ _` | / /\033[m
\\__,_|_|_|_\\__,_|_\\_\\
'
echo "$asciiart" | sed '1d;$d'
)
To increase readability you may want to try figlet.
http://rudix.org/packages-def.html#figlet
Try with 5 bars instead of 3 \\\\\033[1;35m/
As for why, bash escape \\\\ to \\ then echo -e, escape it again to \. If you enable set -x (trace mode) you will see the command executed after bash processing (set +x to disable it).
What about simply using a few lines of POSIX printf
printf "\e[37m/ _\` |\e[36m \....\n"
instead of messing with all the pesky escape problems?

Resources