aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2021-01-22 16:07:26 +0000
committerJoursoir <chat@joursoir.net>2021-01-22 16:07:26 +0000
commit90789b56c9d7b96903b2287b960afb9755026e8f (patch)
tree073acba9a5e0183be6aa302173ec415083a1ef90
downloadspark-90789b56c9d7b96903b2287b960afb9755026e8f.tar.gz
spark-90789b56c9d7b96903b2287b960afb9755026e8f.tar.bz2
spark-90789b56c9d7b96903b2287b960afb9755026e8f.zip
init project
-rwxr-xr-xspark.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/spark.sh b/spark.sh
new file mode 100755
index 0000000..b7add42
--- /dev/null
+++ b/spark.sh
@@ -0,0 +1,40 @@
+#!/usr/bin/env bash
+
+case `uname -m` in
+ x86_64|amd64) # 64 bit
+ MAX=$(( -2**63 ));
+ MIN=$(( 2**63-1 )) ;;
+ i686|i386|x86) # 32 bit
+ MAX=$(( -2**31 ));
+ MIN=$(( 2**31-1 )) ;;
+ *) # 16 bit
+ MAX=$(( -2*15 ));
+ MIN=$(( 2*15-1 )) ;;
+esac
+
+for i in "$@"
+do
+ case $i in
+ ''|*[!0-9]*) exit 1 ;;
+ *) ;;
+ esac
+
+ if [ $i -gt $MAX ]; then
+ MAX=$i
+ fi
+ if [ $i -lt $MIN ]; then
+ MIN=$i
+ fi
+done
+
+LEVELS=8
+DIFF=$(( $MAX - $MIN + 1 ))
+
+for i in "$@"
+do
+ H=$(( 1 + ($i - $MIN + 1) * ($LEVELS-1) / $DIFF ))
+
+ printf "\u258$H"
+done
+
+echo \ No newline at end of file