Basically a bunch of small scripts that make use of various tools common on unix systems (shell, sed, bc) to do surprising things
Game of life in sed. Pretty slow. It takes string of 0s and 1s as input and outputs evolution of it under the rules of Conway's Game of Life. World is 64 cells wide and can have any height.
> cat ./misc/glider.txt | ./gol.sed
................................................................
...#.#..........................................................
....##..........................................................
....#...........................................................
................................................................
................................................................
.....#..........................................................
...#.#..........................................................
....##..........................................................
................................................................
................................................................
....#...........................................................
.....##.........................................................
....##..........................................................
................................................................
Simple calculator that can sum, multiply and parse parenthesis:
> echo "(6 + (77 + 2 * 3)) * 14" | ./calc.sed
1246
It doesn't (yet) work with zeros.
Prime checker. It's really slow, but it works :)
> echo 43 | ./prime.sed
true
Numeric sorting
> echo 1 7 667 35 2 0 37 4 | ./sort.sed
0 1 2 4 7 35 37 667
Implementation of rule110 1D cellular automata, which is turing complete. Basically a very short proof of turing-completeness of sed.
> echo '00000000000000000000000000000000000010' | ./r110.sed | tr '01' '.#' | head -n 20
...................................##.
..................................###.
.................................##.#.
................................#####.
...............................##...#.
..............................###..##.
.............................##.#.###.
............................#######.#.
...........................##.....###.
..........................###....##.#.
.........................##.#...#####.
........................#####..##...#.
.......................##...#.###..##.
......................###..####.#.###.
.....................##.#.##..#####.#.
....................########.##...###.
...................##......####..##.#.
..................###.....##..#.#####.
.................##.#....###.####...#.
................#####...##.###..#..##.
Moved to tag.sed
Implementation of cp
using pure bash. It works on binary files too!
./cp.sh a b
Straightforward program to draw mandelbrot set. Nothing really special.