From a2c756e3c897e55e524194250298e1944005ed80 Mon Sep 17 00:00:00 2001
From: sauloal <sauloal@yahoo.com.br>
Date: Mon, 14 May 2012 11:57:17 +0200
Subject: [PATCH] 2012-05-14_11_57_04_02_00 :: 0 :: A => 1

---
 bin/snow | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100755 bin/snow

diff --git a/bin/snow b/bin/snow
new file mode 100755
index 00000000..cad0ed35
--- /dev/null
+++ b/bin/snow
@@ -0,0 +1,40 @@
+#!/bin/bash
+ 
+LINES=$(tput lines)
+COLUMNS=$(tput cols)
+ 
+declare -A snowflakes
+declare -A lastflakes
+ 
+clear
+ 
+function move_flake() {
+i="$1"
+ 
+if [ "${snowflakes[$i]}" = "" ] || [ "${snowflakes[$i]}" = "$LINES" ]; then
+snowflakes[$i]=0
+else
+if [ "${lastflakes[$i]}" != "" ]; then
+printf "\033[%s;%sH \033[1;1H " ${lastflakes[$i]} $i
+fi
+fi
+ 
+printf "\033[%s;%sH*\033[1;1H" ${snowflakes[$i]} $i
+ 
+lastflakes[$i]=${snowflakes[$i]}
+snowflakes[$i]=$((${snowflakes[$i]}+1))
+}
+ 
+while :
+do
+i=$(($RANDOM % $COLUMNS))
+ 
+move_flake $i
+ 
+for x in "${!lastflakes[@]}"
+do
+move_flake "$x"
+done
+ 
+sleep 0.1
+done
-- 
GitLab