Skip to content

Commit

Permalink
Backup some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sagmor committed Sep 30, 2015
1 parent 632450a commit 755c43c
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/matrix.sh
@@ -0,0 +1,8 @@
#!/bin/bash
echo -e "\033[2J\033[?25l"; R=`tput lines` C=`tput cols`;: $[R--] ; while true
do ( e=echo\ -e s=sleep j=$[RANDOM%C] d=$[RANDOM%R];for i in `eval $e {1..$R}`;
do c=`printf '\\\\0%o' $[RANDOM%57+33]` ### http://bruxy.regnet.cz/web/linux ###
$e "\033[$[i-1];${j}H\033[32m$c\033[$i;${j}H\033[37m"$c; $s 0.1;if [ $i -ge $d ]
then $e "\033[$[i-d];${j}H ";fi;done;for i in `eval $e {$[i-d]..$R}`; #[mat!rix]
do echo -e "\033[$i;${j}f ";$s 0.1;done)& sleep 0.05;done #(c) 2011 -- [ BruXy ]

74 changes: 74 additions & 0 deletions tests/matrixish.sh
@@ -0,0 +1,74 @@
#!/bin/bash
#
# matrix: matrix-ish display for Bash terminal
# Author: Brett Terpstra 2012 <http://brettterpstra.com>
# Contributors: Lauri Ranta and Carl <http://blog.carlsensei.com/>
#
# A morning project. Could have been better, but I'm learning when to stop.

### Customization:
blue="\033[0;34m"
brightblue="\033[1;34m"
cyan="\033[0;36m"
brightcyan="\033[1;36m"
green="\033[0;32m"
brightgreen="\033[1;32m"
red="\033[0;31m"
brightred="\033[1;31m"
white="\033[1;37m"
black="\033[0;30m"
grey="\033[0;37m"
darkgrey="\033[1;30m"
# Choose the colors that will be used from the above list
# space-separated list
# e.g. `colors=($green $brightgreen $darkgrey $white)`
colors=($green $brightgreen)
### End customization

### Do not edit below this line
spacing=${1:-100} # the likelihood of a character being left in place
scroll=${2:-0} # 0 for static, positive integer determines scroll speed
screenlines=$(expr `tput lines` - 1 + $scroll)
screencols=$(expr `tput cols` / 2 - 1)

# chars=(a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 ^)
# charset via Carl:
chars=(ア イ ウ エ オ カ キ ク ケ コ サ シ ス セ ソ タ チ ツ テ ト ナ ニ ヌ ネ ノ ハ ヒ フ ヘ ホ マ ミ ム メ モ ヤ ユ ヨ ラ リ ル レ ロ ワ ン)

count=${#chars[@]}
colorcount=${#colors[@]}

trap "tput sgr0; clear; exit" SIGTERM SIGINT

if [[ $1 =~ '-h' ]]; then
echo "Display a Matrix(ish) screen in the terminal"
echo "Usage: matrix [SPACING [SCROLL]]"
echo "Example: matrix 100 0"
exit 0
fi


clear
tput cup 0 0
while :
do for i in $(eval echo {1..$screenlines})
do for i in $(eval echo {1..$screencols})
do rand=$(($RANDOM%$spacing))
case $rand in
0)
printf "${colors[$RANDOM%$colorcount]}${chars[$RANDOM%$count]} "
;;
1)
printf " "
;;
*)
printf "\033[2C"
;;
esac
done
printf "\n"

# sleep .005
done
tput cup 0 0
done
32 changes: 32 additions & 0 deletions tests/matrixsplit.sh
@@ -0,0 +1,32 @@
#!/bin/bash
echo -e "\033[2J\033[?25l"

R=`tput lines`
C=`tput cols`

: $[R--]

while true
do
( e=echo\ -e s=sleep j=$[RANDOM%C] d=$[RANDOM%R]
for i in `eval $e {1..$R}`
do
c=`printf '\\\\0%o' $[RANDOM%57+33]`
$e "\033[$[i-1]
${j}H\033[32m$c\033[$i
${j}H\033[37m"$c
$s 0.1
if [ $i -ge $d ]
then $e "\033[$[i-d]
${j}H "
fi
done
for i in `eval $e {$[i-d]..$R}`
#[mat!rix]
do
echo -e "\033[$i
${j}f "
$s 0.1
done)& sleep 0.05
done

6 changes: 6 additions & 0 deletions tests/tmux.osx.conf
@@ -0,0 +1,6 @@
# Copy-paste integration
set-option -g default-command "reattach-to-user-namespace -l bash"
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"

# Bind ']' to use pbpaste
bind ] run "reattach-to-user-namespace pbpaste | tmux load-buffer - && tmux paste-buffer"

0 comments on commit 755c43c

Please sign in to comment.