Skip to content

Commit 49c9826

Browse files
committed
add demos
1 parent bf938ce commit 49c9826

15 files changed

+373
-0
lines changed

.gitmodules

+9
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,12 @@
1010
[submodule "less/lesspipe"]
1111
path = less/lesspipe
1212
url = https://github.com/wofr06/lesspipe.git
13+
[submodule "demos/_pipes"]
14+
path = demos/_pipes
15+
url = https://github.com/pipeseroni/pipes.sh
16+
[submodule "demos/_pipesx"]
17+
path = demos/_pipesx
18+
url = https://github.com/pipeseroni/pipesX.sh.git
19+
[submodule "demos/_rain"]
20+
path = demos/_rain
21+
url = https://github.com/lbgists/rain.sh.git

demos/256colors

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
#!/usr/bin/env bash
2+
3+
# If the '-e' flag is passed, cells will be three rows high.
4+
if [ "$1" == "-e" ]; then
5+
expanded=true;
6+
else
7+
expanded=false
8+
fi
9+
10+
# If the option --sixteen is given, only show the first 16 colors
11+
if [ "$1" == "-16" ]; then
12+
showall=true;
13+
sixteen=true;
14+
expanded=true;
15+
else
16+
sixteen=false
17+
fi
18+
19+
# Creates a color row.
20+
# Arguments:
21+
# - width (number)
22+
# - starting color (number)
23+
# - ending color (number)
24+
row () {
25+
# Give the arguments names for scope reasons.
26+
width=$(($1 - 2))
27+
start=$2
28+
end=$3
29+
30+
# Creates a "slice" (one terminal row) of a row.
31+
# Can be have number labels or be blank.
32+
# Arguments:
33+
# - label (boolean)
34+
slice () {
35+
for ((i=$start; i<=$end; i++))
36+
do
37+
# Determine if there will be a label on this cell (this is actually
38+
# a per slice setting but the title needs to be set on each cell
39+
# because of the numbering).
40+
if [ $1 ]; then string=$i; else string=' '; fi
41+
42+
# Change background to the correct color.
43+
tput setab $i
44+
45+
# Print the cell.
46+
printf "%${width}s " $string
47+
done
48+
49+
# Clear the coloring to avoid nasty wrapping colors.
50+
tput sgr0
51+
echo
52+
}
53+
54+
if [ $expanded == true ]; then
55+
# Print a blank slice, a labeled one, and then a blank one.
56+
slice; slice true; slice
57+
else
58+
# Just print the labeled slice.
59+
slice true
60+
fi
61+
}
62+
63+
display () {
64+
65+
# Get the widths based on columns.
66+
cols=$(tput cols)
67+
sixth=$(($cols/6))
68+
eighth=$(($cols/8))
69+
twelfth=$(($cols/12))
70+
71+
# Give it some room to breathe.
72+
echo
73+
74+
# The first sixteen colors.
75+
row $eighth 0 7
76+
row $eighth 8 15
77+
echo
78+
79+
if [ $sixteen == true ]; then
80+
exit
81+
fi
82+
83+
# 16-231.
84+
for ((a=0; a<=35; a++))
85+
do
86+
row $sixth $((16 + (6 * a))) $((21 + (6 * a)))
87+
done
88+
echo
89+
90+
# Greyscale.
91+
row $twelfth 232 243
92+
tput setaf 0
93+
row $twelfth 244 255
94+
95+
# Clear before exiting.
96+
tput sgr0
97+
echo
98+
}
99+
100+
# Show that table thang!
101+
display

demos/_pipes

Submodule _pipes added at 581792d

demos/_pipesx

Submodule _pipesx added at 988cbca

demos/_rain

Submodule _rain added at eb3becf

