remove old tools
This commit is contained in:
@@ -1,310 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
VERSION=20150122
|
|
||||||
|
|
||||||
function display_self {
|
|
||||||
$0 $0
|
|
||||||
exit 0
|
|
||||||
}
|
|
||||||
function exit_reset {
|
|
||||||
setterm -cursor on
|
|
||||||
exit
|
|
||||||
}
|
|
||||||
function short_help() {
|
|
||||||
echo MarkSlider, the markdown syntax slideshow engine
|
|
||||||
echo Start without arguments to view the demo
|
|
||||||
exit
|
|
||||||
}
|
|
||||||
[ -z "$1" ] && display_self
|
|
||||||
[ "$1" = "-h" ] && short_help
|
|
||||||
|
|
||||||
[ -f "$1" ] || {
|
|
||||||
echo Cannot find file: $1
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
function display_slide {
|
|
||||||
j=$(( $2 + 1 ))
|
|
||||||
echo -en "$CLS"
|
|
||||||
awk 'match($0,/^# /){
|
|
||||||
c++;
|
|
||||||
print c $0;
|
|
||||||
}
|
|
||||||
!/^# /{
|
|
||||||
print $0;
|
|
||||||
}
|
|
||||||
' "$1" | sed -n '/^'$2'# /,/^'$j'# /p' | grep -v "^$j# " \
|
|
||||||
| sed -e 's,^'$i'\(# .*\),'$H'\1'$Z',' \
|
|
||||||
-e ${HROW}'s/^ />/' \
|
|
||||||
-e ${HROW}'s/^\(.*\)/'$H$Y'\1'$Z'/' \
|
|
||||||
| eval sed $REGEX
|
|
||||||
}
|
|
||||||
function slide_exec {
|
|
||||||
# find executables in the slide
|
|
||||||
j=$(( $2 + 1 ))
|
|
||||||
#echo -en "$CLS"
|
|
||||||
while read line
|
|
||||||
do eval $line > /dev/null 2>&1 &
|
|
||||||
done < <(
|
|
||||||
awk 'match($0,/^# /){
|
|
||||||
c++;
|
|
||||||
print c $0;
|
|
||||||
}
|
|
||||||
!/^# /{
|
|
||||||
print $0;
|
|
||||||
}
|
|
||||||
' "$1" | sed -n '/^'$2'# /,/^'$j'# /p' | grep "\&(.*)" | sed -e 's,[^\&]*\&( ,,' -e 's,)[^)]*,,' )
|
|
||||||
# restore cursor position to bottom of slide
|
|
||||||
echo -ne "${E}u"
|
|
||||||
while read line
|
|
||||||
do eval $line
|
|
||||||
done < <(
|
|
||||||
awk 'match($0,/^# /){
|
|
||||||
c++;
|
|
||||||
print c $0;
|
|
||||||
}
|
|
||||||
!/^# /{
|
|
||||||
print $0;
|
|
||||||
}
|
|
||||||
' "$1" | sed -n '/^'$2'# /,/^'$j'# /p' | grep "\$(.*)" | sed -e 's,[^\$]*\$( ,,' -e 's, )[^)]*,,' )
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
setterm -cursor off
|
|
||||||
trap 'reset;exit_reset' INT
|
|
||||||
E='\x1b['
|
|
||||||
H="${E}1m"
|
|
||||||
Z="${E}0m"
|
|
||||||
CLS="${E}2J${E}H"
|
|
||||||
#list of text colors:
|
|
||||||
BLACK="${E}30m"
|
|
||||||
R="${E}1;31m"
|
|
||||||
G="${E}1;32m"
|
|
||||||
B="${E}1;34m"
|
|
||||||
Y="${E}1;33m"
|
|
||||||
M="${E}1;35m"
|
|
||||||
C="${E}1;36m"
|
|
||||||
W="${E}1;37m"
|
|
||||||
r="${E}0;31m"
|
|
||||||
g="${E}0;32m"
|
|
||||||
b="${E}0;34m"
|
|
||||||
y="${E}0;33m"
|
|
||||||
m="${E}0;35m"
|
|
||||||
c="${E}0;36m"
|
|
||||||
w="${E}0;37m"
|
|
||||||
#list of BG colors:
|
|
||||||
BGR="${E}41m"
|
|
||||||
BGG="${E}42m"
|
|
||||||
BGB="${E}44m"
|
|
||||||
BGY="${E}43m"
|
|
||||||
BGM="${E}45m"
|
|
||||||
BGC="${E}46m"
|
|
||||||
BGW="${E}47m"
|
|
||||||
|
|
||||||
CONF_LINE=( \${H} \${Z} \${R} \${G} \${B} \${Y} \${M} \${C} \${W}
|
|
||||||
\${r} \${g} \${b} \${y} \${m} \${c} \${w}
|
|
||||||
\${BLACK} \${BGR} \${BGG} \${BGB} \${BGY} \${BGM} \${BGC} \${BGW} )
|
|
||||||
|
|
||||||
for (( r=0; r<${#CONF_LINE[@]}; r++ ));
|
|
||||||
do value=CONF_LINE[$r]
|
|
||||||
replace=$( eval echo ${!value} )
|
|
||||||
REGEX="$REGEX -e 's/\(${CONF_LINE[$r]}\)/"${replace}"/g'"
|
|
||||||
done
|
|
||||||
#REGEX="$REGEX -e 's/^\$(\([^)]\{20\}\).*)/\$(\1...)/g'"
|
|
||||||
#^ hide long commands
|
|
||||||
#echo $REGEX
|
|
||||||
#exit
|
|
||||||
|
|
||||||
i=1
|
|
||||||
MENU=1
|
|
||||||
HROW=1
|
|
||||||
while true
|
|
||||||
do
|
|
||||||
# print slide $i
|
|
||||||
NO_SLIDES=$( grep -ce "^# " "$1" )
|
|
||||||
SLIDE_CHARS=$(( ${#i} + ${#NO_SLIDES} +1 ))
|
|
||||||
COLS=$(( $( tput cols ) - $SLIDE_CHARS ))
|
|
||||||
LINES=$( tput lines )
|
|
||||||
[ "$cmd" = "e" ] && read -N 1 foo
|
|
||||||
display_slide "$1" $i
|
|
||||||
|
|
||||||
# save cursor location
|
|
||||||
echo -ne "${E}s"
|
|
||||||
# ask for user input
|
|
||||||
# 1 back, 2 forward, q exit, m menu
|
|
||||||
echo -ne "${Z}${E}1;${COLS}H"
|
|
||||||
[ -z "$MENU" ] || {
|
|
||||||
echo -ne "${i}/${NO_SLIDES}"
|
|
||||||
echo -ne "${E}1B${E}3D1:▶"
|
|
||||||
echo -ne "${E}1B${E}3D2:◀"
|
|
||||||
echo -ne "${E}1B${E}3Dq:x"
|
|
||||||
echo -ne "${E}1B${E}3Dm:▲${E}4A"
|
|
||||||
}
|
|
||||||
[[ -z "$MARKSLIDER_AUTOEXEC" ]] || slide_exec "$1" $i
|
|
||||||
read -s -N 1 cmd
|
|
||||||
# Escape inputed if arrow keys used
|
|
||||||
[ "$cmd" = "" ] && read -s -N 2 cmd
|
|
||||||
|
|
||||||
case "$cmd" in
|
|
||||||
2|"[D"|"[5")
|
|
||||||
i=$(( $i - 1 ))
|
|
||||||
[ $i -lt 1 ] && i=1
|
|
||||||
HROW=1
|
|
||||||
;;
|
|
||||||
1|"[C"|"[6"|"")
|
|
||||||
i=$(( $i + 1 ))
|
|
||||||
[ $i -gt $NO_SLIDES ] && i=$NO_SLIDES
|
|
||||||
HROW=1
|
|
||||||
;;
|
|
||||||
4|"[A")
|
|
||||||
HROW=$(( $HROW - 1 ))
|
|
||||||
[ $HROW -lt 1 ] && HROW=1
|
|
||||||
;;
|
|
||||||
3|"[B")
|
|
||||||
HROW=$(( $HROW + 1 ))
|
|
||||||
[ $HROW -gt $LINES ] && HROW=$LINES
|
|
||||||
;;
|
|
||||||
m)
|
|
||||||
[ -z "$MENU" ] && {
|
|
||||||
MENU=1
|
|
||||||
} || {
|
|
||||||
unset MENU
|
|
||||||
}
|
|
||||||
;;
|
|
||||||
x|q)
|
|
||||||
echo -ne "${E}1E"
|
|
||||||
exit_reset
|
|
||||||
;;
|
|
||||||
e)
|
|
||||||
slide_exec "$1" $i
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
done
|
|
||||||
exit_reset
|
|
||||||
"
|
|
||||||
# Markdown Slide Presenter: MarkSlider
|
|
||||||
|
|
||||||
* This tool prints a text file as slides,
|
|
||||||
retaining the formatting. Consider
|
|
||||||
using markdown syntax.
|
|
||||||
* Syntax ref: http://daringfireball.net/projects/markdown/syntax
|
|
||||||
* The only parsed syntax is the new slide syntax:
|
|
||||||
A row starting with '# '
|
|
||||||
|
|
||||||
## How to use ##
|
|
||||||
* Give the markdown file as argument
|
|
||||||
* Move to the next slide with key 1, arrow right, space..
|
|
||||||
* Move to the previous slide with key 2, arrow left
|
|
||||||
* Remote presentor USB dongles may work too.
|
|
||||||
* Move a highlighter line with up/down arrows
|
|
||||||
* Exit with q or x
|
|
||||||
* Hide menu with m
|
|
||||||
* The numbers on the right show the current
|
|
||||||
and number of slides in this presentation
|
|
||||||
|
|
||||||
# Hints: Tables
|
|
||||||
|
|
||||||
* Create tables with "ncsv -m"
|
|
||||||
|
|
||||||
Object Area Perimeter
|
|
||||||
------- ----- ----------
|
|
||||||
1 358 68.28
|
|
||||||
2 444 77.36
|
|
||||||
3 507 92.18
|
|
||||||
4 1026 118.6
|
|
||||||
5 539 84.18
|
|
||||||
|
|
||||||
# Hints: Plots
|
|
||||||
* Create plots with gnuplot:
|
|
||||||
set term dumb 60 15 enhanced
|
|
||||||
set parametric; set trange [0:10*pi]; set yrange[-5*pi:5*pi]
|
|
||||||
set xrange[-10*pi:10*pi]; plot t*cos(t), t*sin(t)
|
|
||||||
15 ++-----*-+---**--+--------+-------+**-----*-------++
|
|
||||||
|+ ** + ** + *****t*cos(t), t*sin(t)*******+|
|
|
||||||
| * ** *** *** ** * |
|
|
||||||
10 ++ * ** *** ** ** * ++
|
|
||||||
| ** * ** ******** ** * * |
|
|
||||||
5 ++ * ** * *** ** * ** ** ++
|
|
||||||
| * * * ** ** ** * * |
|
|
||||||
0 ++ * * * * **** * * * * ++
|
|
||||||
| * * * * * ** ** * * *
|
|
||||||
| * * * * ** *** * ** ** *
|
|
||||||
-5 ++ * * * ** ***** ** * * **
|
|
||||||
| * ** * ** *** ** * *|
|
|
||||||
-10 ++ ** * ** *** **** ** * *+
|
|
||||||
| * ** ** ****** ** ** * |
|
|
||||||
|+ * + * *** + *** ** * +|
|
|
||||||
-15 ++----*--+--*----+-**-----+-----**+------*+----*--++
|
|
||||||
-30 -20 -10 0 10 20 30
|
|
||||||
$( gnuplot -e "set term dumb 60 15 enhanced; set parametric; set trange [0:10*pi]; set yrange[-2*pi:2*pi]; set xrange[-4*pi:4*pi]; plot t*cos(t), t*sin(-t);" )[1K
|
|
||||||
|
|
||||||
# Hints: ${R}Co${Y}lo${G}rs
|
|
||||||
|
|
||||||
* Use ANSI codes directly for colors, or shortcuts:
|
|
||||||
${R}red: ${ [1DR}, ${G}green: ${ [1DG}, ${B}blue: ${ [1DB}${Z}
|
|
||||||
Bright colors: R G B C M Y W
|
|
||||||
Dark colors: r g b c m y BLACK
|
|
||||||
${H}Bright modifier: ${ [1DH}, ex: ${Z}${y}yel${H}low ${Z}${ [1Dy}yel${ [1DH}low
|
|
||||||
Background colors:${C}${BGM} bright cyan on magenta ${ [1DC}${ [1DBGM} ${Z}
|
|
||||||
Background colors: BGR BGG BGB BGC BGM BGY BGW
|
|
||||||
Reset colors with ${ [1DZ}
|
|
||||||
|
|
||||||
# Hints: Presenting
|
|
||||||
|
|
||||||
* Use a terminal with large font, perhaps 80 columns on screen
|
|
||||||
* Fullscreen often with F11
|
|
||||||
┌──────┐
|
|
||||||
* Get creative with │Ascii!│
|
|
||||||
└┬────┬┘
|
|
||||||
* Run any command by pressing "e" on a slide with syntax:
|
|
||||||
* "$ [1D( command )" to print the output
|
|
||||||
* "& [1D( command )" run process in background
|
|
||||||
|
|
||||||
&( xeyes )
|
|
||||||
$( ls )
|
|
||||||
[s$( echo You can hide commands too... )[1K[uHidden command
|
|
||||||
* Commands are auto-run, if MARKSLIDER_AUTOEXEC=true
|
|
||||||
${H}${R}NOTE: This setting is potentially dangerous, don't view anyones
|
|
||||||
presentations but yours with the setting!${Z}
|
|
||||||
|
|
||||||
# Hints: Other tools
|
|
||||||
|
|
||||||
* Check out tools like:
|
|
||||||
* toilet
|
|
||||||
m " ""# m
|
|
||||||
mm#mm mmm mmm # mmm mm#mm
|
|
||||||
# #" "# # # #" # #
|
|
||||||
# # # # # #"""" #
|
|
||||||
"mm "#m#" mm#mm "mm "#mm" "mm
|
|
||||||
* boxes
|
|
||||||
_ ._ _ , _ ._
|
|
||||||
(_ ' ( ` )_ .__)
|
|
||||||
( ( ( ) `) ) _)
|
|
||||||
(__ (_ (_ . _) _) ,__)
|
|
||||||
`~~`\ ' . /`~~`
|
|
||||||
,::: ; ; :::,
|
|
||||||
':::::::::::::::'
|
|
||||||
_jgs______/_ __ \__________
|
|
||||||
| |
|
|
||||||
| MarkSlider |
|
|
||||||
|___________________________|
|
|
||||||
|
|
||||||
# Hints: More tools
|
|
||||||
* JPEG to ascii: jp2a
|
|
||||||
MMMMMNNNNNMNkkk0MMWdll0MMMMMOc,,;cllc;,,
|
|
||||||
MMMMNNNNNMNOkOXMMKolkNMMW0ocdOXWMMMMMMWX
|
|
||||||
MMMNNNNNMNOkONMMkldNMMWx:dXMMMMWKOxxxOKW
|
|
||||||
MMWNNNNMWOkkNMMxlxWMMK;oWMMMXoloOXNWNXOd
|
|
||||||
MMNNNNWM0kkKMMOldMMM0,OMMMNclNMMMMM:WMMM
|
|
||||||
MWNNNNMNkkOWMNllNMMN,xMMMN'KMMMMMMM NMMM
|
|
||||||
MWNNNNMXkk0MM0ldMMMx,WMMM;kMMMMMMMW XMMM
|
|
||||||
MWNNNWMKkk0MMOlxMMMl:MMMM.NMMMMMMMO.xMMM
|
|
||||||
MWNNNNMXkk0MM0ldMMMx,WMMM;kMMMMMMN.; KMM
|
|
||||||
MWNNNNMNkkOWMNllNMMN,xMMMN'KMMMMK..,. 0M
|
|
||||||
MMNNNNWM0kkKMMOldMMM0,OMMMNclNMN:;NMW:;K
|
|
||||||
MMWNNNNMWOkkNMMxlxWMMK;oWMMMXoloOXNWNXOd
|
|
||||||
MMMNNNNNMNOkONMMkldNMMWx:dXMMMMWKOxxxOKW
|
|
||||||
MMMMNNNNNMNOkOXMMKolkNMMW0ocdOXWMMMMMMWX
|
|
||||||
MMMMMNNNNNMNkkkKMMWdll0MMMMMOc,,;cllc;,,
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
function helpexit() {
|
|
||||||
echo "Colorify a markdown document"
|
|
||||||
echo "Give filename(s) as the argument"
|
|
||||||
echo " Depends on highbeam "
|
|
||||||
exit
|
|
||||||
}
|
|
||||||
[[ -z "$1" ]] && helpexit
|
|
||||||
[[ "$1" = "-h" ]] && helpexit
|
|
||||||
|
|
||||||
# * bullets
|
|
||||||
# 1. ordered list
|
|
||||||
# ## Headers
|
|
||||||
# ``` code block
|
|
||||||
# code block
|
|
||||||
# code inline
|
|
||||||
# [links](URL)
|
|
||||||
# *bold* & **bold**
|
|
||||||
# _bold_
|
|
||||||
# <> tags
|
|
||||||
# [ ] check list (unofficial)
|
|
||||||
# [x] check list (unofficial)
|
|
||||||
# $> $! unofficial colors for executable code blocks
|
|
||||||
# Color codes
|
|
||||||
|
|
||||||
export HB_RULES='"\[[^]]\+\]([^)]\+)" "$U$B" \
|
|
||||||
"^\s*\*" "$y" \
|
|
||||||
"^[[:space:]]*[0-9]\+\..*" "$y" \
|
|
||||||
"^#.*" "$U$W" \
|
|
||||||
"\`\`\`.*" "$c" \
|
|
||||||
"^\s\s\s\s[^\*0-9].*" "$c" \
|
|
||||||
"\`[^[[:space:]]]*[^\`]\+\`" "$c" \
|
|
||||||
"\*\{1,2\}[^[[:space:]]]*[^\*]\+\*\{1,2\}" "$W" \
|
|
||||||
"[[:space:]]_[^[[:space:]]]*[^_]\+_" "$W" \
|
|
||||||
"<[^>]\+>" "$K" \
|
|
||||||
"^\s*\[\s]\s.*" "$y" \
|
|
||||||
"^\s*\[x]\s.*" "$Y" \
|
|
||||||
"\$[>!].*\$[>!]" "$c" \
|
|
||||||
"\${R}.*" "$R" \
|
|
||||||
"\${G}.*" "$G" \
|
|
||||||
"\${B}.*" "$B" \
|
|
||||||
"\${C}.*" "$C" \
|
|
||||||
"\${M}.*" "$M" \
|
|
||||||
"\${Y}.*" "$Y" \
|
|
||||||
"\${r}.*" "$r" \
|
|
||||||
"\${g}.*" "$g" \
|
|
||||||
"\${b}.*" "$b" \
|
|
||||||
"\${c}.*" "$c" \
|
|
||||||
"\${m}.*" "$m" \
|
|
||||||
"\${y}.*" "$y" \
|
|
||||||
"\${k}.*" "$k" \
|
|
||||||
"\${K}.*" "$K" \
|
|
||||||
"\${w}.*" "$w" \
|
|
||||||
"\${W}.*" "$W" \
|
|
||||||
"\${U}.*" "$U" \
|
|
||||||
"\${Z}.*" "$Z" \
|
|
||||||
'
|
|
||||||
|
|
||||||
cat "$@" | highbeam -c | sed 's,\${[RGBCMYrgbcmykKwWUZ]},,g'
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user