All Projects → paxtonhare → Demo Magic

paxtonhare / Demo Magic

Licence: mit
A handy shell script that enables you to write repeatable demos in a bash environment.

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to Demo Magic

Demoit
Live coding demos without Context Switching
Stars: ✭ 717 (-6.88%)
Mutual labels:  demo, tool
Glasscord
[BUGFIXES ONLY, SUPPORT WILL DROP MAR 1, 2021] Injecting composition effects into Electron applications!
Stars: ✭ 737 (-4.29%)
Mutual labels:  tool
Atlas
Quick SQLMap Tamper Suggester
Stars: ✭ 679 (-11.82%)
Mutual labels:  tool
Hexyl
A command-line hex viewer
Stars: ✭ 6,349 (+724.55%)
Mutual labels:  tool
Polygon Shredder
The polygon shredder that takes many cubes and turns them into confetti
Stars: ✭ 686 (-10.91%)
Mutual labels:  demo
Spirit
🙌 Play Spirit animations on the web
Stars: ✭ 719 (-6.62%)
Mutual labels:  tool
Diskus
A minimal, fast alternative to 'du -sh'
Stars: ✭ 674 (-12.47%)
Mutual labels:  tool
Aoe
AoE (AI on Edge,终端智能,边缘计算) 是一个终端侧AI集成运行时环境 (IRE),帮助开发者提升效率。
Stars: ✭ 759 (-1.43%)
Mutual labels:  demo
Rome
Carthage cache for S3, Minio, Ceph, Google Storage, Artifactory and many others
Stars: ✭ 724 (-5.97%)
Mutual labels:  tool
Slimmable networks
Slimmable Networks, AutoSlim, and Beyond, ICLR 2019, and ICCV 2019
Stars: ✭ 708 (-8.05%)
Mutual labels:  automated
Hover
Hover helps developers to release Flutter applications on desktop.
Stars: ✭ 698 (-9.35%)
Mutual labels:  tool
Autolayoutexamplewithmasonry
Different Autolayout examples with Masonry. 用Masonry写的Autolayout案例,持续更新中。详细解答请看tutuge.me
Stars: ✭ 694 (-9.87%)
Mutual labels:  demo
Cyxtenmindemo
十分钟搭建App框架(OC)KIF自动化测试 与系列Demo博文地址
Stars: ✭ 720 (-6.49%)
Mutual labels:  demo
Braindamage
Remote administration tool which uses Telegram as a C&C server
Stars: ✭ 681 (-11.56%)
Mutual labels:  tool
Simplex Noise.js
A fast simplex noise implementation in Javascript.
Stars: ✭ 739 (-4.03%)
Mutual labels:  demo
Legit
Git for Humans, Inspired by GitHub for Mac™.
Stars: ✭ 5,682 (+637.92%)
Mutual labels:  tool
Awesome bot
✅ Validate links in awesome projects
Stars: ✭ 697 (-9.48%)
Mutual labels:  tool
Leetheme
优雅的主题管理库- 一行代码完成多样式切换
Stars: ✭ 762 (-1.04%)
Mutual labels:  demo
Awesome Ml Demos With Ios
The challenge projects for Inferencing machine learning models on iOS
Stars: ✭ 741 (-3.77%)
Mutual labels:  demo
Rasa chatbot cn
building a chinese dialogue system based on the newest version of rasa(基于最新版本rasa搭建的对话系统)
Stars: ✭ 723 (-6.1%)
Mutual labels:  demo

Demo Magic

demo-magic.sh is a handy shell script that enables you to script repeatable demos in a bash environment so you don't have to type as you present. Rather than trying to type commands when presenting you simply script them and let demo-magic.sh run them for you.

Features

  • Simulates typing. It looks like you are actually typing out commands
  • Allows you to actually run commands or pretend to do so.
  • Can hide commands from presentation. Useful for behind the scenes stuff that doesn't need to be shown.

Functions

pe

Print and Execute.

  1. Waits for you to press ENTER (unless -n is passed).
  2. Then simulates typing the command you gave it.
  3. Then pauses until you press ENTER.
  4. Then runs the command.
#!/bin/bash

pe "ls -l"

pei

Print and Execute immediately.

  1. Simulates typing the command you gave it.
  2. Then pauses until you press ENTER.
  3. Then runs the command.
#!/bin/bash

pei "ls -l"

p

Print only.

  1. Waits for you to press ENTER (unless -n is passed).
  2. Then simulates typing the command you gave it.
  3. Then pauses until you press ENTER.
#!/bin/bash

p "ls -l"

wait

Waits for the user to press ENTER.

If PROMPT_TIMEOUT is defined and > 0 the demo will automatically proceed after the amount of seconds has passed.

#!/bin/bash

# Will wait until user presses enter
PROMPT_TIMEOUT=0
wait

# Will wait max 5 seconds until user presses
PROMPT_TIMEOUT=5
wait

cmd

Enters script into interactive mode and allows newly typed commands to be executed within the script

#!/bin/bash

cmd

Getting Started

Create a shell script and include demo-magic.sh

#!/bin/bash

########################
# include the magic
########################
. demo-magic.sh

# hide the evidence
clear

# Put your stuff here

Then use the handy functions to run through your demo.

Command line usage

demo-magic.sh exposes some options to your script.

  • -d - disable simulated typing. Useful for debugging
  • -h - prints the usage text
  • -n - set no default waiting after p and pe functions
  • -w - set no wait timeout after p and pe functions
$ ./my-demo.sh -h

Usage: ./my-demo.sh [options]

  Where options is one or more of:
  -h  Prints Help text
  -d  Debug mode. Disables simulated typing
  -n  No wait
  -w  Waits max the given amount of seconds before proceeding with demo (e.g. `-w5`)

Useful Tricks

Faking network connections

Network connections during demos are often unreliable. Try and fake whatever commands would rely on a network connection. For example: Instead of trying to install node modules in a node.js application you can fake it. You can install the node_modules at home on your decent network. Then rename the directory and pretend to install it later by symlinking. If you want to be thorough you can capture the output of npm install into a log file then cat it out later to simulate the install.

#!/bin/bash

########################
# include the magic
########################
. demo-magic.sh

# hide the evidence
clear

# this command is typed and executed
pe "cd my-app"

# this command is merely typed. Not executed
p "npm install"

# this command runs behind the scenes
ln -s cached_node_modules node_modules

# cat out a log file that captures a previous successful node modules install
cat node-modules-install.log

# now type and run the command to start your app
pe "node index.js"

No waiting

The -n no wait option can be useful if you want to print and execute multiple commands.

# include demo-magic
. demo-magic.sh -n

# add multiple commands
pe 'git status'
pe 'git log --oneline --decorate -n 20'

However this will oblige you to define your waiting points manually e.g.

...
# define waiting points
pe 'git status'
pe 'git log --oneline --decorate -n 20'
wait
pe 'git pull'
pe 'git log --oneline --decorate -n 20'
wait
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].