demos/colorbars

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/sh
2+
#
3+
# colorbars - smpte color bars in sh
4+
# http://git.io/colorbars
5+
6+
echo
7+
8+
for y in $(seq 0 13); do
9+
printf %s ' '
10+
for color in 7 3 6 2 5 1 4; do
11+
tput setab ${color}
12+
printf %s ' '
13+
done
14+
tput sgr0
15+
echo
16+
done
17+
18+
for y in 0 1; do
19+
printf %s ' '
20+
for color in 4 0 5 0 6 0 7; do
21+
tput setab ${color}
22+
printf %s ' '
23+
done
24+
tput sgr0
25+
echo
26+
done
27+
28+
for y in $(seq 0 4); do
29+
printf %s ' '
30+
for color in 4 4 4 4 4 7 7 7 7 7 5 5 5 5 5 0 0 0 0 0 0 0 0 0 0 0 0 0; do
31+
tput setab ${color}
32+
printf %s ' '
33+
done
34+
tput sgr0
35+
echo
36+
done
37+
38+
echo

demos/dna

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
#
3+
# ANSI color scheme script by pfh
4+
#
5+
# Initializing mod by lolilolicon from Archlinux
6+
#
7+
8+
f=3 b=4
9+
for j in f b; do
10+
for i in {0..7}; do
11+
printf -v $j$i %b "\e[${!j}${i}m"
12+
done
13+
done
14+
bld=$'\e[1m'
15+
rst=$'\e[0m'
16+
inv=$'\e[7m'
17+
18+
cat << EOF
19+
20+
${f1} █-----${bld}${rst}${f2} █-----${bld}${rst} ${f3} █-----${bld}${rst} ${f4} █-----${bld}${rst} ${f5} █-----${bld}${rst} ${f6} █-----${bld}${rst}
21+
${f1} █---${bld}${rst} ${f2} █---${bld}${rst} ${f3} █---${bld}${rst} ${f4} █---${bld}${rst} ${f5} █---${bld}${rst} ${f6} █---${bld}${rst}
22+
${f1} █-${bld}${rst} ${f2} █-${bld}${rst} ${f3} █-${bld}${rst} ${f4} █-${bld}${rst} ${f5} █-${bld}${rst} ${f6} █-${bld}${rst}
23+
${f1}${rst} ${f2}${rst} ${f3}${rst} ${f4}${rst} ${f5}${rst} ${f6}${rst}
24+
${f1}${bld} █-${rst}${f1}${rst} ${f2}${bld} █_${rst}${f2}${rst} ${f3}${bld} █-${rst}${f3}${rst} ${f4}${bld} █-${rst}${f4}${rst} ${f5}${bld} █-${rst}${f5}${rst} ${f6}${bld} █-${rst}${f6}${rst}
25+
${f1}${bld} █---${rst}${f1}${rst} ${f2}${bld} █---${rst}${f2}${rst} ${f3}${bld} █---${rst}${f3}${rst} ${f4}${bld} █---${rst}${f4}${rst} ${f5}${bld} █---${rst}${f5}${rst} ${f6}${bld} █---${rst}${f6}${rst}
26+
${f1}${bld} █-----${rst}${f1}${rst} ${f2}${bld} █-----${rst}${f2}${rst} ${f3}${bld} █-----${rst}${f3}${rst} ${f4}${bld} █-----${rst}${f4}${rst} ${f5}${bld} █-----${rst}${f5}${rst} ${f6}${bld} █-----${rst}${f6}${rst}
27+
${f1}${bld} █---${rst}${f1}${rst} ${f2}${bld} █---${rst}${f2}${rst} ${f3}${bld} █---${rst}${f3}${rst} ${f4}${bld} █---${rst}${f4}${rst} ${f5}${bld} █---${rst}${f5}${rst} ${f6}${bld} █---${rst}${f6}${rst}
28+
${f1}${bld} █-${rst}${f1}${rst} ${f2}${bld} █-${rst}${f2}${rst} ${f3}${bld} █-${rst}${f3}${rst} ${f4}${bld} █-${rst}${f4}${rst} ${f5}${bld} █-${rst}${f5}${rst} ${f6}${bld} █-${rst}${f6}${rst}
29+
${f1}${bld}${rst} ${f2}${bld}${rst} ${f3}${bld}${rst} ${f4}${bld}${rst} ${f5}${bld}${rst} ${f6}${bld}${rst}
30+
${f1} █-${bld}${rst} ${f2} █-${bld}${rst} ${f3} █-${bld}${rst} ${f4} █-${bld}${rst} ${f5} █-${bld}${rst} ${f6} █-${bld}${rst}
31+
${f1} █---${bld}${rst} ${f2} █---${bld}${rst} ${f3} █---${bld}${rst} ${f4} █---${bld}${rst} ${f5} █---${bld}${rst} ${f6} █---${bld}${rst}
32+
${f1} █-----${bld}${rst}${f2} █-----${bld}${rst} ${f3} █-----${bld}${rst} ${f4} █-----${bld}${rst} ${f5} █-----${bld}${rst} ${f6} █-----${bld}${rst}
33+
${f1} █---${bld}${rst} ${f2} █---${bld}${rst} ${f3} █---${bld}${rst} ${f4} █---${bld}${rst} ${f5} █---${bld}${rst} ${f6} █---${bld}${rst}
34+
${f1} █-${bld}${rst} ${f2} █-${bld}${rst} ${f3} █-${bld}${rst} ${f4} █-${bld}${rst} ${f5} █-${bld}${rst} ${f6} █-${bld}${rst}
35+
${f1}${rst} ${f2}${rst} ${f3}${rst} ${f4}${rst} ${f5}${rst} ${f6}${rst}
36+
${f1}${bld} █-${rst}${f1}${rst} ${f2}${bld} █_${rst}${f2}${rst} ${f3}${bld} █-${rst}${f3}${rst} ${f4}${bld} █-${rst}${f4}${rst} ${f5}${bld} █-${rst}${f5}${rst} ${f6}${bld} █-${rst}${f6}${rst}
37+
${f1}${bld} █---${rst}${f1}${rst} ${f2}${bld} █---${rst}${f2}${rst} ${f3}${bld} █---${rst}${f3}${rst} ${f4}${bld} █---${rst}${f4}${rst} ${f5}${bld} █---${rst}${f5}${rst} ${f6}${bld} █---${rst}${f6}${rst}
38+
${f1}${bld} █-----${rst}${f1}${rst} ${f2}${bld} █-----${rst}${f2}${rst} ${f3}${bld} █-----${rst}${f3}${rst} ${f4}${bld} █-----${rst}${f4}${rst} ${f5}${bld} █-----${rst}${f5}${rst} ${f6}${bld} █-----${rst}${f6}${rst}
39+
${f1}${bld} █---${rst}${f1}${rst} ${f2}${bld} █---${rst}${f2}${rst} ${f3}${bld} █---${rst}${f3}${rst} ${f4}${bld} █---${rst}${f4}${rst} ${f5}${bld} █---${rst}${f5}${rst} ${f6}${bld} █---${rst}${f6}${rst}
40+
${f1}${bld} █-${rst}${f1}${rst} ${f2}${bld} █-${rst}${f2}${rst} ${f3}${bld} █-${rst}${f3}${rst} ${f4}${bld} █-${rst}${f4}${rst} ${f5}${bld} █-${rst}${f5}${rst} ${f6}${bld} █-${rst}${f6}${rst}
41+
${f1}${bld}${rst} ${f2}${bld}${rst} ${f3}${bld}${rst} ${f4}${bld}${rst} ${f5}${bld}${rst} ${f6}${bld}${rst}
42+
${f1} █-${bld}${rst} ${f2} █-${bld}${rst} ${f3} █-${bld}${rst} ${f4} █-${bld}${rst} ${f5} █-${bld}${rst} ${f6} █-${bld}${rst}
43+
${f1} █---${bld}${rst} ${f2} █---${bld}${rst} ${f3} █---${bld}${rst} ${f4} █---${bld}${rst} ${f5} █---${bld}${rst} ${f6} █---${bld}${rst}
44+
${f1} █-----${bld}${rst}${f2} █-----${bld}${rst} ${f3} █-----${bld}${rst} ${f4} █-----${bld}${rst} ${f5} █-----${bld}${rst} ${f6} █-----${bld}${rst}
45+
46+
EOF

