As a developer advocate, I fall into the "show me" camp. That means I like to show code when writing about a service or feature. In articles, code is presented as copy and paste blocks, such as this:
text = "World!"
print("Hello",text)
If I was doing a live demo, I could use a REPL if the language supported it.
Python 3.10.9 (main, Dec 15 2022, 18:18:30) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> text = "World!"
>>> print("Hello",text)
Hello World!
I'm a terrible typist and standing behind a podium while speaking to the audience is painful to watch. One way I've approached this problem on the command line is to use read
command in bash to display text, then execute the command or program when the enter/return key is pressed.
echo "This is a python program"
echo ""
echo "text = "World!"
echo "print("Hello",text)
echo ""
read -p -t 500 ""
python hello.py
This works fairly well, especially when using the command line to demonstrate setting up a service. There are two drawbacks, first, depending on the complexity of the demonstration the bash script can be very long. The second drawback is that if a command fails, then you can't repeat it. For example, if you create a cloud service, then try to move to the next step before the service is deployed, the demonstration fails.
What I want is the functionality of a Jupyter notebook. The default Jupyter notebook only includes a Python kernel, which supports executing simple shell commands, e.g.:
!echo "Hello World!"
However, you can install a bash kernel for Jupyter notebooks.
$ python -m bash_kernel.install
$ jupyter notebook
In the notebook interface, choose the Bash
and away we go.
The Python dependency and Jupyter setup can be a drawback. Aside from that, there are advantages. First, if a command fails, it can be repeated. Second, notebooks can be shared with the audience after the demonstration. The third and most import advantage is, your audience doesn't have to watch you type commands. If you have to give a live demonstration, consider using a Jupyter notebook.
Top comments (2)
Great advice.
I like the idea, may be handy for talks and presentations. Thanks for the tip!