demos/ghosts

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env bash
2+
#
3+
# ANSI color scheme script by pfh
4+
#
5+
# Initializing mod by lolilolicon from Archlinux
6+
#
7+
8+
f=3 b=4
9+
for j in f b; do
10+
for i in {0..7}; do
11+
printf -v $j$i %b "\e[${!j}${i}m"
12+
done
13+
done
14+
bld=$'\e[1m'
15+
rst=$'\e[0m'
16+
inv=$'\e[7m'
17+
cat << EOF
18+
19+
$f1 ▄▄▄ $f2 ▄▄▄ $f3 ▄▄▄ $f4 ▄▄▄ $f5 ▄▄▄ $f6 ▄▄▄
20+
$f1 ▀█▀██ ▄ $f2 ▀█▀██ ▄ $f3 ▀█▀██ ▄ $f4 ▀█▀██ ▄ $f5 ▀█▀██ ▄ $f6 ▀█▀██ ▄
21+
$f1 ▀▄██████▀ $f2 ▀▄██████▀ $f3 ▀▄██████▀ $f4 ▀▄██████▀ $f5 ▀▄██████▀ $f6 ▀▄██████▀
22+
$f1 ▀█████ $f2 ▀█████ $f3 ▀█████ $f4 ▀█████ $f5 ▀█████ $f6 ▀█████
23+
$f1 ▀▀▀▀▄ $f2 ▀▀▀▀▄ $f3 ▀▀▀▀▄ $f4 ▀▀▀▀▄ $f5 ▀▀▀▀▄ $f6 ▀▀▀▀▄
24+
$bld
25+
$f1 ▄▄▄ $f2 ▄▄▄ $f3 ▄▄▄ $f4 ▄▄▄ $f5 ▄▄▄ $f6 ▄▄▄
26+
$f1 ▀█▀██ ▄ $f2 ▀█▀██ ▄ $f3 ▀█▀██ ▄ $f4 ▀█▀██ ▄ $f5 ▀█▀██ ▄ $f6 ▀█▀██ ▄
27+
$f1 ▀▄██████▀ $f2 ▀▄██████▀ $f3 ▀▄██████▀ $f4 ▀▄██████▀ $f5 ▀▄██████▀ $f6 ▀▄██████▀
28+
$f1 ▀█████ $f2 ▀█████ $f3 ▀█████ $f4 ▀█████ $f5 ▀█████ $f6 ▀█████
29+
$f1 ▀▀▀▀▄ $f2 ▀▀▀▀▄ $f3 ▀▀▀▀▄ $f4 ▀▀▀▀▄ $f5 ▀▀▀▀▄ $f6 ▀▀▀▀▄
30+
$rst
31+
EOF

demos/invaders

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/sh
2+
initializeANSI()
3+
{
4+
esc="$(printf '\033')";
5+
6+
blackf="${esc}[30m"; redf="${esc}[31m"; greenf="${esc}[32m"
7+
yellowf="${esc}[33m" bluef="${esc}[34m"; purplef="${esc}[35m"
8+
cyanf="${esc}[36m"; whitef="${esc}[37m"
9+
10+
blackb="${esc}[40m"; redb="${esc}[41m"; greenb="${esc}[42m"
11+
yellowb="${esc}[43m" blueb="${esc}[44m"; purpleb="${esc}[45m"
12+
cyanb="${esc}[46m"; whiteb="${esc}[47m"
13+
14+
boldon="${esc}[1m"; boldoff="${esc}[22m"
15+
italicson="${esc}[3m"; italicsoff="${esc}[23m"
16+
ulon="${esc}[4m"; uloff="${esc}[24m"
17+
invon="${esc}[7m"; invoff="${esc}[27m"
18+
19+
reset="${esc}[0m"
20+
}
21+
22+
initializeANSI
23+
24+
cat << EOF
25+
26+
${boldon}${redf}▀▄ ▄▀ ${reset} ${boldon}${greenf}▄▄▄████▄▄▄ ${reset} ${boldon}${yellowf} ▄██▄ ${reset} ${boldon}${bluef}▀▄ ▄▀ ${reset} ${boldon}${purplef}▄▄▄████▄▄▄ ${reset} ${boldon}${cyanf} ▄██▄ ${reset}
27+
${boldon}${redf}▄█▀███▀█▄ ${reset} ${boldon}${greenf}███▀▀██▀▀███${reset} ${boldon}${yellowf}▄█▀██▀█▄${reset} ${boldon}${bluef}▄█▀███▀█▄ ${reset} ${boldon}${purplef}███▀▀██▀▀███${reset} ${boldon}${cyanf}▄█▀██▀█▄${reset}
28+
${boldon}${redf}█▀███████▀█${reset} ${boldon}${greenf}▀▀▀██▀▀██▀▀▀${reset} ${boldon}${yellowf}▀▀█▀▀█▀▀${reset} ${boldon}${bluef}█▀███████▀█${reset} ${boldon}${purplef}▀▀▀██▀▀██▀▀▀${reset} ${boldon}${cyanf}▀▀█▀▀█▀▀${reset}
29+
${boldon}${redf}▀ ▀▄▄ ▄▄▀ ▀${reset} ${boldon}${greenf}▄▄▀▀ ▀▀ ▀▀▄▄${reset} ${boldon}${yellowf}▄▀▄▀▀▄▀▄${reset} ${boldon}${bluef}▀ ▀▄▄ ▄▄▀ ▀${reset} ${boldon}${purplef}▄▄▀▀ ▀▀ ▀▀▄▄${reset} ${boldon}${cyanf}▄▀▄▀▀▄▀▄${reset}
30+
31+
${redf}▀▄ ▄▀ ${reset} ${greenf}▄▄▄████▄▄▄ ${reset} ${yellowf} ▄██▄ ${reset} ${bluef}▀▄ ▄▀ ${reset} ${purplef}▄▄▄████▄▄▄ ${reset} ${cyanf} ▄██▄ ${reset}
32+
${redf}▄█▀███▀█▄ ${reset} ${greenf}███▀▀██▀▀███${reset} ${yellowf}▄█▀██▀█▄${reset} ${bluef}▄█▀███▀█▄ ${reset} ${purplef}███▀▀██▀▀███${reset} ${cyanf}▄█▀██▀█▄${reset}
33+
${redf}█▀███████▀█${reset} ${greenf}▀▀▀██▀▀██▀▀▀${reset} ${yellowf}▀▀█▀▀█▀▀${reset} ${bluef}█▀███████▀█${reset} ${purplef}▀▀▀██▀▀██▀▀▀${reset} ${cyanf}▀▀█▀▀█▀▀${reset}
34+
${redf}▀ ▀▄▄ ▄▄▀ ▀${reset} ${greenf}▄▄▀▀ ▀▀ ▀▀▄▄${reset} ${yellowf}▄▀▄▀▀▄▀▄${reset} ${bluef}▀ ▀▄▄ ▄▄▀ ▀${reset} ${purplef}▄▄▀▀ ▀▀ ▀▀▄▄${reset} ${cyanf}▄▀▄▀▀▄▀▄${reset}
35+
36+
37+
${whitef}${reset}
38+
39+
${whitef}${reset}
40+
${whitef}${reset}
41+
${whitef}▄█▄${reset}
42+
${whitef}▄█████████▄${reset}
43+
${whitef}▀▀▀▀▀▀▀▀▀▀▀${reset}
44+
45+
EOF

demos/pacman-colors

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
#
3+
# ANSI color scheme script featuring PACMAN
4+
# by pfh
5+
#
6+
# Initializing procedure by lolilolicon
7+
#
8+
9+
f=3 b=4
10+
for j in f b; do
11+
for i in {0..7}; do
12+
printf -v $j$i %b "\e[${!j}${i}m"
13+
done
14+
done
15+
bld=$'\e[1m'
16+
rst=$'\e[0m'
17+
inv=$'\e[7m'
18+
19+
20+
cat << EOF
21+
22+
$rst
23+
$f3 ▄███████▄ $f1 ▄██████▄ $f2 ▄██████▄ $f4 ▄██████▄ $f5 ▄██████▄ $f6 ▄██████▄
24+
$f3▄█████████▀▀ $f1$f7█▀█$f1██$f7█▀█$f1██▄ $f2▄█$f7███$f2██$f7███$f2█▄ $f4▄█$f7███$f4██$f7███$f4█▄ $f5▄█$f7███$f5██$f7███$f5█▄ $f6▄██$f7█▀█$f6██$f7█▀█$f6
25+
$f3███████▀ $f7▄▄ ▄▄ ▄▄ $f1$f7▄▄█$f1██$f7▄▄█$f1███ $f2██$f7█ █$f2██$f7█ █$f2██ $f4██$f7█ █$f4██$f7█ █$f4██ $f5██$f7█ █$f5██$f7█ █$f5██ $f6███$f7█▄▄$f6██$f7█▄▄$f6
26+
$f3███████▄ $f7▀▀ ▀▀ ▀▀ $f1████████████ $f2████████████ $f4████████████ $f5████████████ $f6████████████
27+
$f3▀█████████▄▄ $f1██▀██▀▀██▀██ $f2██▀██▀▀██▀██ $f4██▀██▀▀██▀██ $f5██▀██▀▀██▀██ $f6██▀██▀▀██▀██
28+
$f3 ▀███████▀ $f1▀ ▀ ▀ ▀ $f2▀ ▀ ▀ ▀ $f4▀ ▀ ▀ ▀ $f5▀ ▀ ▀ ▀ $f6▀ ▀ ▀ ▀
29+
$bld
30+
$f3 ▄███████▄ $f1 ▄██████▄ $f2 ▄██████▄ $f4 ▄██████▄ $f5 ▄██████▄ $f6 ▄██████▄
31+
$f3▄█████████▀▀ $f1$f7█▀█$f1██$f7█▀█$f1██▄ $f2▄█$f7█ █$f2██$f7█ █$f2█▄ $f4▄█$f7█ █$f4██$f7█ █$f4█▄ $f5▄█$f7█ █$f5██$f7█ █$f5█▄ $f6▄██$f7█▀█$f6██$f7█▀█$f6
32+
$f3███████▀ $f7▄▄ ▄▄ ▄▄ $f1$f7▄▄█$f1██$f7▄▄█$f1███ $f2██$f7███$f2██$f7███$f2██ $f4██$f7███$f4██$f7███$f4██ $f5██$f7███$f5██$f7███$f5██ $f6███$f7█▄▄$f6██$f7█▄▄$f6
33+
$f3███████▄ $f7▀▀ ▀▀ ▀▀ $f1████████████ $f2████████████ $f4████████████ $f5████████████ $f6████████████
34+
$f3▀█████████▄▄ $f1██▀██▀▀██▀██ $f2██▀██▀▀██▀██ $f4██▀██▀▀██▀██ $f5██▀██▀▀██▀██ $f6██▀██▀▀██▀██
35+
$f3 ▀███████▀ $f1▀ ▀ ▀ ▀ $f2▀ ▀ ▀ ▀ $f4▀ ▀ ▀ ▀ $f5▀ ▀ ▀ ▀ $f6▀ ▀ ▀ ▀
36+
$rst
37+
EOF

demos/pipes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_pipes/pipes.sh

demos/pipesx

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_pipesx/pipesX.sh

demos/rain

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_rain/rain.sh

0 commit comments

Comments
 (0)