From 13b961f1481b5e376ae673b37c8cf6732e9a8a15 Mon Sep 17 00:00:00 2001 From: Sankalp Tharu Date: Thu, 25 May 2023 01:18:06 +0545 Subject: [PATCH] fresh init --- home/.local/bin/fetch | 180 +++++ home/.local/bin/fun/bonsai | 661 ++++++++++++++++++ home/.local/bin/fun/colorbars | 38 + home/.local/bin/fun/colorbars-sm | 35 + home/.local/bin/fun/colors | 13 + home/.local/bin/fun/colorscheme | 27 + home/.local/bin/fun/dna | 46 ++ home/.local/bin/fun/ghosts | 31 + home/.local/bin/fun/metroid | 114 +++ home/.local/bin/fun/pacman-colors | 37 + home/.local/bin/fun/pipes | 142 ++++ home/.local/bin/fun/pipesx | 207 ++++++ home/.local/bin/fun/rain | 100 +++ home/.local/bin/fun/slendy | 35 + home/.local/bin/fun/testfonts | 40 ++ home/.local/bin/fun/unix | 26 + home/.local/bin/hello.sh | 32 + home/.local/bin/sysfetch | 167 +++++ home/.local/share/applications/nvim.desktop | 14 + home/.local/share/applications/ranger.desktop | 12 + home/.local/share/applications/zfetch.desktop | 8 + home/.local/share/applications/zombie.svg | 76 ++ home/.local/share/asciiart/blocks1 | 5 + home/.local/share/asciiart/pinguco | 39 ++ home/.local/share/asciiart/unix | 25 + home/.local/share/asciiart/zfetch | 196 ++++++ 26 files changed, 2306 insertions(+) create mode 100755 home/.local/bin/fetch create mode 100755 home/.local/bin/fun/bonsai create mode 100755 home/.local/bin/fun/colorbars create mode 100755 home/.local/bin/fun/colorbars-sm create mode 100755 home/.local/bin/fun/colors create mode 100755 home/.local/bin/fun/colorscheme create mode 100755 home/.local/bin/fun/dna create mode 100755 home/.local/bin/fun/ghosts create mode 100755 home/.local/bin/fun/metroid create mode 100755 home/.local/bin/fun/pacman-colors create mode 100755 home/.local/bin/fun/pipes create mode 100755 home/.local/bin/fun/pipesx create mode 100755 home/.local/bin/fun/rain create mode 100755 home/.local/bin/fun/slendy create mode 100755 home/.local/bin/fun/testfonts create mode 100755 home/.local/bin/fun/unix create mode 100755 home/.local/bin/hello.sh create mode 100755 home/.local/bin/sysfetch create mode 100644 home/.local/share/applications/nvim.desktop create mode 100644 home/.local/share/applications/ranger.desktop create mode 100755 home/.local/share/applications/zfetch.desktop create mode 100644 home/.local/share/applications/zombie.svg create mode 100755 home/.local/share/asciiart/blocks1 create mode 100755 home/.local/share/asciiart/pinguco create mode 100755 home/.local/share/asciiart/unix create mode 100755 home/.local/share/asciiart/zfetch diff --git a/home/.local/bin/fetch b/home/.local/bin/fetch new file mode 100755 index 0000000..aaa29e3 --- /dev/null +++ b/home/.local/bin/fetch @@ -0,0 +1,180 @@ +#!/bin/bash + + + +c=3 b=4 +for j in c b; do + for i in {0..7}; do + printf -v $j$i "%b" "\e[${!j}${i}m" + done +done + +user=$(whoami) +host=$(uname -a | awk '{print $2}') +memory=$(free -h) +os=$(source /etc/os-release && echo $PRETTY_NAME) +kernel=$(uname -sr) +wm="$(xprop -id $(xprop -root -notype | awk '$1=="_NET_SUPPORTING_WM_CHECK:"{print $5}') -notype -f _NET_WM_NAME 8t | grep "WM_NAME" | cut -f2 -d \")" +mem=$(free -m | sed -n 's/^Mem:\s\+[0-9]\+\s\+\([0-9]\+\)\s.\+/\1/p') +pkgs="$(pacman -Q | wc -l)" +shell=$(echo "$SHELL" | awk -F/ '{for ( i=1; i <= NF; i++) sub(".", substr(toupper($i),1,1) , $i); print $NF}') +colors=$(for i in {0..7}; do echo -en "\e[${1}$((30 + $i))m  "; done) +license="GNU-GPL3" +get_mem(){ + + while IFS=":" read -r a b; do + case $a in + "MemTotal") ((mem_used+=${b/kB})); mem_total="${b/kB}" ;; + "Shmem") ((mem_used+=${b/kB})) ;; + "MemFree" | "Buffers" | "Cached" | "SReclaimable") + mem_used="$((mem_used-=${b/kB}))" + ;; + esac + done < /proc/meminfo + + mem_used="$((mem_used / 1024))" + mem_total="$((mem_total / 1024))" + +} +get_mem +get_uptime() { + # Uptime works by retrieving the data in total seconds and then + # converting that data into days, hours and minutes using simple + # math. + IFS=. read -r s _ = 4.0 +if ((BASH_VERSINFO[0] < 4)); then + printf '%s\n' "Error: bonsai.sh requires Bash v4.0 or higher. You have version $BASH_VERSION." +fi + +# ensure MacOS compatibility with GNU getopt +if [[ "$OSTYPE" == 'darwin'* ]]; then + GGETOPT=/usr/local/Cellar/gnu-getopt/*/bin/getopt # should find gnu-getopt + if [ ! -x $GGETOPT ]; then # file is not executable + printf '%s\n' 'Error: Running on MacOS requires an executable gnu getopt.' + exit 2 + fi + shopt -s expand_aliases + alias getopt='$GGETOPT' # replace getopt with gnu getopt +fi + +# ------ parse options ------ + +OPTS="hlt:w:ig:c:Tm:b:M:L:s:vn" # the colon means it requires a value +LONGOPTS="help,live,time:,wait:,infinite,geometry:,leaf:,termcolors,message:,base:,multiplier:,life:,seed:,verbose,neofetch" + +parsed=$(getopt --options=$OPTS --longoptions=$LONGOPTS -- "$@") +eval set -- "${parsed[@]}" + +while true; do + case "$1" in + -h|--help) + flag_h=1 + shift + ;; + + -l|--live) + live=1 + shift + ;; + + -t|--time) + timeStep="$2" + shift 2 + ;; + + -w|--wait) + timeWait="$2" + shift 2 + ;; + + -g|--geometry) + termSize=0 + geometry="$2" + shift 2 + ;; + + -c|--leaf) + leafStrs="$2" + shift 2 + ;; + + -T|--termcolors) + termColors=1 + shift + ;; + + -m|--message) + flag_m=1 + message="$2" + shift 2 + ;; + + -b|--base) + baseType="$2" + shift 2 + ;; + + -i|--infinite) + infinite=1 + shift 1 + ;; + + -M|--multiplier) + multiplier="$2" + shift 2 + ;; + + -L|--life) + lifeStart="$2" + shift 2 + ;; + + -s|--seed) + RANDOM="$2" + shift 2 + ;; + + -v|--verbose) + verbose=1 + shift 1 + ;; + + -n|--neofetch) + nfetch=1 + shift 1 + ;; + + --) # end of arguments + shift + break + ;; + + *) + printf '%s\n' "error while parsing CLI options" + flag_h=1 + ;; + esac +done + +# ------ check input ------ + +# ensure integer values +if ! [ "$lifeStart" -eq "$lifeStart" 2> /dev/null ]; then + printf '%s\n' "--life ($lifeStart) invalid: must be an integer"; exit 1 + +elif ! [ "$multiplier" -eq "$multiplier" 2> /dev/null ]; then + printf '%s\n' "--multiplier ($multiplier) invalid: must be an integer"; exit 1 + +elif ! [ "$baseType" -eq "$baseType" 2> /dev/null ]; then + printf '%s\n' "--base ($baseType) invalid: must be an integer"; exit 1 + +# ensure ranges +elif [ "$baseType" -lt 0 ]; then + printf '%s\n' "--base ($baseType) invalid: out of range"; exit 1 + +elif [ "$lifeStart" -lt 1 ] || [ "$lifeStart" -gt 200 ]; then + printf '%s\n' "--life ($lifeStart) invalid: out of range"; exit 1 + +elif [ "$multiplier" -lt 0 ] || [ "$multiplier" -gt 20 ]; then + printf '%s\n' "--multiplier ($multiplier) invalid: out of range"; exit 1 + +elif [ "$seed" -lt 0 ] || [ "$seed" -gt 32767 ]; then + printf '%s\n' "--seed ($seed) invalid: out of range"; exit 1 + +# ensure floats are less than 0 +elif [ "$(printf '%s\n' "$timeStep < 0" | bc -l)" -eq 1 ]; then + printf '%s\n' "--timestep ($timeStep) invalid: out of range"; exit 1 + +elif [ "$(printf '%s\n' "$timeWait < 0" | bc -l)" -eq 1 ]; then + printf '%s\n' "--wait ($timeWait) invalid: out of range"; exit 1 +fi + +HELP="\ +Usage: bonsai [OPTIONS] + +bonsai.sh is a beautifully random bonsai tree generator. + +optional args: + -l, --live live mode + -t, --time TIME in live mode, minimum time in secs between + steps of growth [default: 0.03] + -i, --infinite infinite mode + -w, --wait TIME in infinite mode, time in secs between + tree generation [default: 4] + -n, --neofetch neofetch mode + -m, --message STR attach message next to the tree + -T, --termcolors use terminal colors + -g, --geometry X,Y set custom geometry + -b, --base INT ascii-art plant base to use, 0 is none + -c, --leaf STR1,STR2,STR3... list of strings randomly chosen for leaves + -M, --multiplier INT branch multiplier; higher -> more + branching (0-20) [default: 5] + -L, --life INT life; higher -> more growth (0-200) [default: 28] + -s, --seed INT seed random number generator (0-32767) + -v, --verbose print information each step of generation + -h, --help show help" + +if ((flag_h)); then + printf '%s\n' "$HELP" + exit 0 +fi + +shopt -s checkwinsize # allows variables $COLUMNS/$LINES to be used + +trap 'quit' SIGINT # respond to CTRL+C +trap 'setGeometry' WINCH # respond to window resize + +IFS=$'\n' # delimit by newline +((! nfetch)) && tabs 4 + +# define colors +if ((termColors)); then + LightBrown='\e[1;33m' + DarkBrown='\e[0;33m' + BrownGreen='\e[1;32m' + Green='\e[0;32m' + Gray='\e[1;30m' +elif ((nfetch)); then + LightBrown='${c1}' + DarkBrown='${c2}' + BrownGreen='${c3}' + Green='${c4}' + Gray='${c5}' +else + LightBrown='\e[38;5;172m' + DarkBrown='\e[38;5;130m' + BrownGreen='\e[38;5;142m' + Green='\e[38;5;106m' + Gray='\e[38;5;243m' +fi +R='\e[0m' + +# create ascii base in lines +case "$baseType" in + 1) + width=15 + art="\ +${Gray}:${Green}___________${DarkBrown}./~~\\.${Green}___________${Gray}: + \\ / + \\________________________/ + (_) (_)" + ;; + + 2) + width=7 + art="\ +${Gray}(${Green}---${DarkBrown}./~~\\.${Green}---${Gray}) + ( ) + (________)" + ;; + + 3) + width=15 + art="\ +${Gray}╓${Green}───────────${DarkBrown}╭╱⎨⏆╲╮${Green}───────────${Gray}╖ +║ ║ +╟────────────────────────────╢ +╟────────────────────────────╢ +╚════════════════════════════╝" + ;; + + *) art="" ;; +esac + +# get base height +baseHeight=0 +for line in $art; do + baseHeight=$(( baseHeight + 1 )) +done + +# create leafArray +declare -A leafArray +leafArrayLen=0 +# parse each string in comma-separated $leafStrs +for str in ${leafStrs//,/$'\n'}; do + + leafArray[$leafArrayLen,0]=${#str} # first item in sub-array is length + + # for character in string, add to the sub-array + for (( i=0; i < ${#str}; i++ )); do + leafArray[$leafArrayLen,$((i+1))]="${str:$i:1}" + done + leafArrayLen=$((leafArrayLen+1)) +done + +setGeometry() { + if ((nfetch)) && ((termSize)); then + geometry="$(tput cols),$(tput lines)" # geometry must use tput in this mode + elif ((termSize)); then + geometry="$COLUMNS,$LINES" # these vars automatically update + fi + cols="$(printf '%s' "$geometry" | cut -d ',' -f1)" # width; X + rows="$(printf '%s' "$geometry" | cut -d ',' -f2)" # height; Y + + rows=$((rows - baseHeight)) # so we don't grow a tree on top of the base +} + +init() { + IFS=$'\n' # delimit strings by newline + + # message processing + if ((flag_m)); then + declare -Ag gridMessage + + cols=$((cols - messageWidth - 8 )) # make room for the message to go on the right side + message="$(printf '%s\n' "$message" | fold -sw $messageWidth)" # wordwrap message, delimiting by spaces + + # get number of lines in the message + messageLineCount=0 + for line in $message; do + messageLineCount=$((messageLineCount + 1)) + done + + messageOffset=$((rows - messageLineCount - 7)) + + # put lines of message into a grid + index=$messageOffset + for line in $message; do + gridMessage[$index]="$line" + index=$((index + 1)) + done + fi + + # add spaces before base so that it's in the middle of the terminal + base="" + iter=1 + for line in $art; do + filler="" + for (( i=0; i <= (cols / 2 - width); i++)); do + filler+=" " + done + base+="${filler}${line}" + [ $iter -ne $baseHeight ] && base+='\n' + iter=$((iter+1)) + done + unset IFS # reset delimiter + + # declare vars + branches=0 + shoots=0 + + branchesMax=$((multiplier * 110)) + shootsMax=$multiplier + + # fill grid full of spaces + declare -Ag grid + for (( row=0; row <= rows; row++ )); do + listChanged[$row]=0 + for (( col=0; col < cols; col++ )); do + grid[$row,$col]=' ' + done + done + + if ((! nfetch)); then + stty -echo # don't echo stdin + printf '%b' '\e[?25l\e[?7l\e[2J' # hide cursor, disable line wrapping, clear screen and move to 0,0 + fi + + # setup temp file for caching times of each growth + mkdir -p /tmp/bonsai.sh + tmpFile="$(mktemp -p /tmp/bonsai.sh bonsai.sh.XXXXXXXX)" +} + +grow() { + local x=$((cols / 2)) # start halfway across the screen + local y="$rows" # start just above the base + branch "$x" "$y" trunk "$lifeStart" +} + +branch() { + # declarations + local x=$1 + local y=$2 + local type=$3 + local life=$4 + local dx=0 + local dy=0 + local chars=() + + + branches=$((branches + 1)) + + # as long as we're alive... + while [ "$life" -gt 0 ]; do + + life=$((life - 1)) # ensure life ends + + # set dy based on type + case $type in + shoot*) # trend horizontal/downward growth + case "$((RANDOM % 10))" in + [0-1]) dy=-1 ;; + [2-7]) dy=0 ;; + [8-9]) dy=1 ;; + esac + ;; + + dying) # discourage vertical growth + case "$((RANDOM % 10))" in + [0-1]) dy=-1 ;; + [2-8]) dy=0 ;; + [9-10]) dy=1 ;; + esac + ;; + + *) # grow up/not at all + dy=0 + [ "$life" -ne "$lifeStart" ] && [ $((RANDOM % 10)) -gt 2 ] && dy=-1 + ;; + esac + # if we're about to hit the ground, cut it off + [ "$dy" -gt 0 ] && [ "$y" -gt $(( rows - 1 )) ] && dy=0 + [ "$type" = "trunk" ] && [ "$life" -lt 4 ] && dy=0 + + # set dx based on type + case $type in + shootLeft) # tend left: dx=[-2,1] + case $(( RANDOM % 10 )) in + [0-1]) dx=-2 ;; + [2-5]) dx=-1 ;; + [6-8]) dx=0 ;; + [9]) dx=1 ;; + esac ;; + + shootRight) # tend right: dx=[-1,2] + case $(( RANDOM % 10 )) in + [0-1]) dx=2 ;; + [2-5]) dx=1 ;; + [6-8]) dx=0 ;; + [9]) dx=-1 ;; + esac ;; + + dying) # tend left/right: dx=[-3,3] + dx=$(( (RANDOM % 7) - 3)) ;; + + *) # tend equal: dx=[-1,1] + dx=$(( (RANDOM % 3) - 1)) ;; + + esac + + # re-branch upon conditions + if [ $branches -lt $branchesMax ]; then + + # branch is dead + if [ $life -lt 3 ]; then + branch "$x" "$y" dead "$life" + + # branch is dying and needs to branch into leaves + elif [ "$type" = trunk ] && [ "$life" -lt $((multiplier + 2)) ]; then + branch "$x" "$y" dying "$life" + + elif [[ $type = "shoot"* ]] && [ "$life" -lt $((multiplier + 2)) ]; then + branch "$x" "$y" dying "$life" + + # re-branch if: not close to the base AND (pass a chance test OR be a trunk, not have too many shoots already, and not be about to die) + elif [[ $type = trunk && $life -lt $((lifeStart - 8)) \ + && ( $(( RANDOM % (16 - multiplier) )) -eq 0 \ + || ($type = trunk && $(( life % 5 )) -eq 0 && $life -gt 5) ) ]]; then + + # if a trunk is splitting and not about to die, chance to create another trunk + if [ $((RANDOM % 3)) -eq 0 ] && [ $life -gt 7 ]; then + branch "$x" "$y" trunk "$life" + + elif [ "$shoots" -lt "$shootsMax" ]; then + + # give the shoot some life + tmpLife=$(( life + multiplier - 2 )) + [ $tmpLife -lt 0 ] && tmpLife=0 + + # first shoot is randomly directed + if [ $shoots -eq 0 ]; then + tmpType="shootLeft" + [ $((RANDOM % 2)) -eq 0 ] && tmpType="shootRight" + + # secondary shoots alternate from the first + else + case "$tmpType" in + shootLeft) # last shoot was left, shoot right + tmpType="shootRight" ;; + shootRight) # last shoot was right, shoot left + tmpType="shootLeft" ;; + esac + fi + branch "$x" "$y" "$tmpType" "$tmpLife" + shoots=$((shoots + 1)) + fi + fi + else # we're past max branches but want to branch + chars=('<->') + fi + + # implement dx,dy + x=$((x + dx)) + y=$((y + dy)) + + # choose color + case $type in + trunk|shoot*) + color=$DarkBrown + [ $(( RANDOM % 4 )) -eq 0 ] && color=$LightBrown + ;; + + dying) color=$BrownGreen ;; + + dead) color=$Green ;; + esac + + # choose branch character + case $type in + trunk) + if [ $dx -lt 0 ]; then + chars=('\\') + elif [ $dx -eq 0 ]; then + chars=('/' '|') + elif [ $dx -gt 0 ]; then + chars=('/') + fi + [ $dy -eq 0 ] && chars=('/' '~') # not growing + #[ $dy -lt 0 ] && chars=('/' '~') # growing + ;; + + # shoots tend to look horizontal + shootLeft) + case $dx in + [-3,-1]) chars=('\\' '|') ;; + [0]) chars=('/' '|') ;; + [1,3]) chars=('/') ;; + esac + #[ $dy -lt 0 ] && chars=('/' '~') # growing up + [ $dy -gt 0 ] && chars=('/') # growing down + [ $dy -eq 0 ] && chars=('\\' '_') # not growing + ;; + + shootRight) + case $dx in + [-3,-1]) chars=('\\' '|') ;; + [0]) chars=('/' '|') ;; + [1,3]) chars=('/') ;; + esac + #[ $dy -lt 0 ] && chars=('') # growing up + [ $dy -gt 0 ] && chars=('\\') # growing down + [ $dy -eq 0 ] && chars=('_' '/') # not growing + ;; + esac + + # randomly choose leaf character + if [ $life -lt 4 ]; then + chars=() + randIndex=$((RANDOM % leafArrayLen)) + + # add each char in our randomly chosen list to our chars + for (( i=0; i < ${leafArray[$randIndex,0]}; i++)); do + chars+=("${leafArray[$randIndex,$((i+1))]}") + done + fi + # [ $life -eq 0 ] && chars=('&' '&') # eh, maybe + + ((verbose)) && printf '%b\n' "$life:\\t$x, $y: $char" + + # add this/these character(s) to our grid + index=0 + for char in "${chars[@]}"; do + newX=$((x+index)) + grid[$y,$newX]="${color}${char}" + + # ensure we keep track of last column + [ ${y:-0} -gt 0 ] && [ -n "${listChanged[$y]}" ] && [ ${newX:-0} -gt ${listChanged[$y]} ] && listChanged[$y]=$newX + index=$((index+1)) + done + + # print what we have so far + if ((live)); then + ( time -p display ) 2>"$tmpFile" + elapsed="$(head "$tmpFile" -n 1 | awk '{print $2}' )" + # if this step took less than $stepTime, sleep until $stepTime is met + timeLeft="$(printf '%s\n' "$timeStep - $elapsed" | bc -l)" + [ "$(printf '%s\n' "($timeLeft) > 0" | bc -l)" -eq 1 ] && sleep "$timeLeft" + fi + done +} + +display() { + # parse grid for output + output="" + for (( row=0; row < rows; row++)); do + lineArray=() + + # only parse to the last known column with a char in it + for (( col=0; col <= listChanged[row]; col++ )); do + + ((live)) && printf '%b' '\e[0;0H' # move cursor to 00 + + # grab the character from our grid + lineArray["$col"]="${grid[$row,$col]}" + done + line="${lineArray[*]}" # combine array elements into a string + + if ((flag_m)) || ((nfetch)); then + line="${line%${line##*[^[:space:]]}}" # remove trailing whitespace and reset color + fi + + # add our message unless line is blank + ((flag_m)) && [ ! "$line" = "" ] && line+=' \t'"${R}${gridMessage[$row]}" + + IFS='' + output+="$line\\n" + done + + output+="$base" # add the ascii-art base we generated earlier + printf '%b' "$output" +} + +quit() { + if ((! nfetch)); then + stty echo # echo stdin + printf '%b\n' '\e[?25h\e[?7h'"${R}" # show cursor, enable line wrapping, reset colors + tabs 8 + else + printf '\n' # reset formatting, put cursor on next line + fi + exit 0 +} + +bonsai() { + setGeometry + init + grow + display +} + +main() { + bonsai + while ((infinite)); do + sleep "$timeWait" + bonsai + done +} + +main +quit diff --git a/home/.local/bin/fun/colorbars b/home/.local/bin/fun/colorbars new file mode 100755 index 0000000..4e3b8f7 --- /dev/null +++ b/home/.local/bin/fun/colorbars @@ -0,0 +1,38 @@ +#!/bin/sh +# +# colorbars - smpte color bars in sh +# http://git.io/colorbars + +echo + +for y in $(seq 0 13); do + printf %s ' ' + for color in 7 3 6 2 5 1 4; do + tput setab ${color} + printf %s ' ' + done + tput sgr0 + echo +done + +for y in 0 1; do + printf %s ' ' + for color in 4 0 5 0 6 0 7; do + tput setab ${color} + printf %s ' ' + done + tput sgr0 + echo +done + +for y in $(seq 0 4); do + printf %s ' ' + 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 + tput setab ${color} + printf %s ' ' + done + tput sgr0 + echo +done + +echo diff --git a/home/.local/bin/fun/colorbars-sm b/home/.local/bin/fun/colorbars-sm new file mode 100755 index 0000000..e8e0b9d --- /dev/null +++ b/home/.local/bin/fun/colorbars-sm @@ -0,0 +1,35 @@ +#!/bin/sh +echo + +# mini smpte color bars +for y in $(seq 0 6); do + printf %s ' ' + for color in 7 3 6 2 5 1 4; do + tput setab ${color} + printf %s ' ' + done + tput sgr0 + echo +done + +for y in 0 1; do + printf %s ' ' + for color in 4 0 5 0 6 0 7; do + tput setab ${color} + printf %s ' ' + done + tput sgr0 + echo +done + +for y in $(seq 0 2); do + printf %s ' ' + 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 + tput setab ${color} + printf %s ' ' + done + tput sgr0 + echo +done + +echo diff --git a/home/.local/bin/fun/colors b/home/.local/bin/fun/colors new file mode 100755 index 0000000..c8d527b --- /dev/null +++ b/home/.local/bin/fun/colors @@ -0,0 +1,13 @@ +#!/bin/bash + +xdef="$HOME/.Xdefaults" + +colors=( $( sed -re '/^!/d; /^$/d; /^#/d; s/(\*color)([0-9]):/\10\2:/g;' $xdef | grep 'color[01][0-9]:' | sort | sed 's/^.*: *//g' ) ) + +echo -e "\e[1;37m + Black Red Green Yellow Blue Magenta Cyan White +──────────────────────────────────────────────────────────────────────\e[0m" +for i in {0..7}; do echo -en "\e[$((30+$i))m ${colors[i]} \e[0m"; done +echo +for i in {8..15}; do echo -en "\e[1;$((22+$i))m ${colors[i]} \e[0m"; done +echo -e "\n" diff --git a/home/.local/bin/fun/colorscheme b/home/.local/bin/fun/colorscheme new file mode 100755 index 0000000..f2aa179 --- /dev/null +++ b/home/.local/bin/fun/colorscheme @@ -0,0 +1,27 @@ +#!/bin/bash +# +# This file echoes a bunch of color codes to the +# terminal to demonstrate what's available. Each +# line is the color code of one forground color, +# out of 17 (default + 16 escapes), followed by a +# test use of that color on all nine background +# colors (default + 8 escapes). +# + +T='niX' # The test text + +echo -e "\n 40m 41m 42m 43m\ + 44m 45m 46m 47m"; + +for FGs in ' m' ' 1m' ' 30m' '1;30m' ' 31m' '1;31m' ' 32m' \ + '1;32m' ' 33m' '1;33m' ' 34m' '1;34m' ' 35m' '1;35m' \ + ' 36m' '1;36m' ' 37m' '1;37m'; + do FG=${FGs// /} + echo -en " $FGs \033[$FG $T " + for BG in 40m 41m 42m 43m 44m 45m 46m 47m; + do echo -en "$EINS \033[$FG\033[$BG $T \033[0m"; + done + echo; +done +echo + diff --git a/home/.local/bin/fun/dna b/home/.local/bin/fun/dna new file mode 100755 index 0000000..a049e0b --- /dev/null +++ b/home/.local/bin/fun/dna @@ -0,0 +1,46 @@ +#!/bin/bash +# +# ANSI color scheme script by pfh +# +# Initializing mod by lolilolicon from Archlinux +# + +f=3 b=4 +for j in f b; do + for i in {0..7}; do + printf -v $j$i %b "\e[${!j}${i}m" + done +done +bld=$'\e[1m' +rst=$'\e[0m' +inv=$'\e[7m' + +cat << EOF + + ${f1} █-----${bld}█ ${rst}${f2} █-----${bld}█${rst} ${f3} █-----${bld}█${rst} ${f4} █-----${bld}█${rst} ${f5} █-----${bld}█${rst} ${f6} █-----${bld}█${rst} + ${f1} █---${bld}█${rst} ${f2} █---${bld}█${rst} ${f3} █---${bld}█${rst} ${f4} █---${bld}█${rst} ${f5} █---${bld}█${rst} ${f6} █---${bld}█${rst} + ${f1} █-${bld}█${rst} ${f2} █-${bld}█${rst} ${f3} █-${bld}█${rst} ${f4} █-${bld}█${rst} ${f5} █-${bld}█${rst} ${f6} █-${bld}█${rst} + ${f1} █${rst} ${f2} █${rst} ${f3} █${rst} ${f4} █${rst} ${f5} █${rst} ${f6} █${rst} + ${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} + ${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} + ${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} + ${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} + ${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} + ${f1}${bld} █${rst} ${f2}${bld} █${rst} ${f3}${bld}█${rst} ${f4}${bld} █${rst} ${f5}${bld} █${rst} ${f6}${bld} █${rst} + ${f1} █-${bld}█${rst} ${f2} █-${bld}█${rst} ${f3} █-${bld}█${rst} ${f4} █-${bld}█${rst} ${f5} █-${bld}█${rst} ${f6} █-${bld}█${rst} + ${f1} █---${bld}█${rst} ${f2} █---${bld}█${rst} ${f3} █---${bld}█${rst} ${f4} █---${bld}█${rst} ${f5} █---${bld}█${rst} ${f6} █---${bld}█${rst} + ${f1} █-----${bld}█ ${rst}${f2} █-----${bld}█${rst} ${f3} █-----${bld}█${rst} ${f4} █-----${bld}█${rst} ${f5} █-----${bld}█${rst} ${f6} █-----${bld}█${rst} + ${f1} █---${bld}█${rst} ${f2} █---${bld}█${rst} ${f3} █---${bld}█${rst} ${f4} █---${bld}█${rst} ${f5} █---${bld}█${rst} ${f6} █---${bld}█${rst} + ${f1} █-${bld}█${rst} ${f2} █-${bld}█${rst} ${f3} █-${bld}█${rst} ${f4} █-${bld}█${rst} ${f5} █-${bld}█${rst} ${f6} █-${bld}█${rst} + ${f1} █${rst} ${f2}█${rst} ${f3} █${rst} ${f4} █${rst} ${f5} █${rst} ${f6} █${rst} + ${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} + ${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} + ${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} + ${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} + ${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} + ${f1}${bld} █${rst} ${f2}${bld} █${rst} ${f3}${bld} █${rst} ${f4}${bld} █${rst} ${f5}${bld} █${rst} ${f6}${bld} █${rst} + ${f1} █-${bld}█${rst} ${f2} █-${bld}█${rst} ${f3} █-${bld}█${rst} ${f4} █-${bld}█${rst} ${f5} █-${bld}█${rst} ${f6} █-${bld}█${rst} + ${f1} █---${bld}█${rst} ${f2} █---${bld}█${rst} ${f3} █---${bld}█${rst} ${f4} █---${bld}█${rst} ${f5} █---${bld}█${rst} ${f6} █---${bld}█${rst} + ${f1} █-----${bld}█ ${rst}${f2} █-----${bld}█${rst} ${f3} █-----${bld}█${rst} ${f4} █-----${bld}█${rst} ${f5} █-----${bld}█${rst} ${f6} █-----${bld}█${rst} + +EOF \ No newline at end of file diff --git a/home/.local/bin/fun/ghosts b/home/.local/bin/fun/ghosts new file mode 100755 index 0000000..2cf1727 --- /dev/null +++ b/home/.local/bin/fun/ghosts @@ -0,0 +1,31 @@ +#!/bin/bash +# +# ANSI color scheme script by pfh +# +# Initializing mod by lolilolicon from Archlinux +# + +f=3 b=4 +for j in f b; do + for i in {0..7}; do + printf -v $j$i %b "\e[${!j}${i}m" + done +done +bld=$'\e[1m' +rst=$'\e[0m' +inv=$'\e[7m' +cat << EOF + +$f1 ▄▄▄ $f2 ▄▄▄ $f3 ▄▄▄ $f4 ▄▄▄ $f5 ▄▄▄ $f6 ▄▄▄ +$f1 ▀█▀██ ▄ $f2 ▀█▀██ ▄ $f3 ▀█▀██ ▄ $f4 ▀█▀██ ▄ $f5 ▀█▀██ ▄ $f6 ▀█▀██ ▄ +$f1 ▀▄██████▀ $f2 ▀▄██████▀ $f3 ▀▄██████▀ $f4 ▀▄██████▀ $f5 ▀▄██████▀ $f6 ▀▄██████▀ +$f1 ▀█████ $f2 ▀█████ $f3 ▀█████ $f4 ▀█████ $f5 ▀█████ $f6 ▀█████ +$f1 ▀▀▀▀▄ $f2 ▀▀▀▀▄ $f3 ▀▀▀▀▄ $f4 ▀▀▀▀▄ $f5 ▀▀▀▀▄ $f6 ▀▀▀▀▄ +$bld +$f1 ▄▄▄ $f2 ▄▄▄ $f3 ▄▄▄ $f4 ▄▄▄ $f5 ▄▄▄ $f6 ▄▄▄ +$f1 ▀█▀██ ▄ $f2 ▀█▀██ ▄ $f3 ▀█▀██ ▄ $f4 ▀█▀██ ▄ $f5 ▀█▀██ ▄ $f6 ▀█▀██ ▄ +$f1 ▀▄██████▀ $f2 ▀▄██████▀ $f3 ▀▄██████▀ $f4 ▀▄██████▀ $f5 ▀▄██████▀ $f6 ▀▄██████▀ +$f1 ▀█████ $f2 ▀█████ $f3 ▀█████ $f4 ▀█████ $f5 ▀█████ $f6 ▀█████ +$f1 ▀▀▀▀▄ $f2 ▀▀▀▀▄ $f3 ▀▀▀▀▄ $f4 ▀▀▀▀▄ $f5 ▀▀▀▀▄ $f6 ▀▀▀▀▄ +$rst +EOF \ No newline at end of file diff --git a/home/.local/bin/fun/metroid b/home/.local/bin/fun/metroid new file mode 100755 index 0000000..8995836 --- /dev/null +++ b/home/.local/bin/fun/metroid @@ -0,0 +1,114 @@ +#!/bin/sh +# +# metroid: a metroid ascii banner generator +# MMXVI xero (http://xero.nu) + +usage() { +printf "usage: `basename $0` \n\ + [-m --mini mini] \n\ + [-s --super super] \n\ + [-t --text text] \n\ + [-n --normal normal] \n\ + [-h --help help]\n" +} + +text() { + printf "\n .___.\n / @ \ \n \ @ @ /\n {'^'}\n\n" +} + +mini() { +cat << METROID + + ▄▄ ▀▀▀▀▀▀▀▀▀▀▀ ▄▄ + ▄ ▀▀▀▀          ▀▀▀ ▄ + ▄ ▀▀  ▀▀             ▀▀ ▄ +  ▀▀  ▀                  ▀▀  + ▄ ▀▀ ▀ ▀                ▀▀▀▀▀ ▄ + ▄     ▀                         ▄ +               ▀▀▀▀▀    ▀▀▀        +                             ▀▀▀  ▄ +  ▀        ▀▀▀▀▀▀▀▀▀▀▀▀▀  ▀  ▀      +   ▀▀▀         ▀   ▀      ▀▀        +  ▀▀▀▀    ▀▀   ▀   ▀   ▀▀    ▀▀▀▀   +    ▀▀▀▀ ▀▀▀▀▀▀     ▀▀▀▀▀▀ ▀▀▀▀     +▀▀▀▀  ▀▀▀▀  ▀▀▀     ▀▀▀  ▀▀▀▀  ▀▀▀▀ + ▀▀             ▀▀▀             ▀▀ +  ▀▀      ▀  ▀   ▀  ▀      ▀▀  + ▀ ▀        ▀▀▀▀▀        ▀ ▀ + ▀▀▀ ▀ ▀   ▀ ▀ ▀▀▀ + +METROID +} + +super() { +cat << METROID + + ▄▄▄▀▀▀▀▀▀▀▀▄▄▄ + ▄▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄▄ + ▄▀▀▀▀▀▀▀▀▀      ▀▀▀▀▀▀▀▀▀▄ + ▀▀▀▀ ▀▀▀▀    ▀▀    ▀▀▀▀ ▀▀▀▀ + ▀▀▀▀▀  ▀▀▀▀▀ ▀  ▀ ▀▀▀▀▀  ▀▀▀▀▀ + ▀ ▀▀▀▀▀ ▀▀▀ ▀▀▀▀▀▀ ▀▀▀ ▀▀▀▀▀ ▀  +▀▀▀▀▀▀  ▀▀▀▀ ▀▀▀▀▀▀ ▀▀▀▀  ▀▀▀▀▀▀ +▀  ▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀  ▀ +▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀  ▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀ + ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ + ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ +  ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀  + ▀▀▀▀▀▀  ▀▀▀ ▀▀▀  ▀▀▀▀▀▀ + ▀▀▀  ▀▀   ▀▀  ▀▀▀ + ▀▀▀▀ ▀▀▀▀ + ▀ ▀ ▀ ▀ + +METROID +} + +normal() { +cat << METROID + +  ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀  +  ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀  +  ▀▀▀▀▀▀                ▀▀▀▀▀▀  +  ▀▀▀▀    ▀▀                  ▀▀▀▀  +  ▀▀▀▀  ▀▀  ▀▀▀▀▀▀▀▀▀▀            ▀▀▀▀  +      ▀▀      ▀▀▀▀▀▀▀▀▀▀          ▀▀▀▀▀▀  +  ▀▀▀▀▀▀  ▀▀                      ▀▀▀▀      +        ▀▀          ▀▀▀▀▀▀              ▀▀▀▀  +  ▀▀▀▀  ▀▀          ▀▀▀▀▀▀▀▀                    +                    ▀▀    ▀▀      ▀▀▀▀          +                    ▀▀    ▀▀            ▀▀▀▀▀▀▀▀  + ▀▀▀▀    ▀▀▀▀  ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀  ▀▀▀▀▀▀      +     ▀▀▀▀▀▀▀▀▀▀▀▀  ▀▀▀▀▀▀▀▀▀▀▀▀  ▀▀▀▀  ▀▀          +     ▀▀▀▀            ▀▀    ▀▀                      +   ▀▀▀▀▀▀    ▀▀▀▀    ▀▀    ▀▀    ▀▀▀▀    ▀▀▀▀▀▀    +   ▀▀▀▀▀▀▀▀▀▀  ▀▀▀▀▀▀▀▀    ▀▀▀▀▀▀▀▀  ▀▀▀▀▀▀▀▀▀▀    +     ▀▀▀▀▀▀  ▀▀▀▀▀▀▀▀        ▀▀▀▀▀▀▀▀  ▀▀▀▀▀▀      + ▀▀▀▀    ▀▀▀▀▀▀  ▀▀▀▀        ▀▀▀▀  ▀▀▀▀▀▀    ▀▀▀▀  +  ▀▀▀▀        ▀▀▀▀  ▀▀▀▀▀▀▀▀  ▀▀▀▀        ▀▀▀▀  +      ▀▀ ▀▀ ▀▀  ▀▀        ▀▀  ▀▀ ▀▀ ▀▀      +  ▀▀▀▀       ▀▀  ▀▀    ▀▀  ▀▀       ▀▀▀▀  +  ▀▀▀▀     ▀▀   ▀▀▀▀   ▀▀     ▀▀▀▀  +  ▀▀   ▀▀▀▀   ▀▀▀▀   ▀▀  +  ▀▀   ▀▀  + +METROID +} + +case "$1" in + *-m|--mini|mini*) + mini + ;; + *-s|--super|super*) + super + ;; + *-n|--normal|normal) + normal + ;; + *-t|--text|text) + text + ;; + *) + text + usage + ;; +esac diff --git a/home/.local/bin/fun/pacman-colors b/home/.local/bin/fun/pacman-colors new file mode 100755 index 0000000..51697cc --- /dev/null +++ b/home/.local/bin/fun/pacman-colors @@ -0,0 +1,37 @@ +#!/bin/bash +# +# ANSI color scheme script featuring PACMAN +# by pfh +# +# Initializing procedure by lolilolicon +# + +f=3 b=4 +for j in f b; do + for i in {0..7}; do + printf -v $j$i %b "\e[${!j}${i}m" + done +done +bld=$'\e[1m' +rst=$'\e[0m' +inv=$'\e[7m' + + +cat << EOF + +$rst + $f3 ▄███████▄ $f1 ▄██████▄ $f2 ▄██████▄ $f4 ▄██████▄ $f5 ▄██████▄ $f6 ▄██████▄ + $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▄ + $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█ + $f3███████▄ $f7▀▀ ▀▀ ▀▀ $f1████████████ $f2████████████ $f4████████████ $f5████████████ $f6████████████ + $f3▀█████████▄▄ $f1██▀██▀▀██▀██ $f2██▀██▀▀██▀██ $f4██▀██▀▀██▀██ $f5██▀██▀▀██▀██ $f6██▀██▀▀██▀██ + $f3 ▀███████▀ $f1▀ ▀ ▀ ▀ $f2▀ ▀ ▀ ▀ $f4▀ ▀ ▀ ▀ $f5▀ ▀ ▀ ▀ $f6▀ ▀ ▀ ▀ +$bld + $f3 ▄███████▄ $f1 ▄██████▄ $f2 ▄██████▄ $f4 ▄██████▄ $f5 ▄██████▄ $f6 ▄██████▄ + $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▄ + $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█ + $f3███████▄ $f7▀▀ ▀▀ ▀▀ $f1████████████ $f2████████████ $f4████████████ $f5████████████ $f6████████████ + $f3▀█████████▄▄ $f1██▀██▀▀██▀██ $f2██▀██▀▀██▀██ $f4██▀██▀▀██▀██ $f5██▀██▀▀██▀██ $f6██▀██▀▀██▀██ + $f3 ▀███████▀ $f1▀ ▀ ▀ ▀ $f2▀ ▀ ▀ ▀ $f4▀ ▀ ▀ ▀ $f5▀ ▀ ▀ ▀ $f6▀ ▀ ▀ ▀ +$rst +EOF diff --git a/home/.local/bin/fun/pipes b/home/.local/bin/fun/pipes new file mode 100755 index 0000000..47c33ec --- /dev/null +++ b/home/.local/bin/fun/pipes @@ -0,0 +1,142 @@ +#!/usr/bin/env bash +# pipes.sh: Animated pipes terminal screensaver. +# Copyleft (ↄ) 2015 - Acidhub +# 2015 - Pipeseroni - http://github.com/pipeseroni +# 2014 - Yu-Jie Lin +# ???? - Mathew Simpson +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +VERSION=1.2 + +M=32768 +p=3 +f=75 s=13 r=2000 t=0 +w=$(tput cols) h=$(tput lines) +# ab -> idx = a*4 + b +# 0: up, 1: right, 2: down, 3: left +# 00 means going up , then going up -> ┃ +# 12 means going right, then going down -> ┓ +sets=( + "┃┏ ┓┛━┓ ┗┃┛┗ ┏━" # -t 0 "default" + "│╭ ╮╯─╮ ╰│╯╰ ╭─" # -t 1 "round" + "│┌ ┐┘─┐ └│┘└ ┌─" # -t 2 "weak" + "║╔ ╗╝═╗ ╚║╝╚ ╔═" # -t 3 "double" + "|+ ++-+ +|++ +-" # -t 4 "add/sub" + "|/ \/-\ \|/\ /-" # -t 5 "It' something" + ".. .... .... .." # -t 6 "dots" + ".o oo.o o.oo o." # -t 7 "dot-O" + "-\ /\|/ /-\/ \|" # -t 8 "railway" + "▓≡▓≡≡▓≡ ≡▓≡≡▓≡▓" # -t 9 "blocks" +) +v=() +RNDSTART=0 +BOLD=1 +NOCOLOR=0 + +OPTIND=1 +while getopts "p:t:f:s:r:RBChv" arg; do +case $arg in + p) ((p=(OPTARG>0)?OPTARG:p));; + t) + if [[ "$OPTARG" = c???????????????? ]]; then + V+=(${#sets[@]}) + sets+=("${OPTARG:1}") + else + ((OPTARG>=0 && OPTARG<${#sets[@]})) && V+=($OPTARG) + fi + ;; + f) ((f=(OPTARG>19 && OPTARG<101)?OPTARG:f));; + s) ((s=(OPTARG>4 && OPTARG<16 )?OPTARG:s));; + r) ((r=(OPTARG>=0)?OPTARG:r));; + R) RNDSTART=1;; + B) BOLD=0;; + C) NOCOLOR=1;; + h) echo -e "Usage: $(basename $0) [OPTION]..." + echo -e "Animated pipes terminal screensaver.\n" + echo -e " -p [1-?]\tnumber of pipes (D=3)." + echo -e " -t [0-$((${#sets[@]} - 1))]\ttype of pipes, can be used more than once (D=0)." + echo -e " -t c[16 chars]\tcustom type of pipes." + echo -e " -f [20-100]\tframerate (D=75)." + echo -e " -s [5-15]\tprobability of a straight fitting (D=13)." + echo -e " -r LIMIT\treset after x characters, 0 if no limit (D=2000)." + echo -e " -R \t\trandom starting point." + echo -e " -B \t\tno bold effect." + echo -e " -C \t\tno color." + echo -e " -h\t\thelp (this screen)." + echo -e " -v\t\tprint version number.\n" + exit 0;; + v) echo "$(basename -- "$0") $VERSION" + exit 0 + esac +done + +# set default values if not by options +((${#V[@]})) || V=(0) + +cleanup() { + # clear up standard input + read -t 0.001 && cat /dev/null + + # terminal has no smcup and rmcup capabilities + ((FORCE_RESET)) && reset && exit 0 + + tput rmcup + tput cnorm + stty echo + ((NOCOLOR)) && echo -ne '\e[0m' + exit 0 +} +trap cleanup HUP TERM +trap 'break 2' INT + +for (( i=1; i<=p; i++ )); do + c[i]=$((i%8)) n[i]=0 l[i]=0 + ((x[i]=RNDSTART==1?RANDOM*w/32768:w/2)) + ((y[i]=RNDSTART==1?RANDOM*h/32768:h/2)) + v[i]=${V[${#V[@]} * RANDOM / M]} +done + +stty -echo +tput smcup || FORCE_RESET=1 +tput civis +tput clear +# any key press exits the loop and this script +while REPLY=; read -t 0.0$((1000/f)) -n 1; [[ -z $REPLY ]] ; do + for (( i=1; i<=p; i++ )); do + # New position: + ((${l[i]}%2)) && ((x[i]+=-${l[i]}+2,1)) || ((y[i]+=${l[i]}-1)) + + # Loop on edges (change color on loop): + ((${x[i]}>w||${x[i]}<0||${y[i]}>h||${y[i]}<0)) && ((c[i]=RANDOM%8, v[i]=V[${#V[@]}*RANDOM/M])) + ((x[i]=(x[i]+w)%w)) + ((y[i]=(y[i]+h)%h)) + + # New random direction: + ((n[i]=RANDOM%s-1)) + ((n[i]=(${n[i]}>1||${n[i]}==0)?${l[i]}:${l[i]}+${n[i]})) + ((n[i]=(${n[i]}<0)?3:${n[i]}%4)) + + # Print: + tput cup ${y[i]} ${x[i]} + echo -ne "\e[${BOLD}m" + [[ $NOCOLOR == 0 ]] && echo -ne "\e[3${c[i]}m" + echo -n "${sets[v[i]]:l[i]*4+n[i]:1}" + l[i]=${n[i]} + done + ((r>0 && t*p>=r)) && tput reset && tput civis && t=0 || ((t++)) +done + +cleanup diff --git a/home/.local/bin/fun/pipesx b/home/.local/bin/fun/pipesx new file mode 100755 index 0000000..2397b56 --- /dev/null +++ b/home/.local/bin/fun/pipesx @@ -0,0 +1,207 @@ +#!/bin/bash +# Animated pipes.sh terminal screensaver at an angle. +# Copyright (c) 2013-2015 Yu-Jie Lin +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +# Website: https://github.com/pipeseroni/pipesX.sh + +VERSION=1.1.0 + +W=$(tput cols) H=$(tput lines) +# maximal random value + 1 +M=32768 + +SETS=('╱╲' '/\' '..' 'oo' '\/') +COLORS=(31 32 33 34 35 36 37) + +# default values +N=1 +T=() +I=0.05 +P=25 +R=$((W * H / 4)) + +HELP="Usage: $(basename $0) [OPTIONS] +Animated pipes.sh terminal screensaver at an angle. + +Options: + + -n [1-] number of pipes. (Default: $N) + -t [0-$((${#SETS[@]} - 1))] types of pipes, can be used more than once. (Default: $T) + -t c[2chs] custom type of pipes. + -i [float] piping interval or maze generation interval. (Default: $I) + -P [0-100] probability of a turning pipe or of \\ in maze generation. (Default: $P) + -r [LIMIT] reset after x characters, 0 if no limit. (Default: $R) + -R random starting point. + -C no color. + -X maze generation. + -h this help message. + -v print version number. +" + +while getopts "n:t:i:P:r:RCXhv" arg; do + case $arg in + n) + ((N = OPTARG > 0 ? OPTARG : N)) + ;; + t) + if [[ "$OPTARG" = c?? ]]; then + T+=(${#SETS[@]}) + SETS+=("${OPTARG:1}") + else + T+=($(((OPTARG >= 0 && OPTARG < ${#SETS[@]}) ? OPTARG : T))) + fi + ;; + i) + I=$OPTARG + ;; + P) + ((P = (OPTARG >= 0 && OPTARG <= 100) ? OPTARG : P)) + ;; + r) + ((R = OPTARG >= 0 ? OPTARG : R)) + ;; + R) + RNDSTART=1 + ;; + C) + NOCOLOR=1 + ;; + X) + MAZE=1 + ;; + h) + echo -e "$HELP" + exit 0 + ;; + v) + echo "$(basename -- "$0") $VERSION" + exit 0 + esac +done + +# set to default values if not by options +((${#T[@]})) || T=(0) + +do_exit() { + # clear up standard input + read -t 0.001 && cat /dev/null + + # terminal has no smcup and rmcup capabilities + ((FORCE_RESET)) && reset && exit 0 + + tput rmcup + tput cnorm + stty echo + ((NOCOLOR)) && echo -ne '\e[0m' + exit 0 + } +trap do_exit HUP TERM +trap 'break 2' INT + +# No echo stdin and hide the cursor +stty -echo +tput smcup || FORCE_RESET=1 +tput civis +tput clear + +# maze geneartion +while [[ $MAZE ]] && clear; do + [[ $NOCOLOR ]] || echo -ne "\e[1;${COLORS[${#COLORS[@]} * RANDOM / M]}m" + for ((i = 0; i < W * H; i++ )); do + echo -ne ${SETS[T]:100 * RANDOM / M < P:1} + done + read -t $I -n 1 && [[ $REPLY =~ q|Q ]] && do_exit +done + +# initialze values +for ((n = 0; n < N; n++)); do + ((X[n] = RNDSTART ? (W + 2) * RANDOM / M : W / 2)) + ((Y[n] = RNDSTART ? (H + 2) * RANDOM / M : H / 2)) + D[n]=$((4 * RANDOM / M)) + C[n]=${COLORS[${#COLORS[@]} * RANDOM / M]} + t[n]=${T[${#T[@]} * RANDOM / M]} +done + +clear +while REPLY=; read -t $I -n 1; [[ -z $REPLY ]] ; do + for ((n = 0; n < N; n++, CC = 0)); do + x=${X[n]} y=${Y[n]} + d=${D[n]} c=${C[n]} + + # calculate new direction `d` + # 1 0 + # \/ 4 directions 0 to 3 + # /\ + # 2 3 + # valid directions: d: dd', d' is the new direction + # d + # 0: / 00 \ 01 03 + # / / /\ + # 1: / 10 \ 11 12 + # \ \ /\ + # 2: \/ 21 / 22 / 23 + # / \ + # 3: \/ 30 \ 32 \ 33 + # / \ + ((d = (100 * RANDOM / M) < P ? ((d + 1) + 2 * (RANDOM % 2)) % 4 : d)) + ((e = (d + 1) % 4)) + + # calculate new position + # d' x' y' + # 0: x+1 y-1 + # 1: x-1 y-1 + # 2: x-1 y+1 + # 3: x+1 y+1 + ((xn = e < 2 ? x + 1 : x - 1)) + ((yn = d < 2 ? y - 1 : y + 1)) + + # adjust position and change color? + ((d < 2 && y == 0)) && ((yn--, CC=1)) + ((e > 1 && x == 0)) && ((xn--, CC=1)) + ((d > 1 && y == H)) && ((yn++, CC=1)) + ((e < 2 && x == W)) && ((xn++, CC=1)) + ((CC)) && c=${COLORS[${#COLORS[@]} * RANDOM / M]} + ((CC)) && t[n]=${T[${#T[@]} * RANDOM / M]} + + # warp pipe + ((xn = (xn + W + 1) % (W + 1))) + ((yn = (yn + H + 1) % (H + 1))) + + # calculate position in terminal + # d' xt yt + # 0: x' y'+1 + # 1: x'+1 y'+1 + # 2: x'+1 y' + # 3: x' y' + ((xt = e < 2 ? xn : xn + 1)) + ((yt = d < 2 ? yn + 1 : yn)) + + echo -ne "\e[${yt};${xt}H" + [[ $NOCOLOR ]] || echo -ne "\e[1;${c}m" + echo -n "${SETS[t[n]]:d%2:1}" + + X[n]=$xn Y[n]=$yn + D[n]=$d C[n]=$c + done + ((R)) && ((r += N, r >= R)) && r=0 && clear +done + +do_exit diff --git a/home/.local/bin/fun/rain b/home/.local/bin/fun/rain new file mode 100755 index 0000000..8a8d8f6 --- /dev/null +++ b/home/.local/bin/fun/rain @@ -0,0 +1,100 @@ +#!/bin/bash +RAINS=("|" "│" "┃" "┆" "┇" "┊" "┋" "╽" "╿") +COLORS=("\e[37m" "\e[37;1m") +# More from 256 color mode +for i in {244..255}; do + COLORS=("${COLORS[@]}" "\e[38;5;${i}m") +done +NRAINS=${#RAINS[@]} +NCOLORS=${#COLORS[@]} +NUM_RAIN_METADATA=5 + + +sigwinch() { + TERM_WIDTH=$(tput cols) + TERM_HEIGHT=$(tput lines) + STEP_DURATION=0.025 + ((MAX_RAINS = TERM_WIDTH * TERM_HEIGHT / 4)) + ((MAX_RAIN_LENGTH = TERM_HEIGHT < 10 ? 1 : TERM_HEIGHT / 10)) + # In percentage + ((NEW_RAIN_ODD = TERM_HEIGHT > 50 ? 100 : TERM_HEIGHT * 2)) + ((NEW_RAIN_ODD = NEW_RAIN_ODD * 75 / 100)) + ((FALLING_ODD = TERM_HEIGHT > 25 ? 100 : TERM_HEIGHT * 4)) + ((FALLING_ODD = FALLING_ODD * 90 / 100)) + } + +do_exit() { + echo -ne "\e[${TERM_HEIGHT};1H\e[0K" + + # Show cursor and echo stdin + echo -ne "\e[?25h" + stty echo + exit 0 + } + +do_render() { + # Clean screen first + for ((idx = 0; idx < num_rains * NUM_RAIN_METADATA; idx += NUM_RAIN_METADATA)); do + X=${rains[idx]} + Y=${rains[idx + 1]} + LENGTH=${rains[idx + 4]} + for ((y = Y; y < Y + LENGTH; y++)); do + (( y < 1 || y > TERM_HEIGHT )) && continue + echo -ne "\e[${y};${X}H " + done + done + + for ((idx = 0; idx < num_rains * NUM_RAIN_METADATA; idx += NUM_RAIN_METADATA)); do + if ((100 * RANDOM / 32768 < FALLING_ODD)); then + # Falling + if ((++rains[idx + 1] > TERM_HEIGHT)); then + # Out of screen, bye sweet <3 + rains=("${rains[@]:0:idx}" + "${rains[@]:idx+NUM_RAIN_METADATA:num_rains*NUM_RAIN_METADATA}") + ((num_rains--)) + continue + fi + fi + X=${rains[idx]} + Y=${rains[idx + 1]} + RAIN=${rains[idx + 2]} + COLOR=${rains[idx + 3]} + LENGTH=${rains[idx + 4]} + for ((y = Y; y < Y + LENGTH; y++)); do + (( y < 1 || y > TERM_HEIGHT )) && continue + echo -ne "\e[${y};${X}H${COLOR}${RAIN}" + done + done + } + +trap do_exit TERM INT +trap sigwinch WINCH +# No echo stdin and hide the cursor +stty -echo +echo -ne "\e[?25l" + +echo -ne "\e[2J" +rains=() +sigwinch +while :; do + read -n 1 -t $STEP_DURATION ch + case "$ch" in + q|Q) + do_exit + ;; + esac + + if ((num_rains < MAX_RAINS)) && ((100 * RANDOM / 32768 < NEW_RAIN_ODD)); then + # Need new |, 1-based + RAIN="${RAINS[NRAINS * RANDOM / 32768]}" + COLOR="${COLORS[NCOLORS * RANDOM / 32768]}" + LENGTH=$((MAX_RAIN_LENGTH * RANDOM / 32768 + 1)) + X=$((TERM_WIDTH * RANDOM / 32768 + 1)) + Y=$((1 - LENGTH)) + rains=("${rains[@]}" "$X" "$Y" "$RAIN" "$COLOR" "$LENGTH") + ((num_rains++)) + fi + + # Let rain fall! + do_render +done \ No newline at end of file diff --git a/home/.local/bin/fun/slendy b/home/.local/bin/fun/slendy new file mode 100755 index 0000000..766e06c --- /dev/null +++ b/home/.local/bin/fun/slendy @@ -0,0 +1,35 @@ +#!/bin/sh + +initializeANSI() +{ + esc="" + + blackf="${esc}[30m"; redf="${esc}[31m"; greenf="${esc}[32m" + yellowf="${esc}[33m" bluef="${esc}[34m"; purplef="${esc}[35m" + cyanf="${esc}[36m"; whitef="${esc}[37m" + + blackb="${esc}[40m"; redb="${esc}[41m"; greenb="${esc}[42m" + yellowb="${esc}[43m" blueb="${esc}[44m"; purpleb="${esc}[45m" + cyanb="${esc}[46m"; whiteb="${esc}[47m" + + boldon="${esc}[1m"; boldoff="${esc}[22m" + italicson="${esc}[3m"; italicsoff="${esc}[23m" + ulon="${esc}[4m"; uloff="${esc}[24m" + invon="${esc}[7m"; invoff="${esc}[27m" + + reset="${esc}[0m" +} + +initializeANSI + +cat << EOF + + ${reset}${blackf}| | | | |${reset} + ${redf}█ █${reset} ${blackf}|${reset} ${greenf}█ █${reset} ${blackf}|${reset} ${yellowf}█ █${reset} ${blackf}|${reset} ${bluef}█ █${reset} ${blackf}|${reset} ${purplef}█ █${reset} ${blackf}|${reset} ${cyanf}█ █${reset} + ${redf}███████${reset} ${blackf}|${reset} ${greenf}███████${reset} ${blackf}|${reset} ${yellowf}███████${reset} ${blackf}|${reset} ${bluef}███████${reset} ${blackf}|${reset} ${purplef}███████${reset} ${blackf}|${reset} ${cyanf}███████${reset} + ${redf}███${boldon}${redb}██${reset}${redf}█${boldon}${redb}██${reset}${redf}███${reset} ${blackf}|${reset} ${greenf}███${boldon}${greenb}██${reset}${greenf}█${boldon}${greenb}██${reset}${greenf}███${reset} ${blackf}|${reset} ${yellowf}███${boldon}${yellowb}██${reset}${yellowf}█${boldon}${yellowb}██${reset}${yellowf}███${reset} ${blackf}|${reset} ${bluef}███${boldon}${blueb}██${reset}${bluef}█${boldon}${blueb}██${reset}${bluef}███${reset} ${blackf}|${reset} ${purplef}███${boldon}${purpleb}██${reset}${purplef}█${boldon}${purpleb}██${reset}${purplef}███${reset} ${blackf}|${reset} ${cyanf}███${boldon}${cyanb}██${reset}${cyanf}█${boldon}${cyanb}██${reset}${cyanf}███${reset} + ${redf}████${boldon}${redb}█${reset}${redf}████${reset} ${blackf}|${reset} ${greenf}████${boldon}${greenb}█${reset}${greenf}████${reset} ${blackf}|${reset} ${yellowf}████${boldon}${yellowb}█${reset}${yellowf}████${reset} ${blackf}|${reset} ${bluef}████${boldon}${blueb}█${reset}${bluef}████${reset} ${blackf}|${reset} ${purplef}████${boldon}${purpleb}█${reset}${purplef}████${reset} ${blackf}|${reset} ${cyanf}████${boldon}${cyanb}█${reset}${cyanf}████${reset} + ${redf}█ █ ${boldon}█${reset} ${redf}█ █${reset} ${blackf}|${reset} ${greenf}█ █ ${boldon}█${reset} ${greenf}█ █${reset} ${blackf}|${reset} ${yellowf}█ █ ${boldon}█${reset} ${yellowf}█ █${reset} ${blackf}|${reset} ${bluef}█ █ ${boldon}█${reset} ${bluef}█ █${reset} ${blackf}|${reset} ${purplef}█ █ ${boldon}█${reset} ${purplef}█ █${reset} ${blackf}|${reset} ${cyanf}█ █ ${boldon}█${reset} ${cyanf}█ █${reset} + ${redf}█ █${reset} ${blackf}|${reset} ${greenf}█ █${reset} ${blackf}|${reset} ${yellowf}█ █${reset} ${blackf}|${reset} ${bluef}█ █${reset} ${blackf}|${reset} ${purplef}█ █${reset} ${blackf}|${reset} ${cyanf}█ █${reset} + ${blackf}| | | | |${reset} +EOF \ No newline at end of file diff --git a/home/.local/bin/fun/testfonts b/home/.local/bin/fun/testfonts new file mode 100755 index 0000000..b55b629 --- /dev/null +++ b/home/.local/bin/fun/testfonts @@ -0,0 +1,40 @@ +#!/bin/sh + +# File: fonttest.textart +# Description: Fonts testing +# Author: NNB +# └─ https://github.com/NNBnh +# URL: https://github.com/NNBnh/nnbs-text-art/blob/main/other/fonttest.textart +# License: GPLv3 + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +# Values +TEXT="${1:-abcd efg hijk lmno pqrs tuv wxyz\nABCD EFG HIJK LMNO PQRS TUV WXYZ\n 1234567890 ,./\\;'[]-=\`\n !@#\$%%^&*() <>?|:\"\{\}_+~}" +STYLES="${2:-normal bold italic}" + +# Start +for style in $STYLES; do + case "$style" in + 'normal') print="$print${print:+\n}\033[0m$TEXT\033[0m" ;; + 'bold') print="$print${print:+\n}\033[1m$TEXT\033[0m" ;; + 'italic') print="$print${print:+\n}\033[3m$TEXT\033[0m" ;; + esac +done + +echo -e "\n$print\n" + + +exit 0 diff --git a/home/.local/bin/fun/unix b/home/.local/bin/fun/unix new file mode 100755 index 0000000..a9fb96e --- /dev/null +++ b/home/.local/bin/fun/unix @@ -0,0 +1,26 @@ +#!/bin/sh + +#original artwork by http://www.sanderfocus.nl/#/portfolio/tech-heroes +#converted to shell by #nixers @ irc.unix.chat + +cat << 'eof' + ,_ ,_==▄▂ + , ▂▃▄▄▅▅▅▂▅¾. / / + ▄▆<´ "»▓▓▓%\ / / / / + ,▅7" ´>▓▓▓% / / > / >/% + ▐¶▓ ,»▓▓¾´ /> %/%// / / + ▓▃▅▅▅▃,,▄▅▅▅Æ\// ///>// />/ / + V║«¼.;→ ║<«.,`=// />//%/% / / + //╠<´ -²,)(▓~"-╝/¾/ %/>/ /> + / / / ▐% -./▄▃▄▅▐, /7//;//% / / + / ////`▌▐ %zWv xX▓▇▌//&;% / / + / / / %//%/¾½´▌▃▄▄▄▄▃▃▐¶\/& / + </ /)VY>7; \_ UNIX IS VERY SIMPLE IT JUST NEEDS A + / /</ //<///<_/%\▓ V%W%£)XY _/%‾\_, GENIUS TO UNDERSTAND ITS SIMPLICITY + / / //%/_,=--^/%/%%\¾%¶%%} /%%%%%%;\, + %/< /_/ %%%%%;X%%\%%;, _/%%%;, \ + / / %%%%%%;, \%%l%%;// _/%;, dmr + / %%%;, <;\-=-/ / + ;, l +eof diff --git a/home/.local/bin/hello.sh b/home/.local/bin/hello.sh new file mode 100755 index 0000000..58249f9 --- /dev/null +++ b/home/.local/bin/hello.sh @@ -0,0 +1,32 @@ +#!/usr/bin/sh + +NAME="o0xjack" +APPNAME=609 + +# Set timezone to Asia/Kathmandu +timedatectl set-timezone Asia/Kathmandu + +while true ; do + + datey=$(date +"%I %p") + + if [[ "$datey" == "12 AM" || "$datey" == "1 AM" || "$datey" == "2 AM" ]] ; then + dunstify -i /usr/share/icons/Papirus-Dark/48x48/emotes/face-devilish.svg "Demons are watching you..." -u low -a $APPNAME + elif [[ "$datey" == "03 AM" || "$datey" == "04 AM" || "$datey" == "05 AM" || "$datey" == "06 AM" || "$datey" == "07 AM" || "$datey" == "08 AM" ]] ; then + dunstify -i /usr/share/icons/Papirus-Dark/48x48/emotes/emote-love.svg "Good Morning" "$NAME!" -u low -a $APPNAME + elif [[ "$datey" == "09 AM" || "$datey" == "10 AM" || "$datey" == "11 AM" ]] ; then + dunstify -i /usr/share/icons/Papirus-Dark/48x48/emotes/emote-love.svg "Good Morning" "$NAME!" -u low -a $APPNAME + elif [[ "$datey" == "12 PM" || "$datey" == "01 PM" || "$datey" == "02 PM" || "$datey" == "03 PM" || "$datey" == "04 PM" || "$datey" == "05 PM" ]] ; then + dunstify -i /usr/share/icons/Papirus-Dark/48x48/emotes/emote-love.svg "Good Afternoon" "$NAME!" -u low -a $APPNAME + elif [[ "$datey" == "06 PM" || "$datey" == "07 PM" ]] ; then + dunstify -i /usr/share/icons/Papirus-Dark/48x48/emotes/emote-love.svg "Good Evening" "$NAME!" -u low -a $APPNAME + elif [[ "$datey" == "11 PM" || "$datey" == "12 AM" ]] ; then + dunstify -i /usr/share/icons/Papirus-Dark/48x48/emotes/face-devilish.svg "Demons are watching you..." -u low -a $APPNAME + elif [[ "$datey" == "10PM" ]]; then + dunstify -i /usr/share/icons/Papirus-Dark/48x48/emotes/emote-love.svg "Good Night" "$NAME!" -u low -a $APPNAME + elif [[ "$datey" == "08 PM" || "$datey" == "09 PM" ]]; then + dunstify -i /usr/share/icons/Papirus-Dark/48x48/emotes/emote-love.svg "Nighty" "$NAME!" -u low -a $APPNAME + fi + sleep 3600 + +done diff --git a/home/.local/bin/sysfetch b/home/.local/bin/sysfetch new file mode 100755 index 0000000..fead535 --- /dev/null +++ b/home/.local/bin/sysfetch @@ -0,0 +1,167 @@ + + +#!/usr/bin/env bash + +# sysinfo: A sort of custom script +# Thanks to u/x_ero for his sysinfo script +# Also thanks to mysterious person for their fetch script; allowing for center padding + +# color escapes +BLK="\e[30m" +RED="\e[31m" +GRN="\e[32m" +YLW="\e[33m" +BLU="\e[34m" +PUR="\e[35m" +CYN="\e[36m" +WHT="\e[37m" +GRY="\e[90;1m" +RST="\e[0m" +BLD="\033[1m" + +PBLK=$(printf "%b" "\x1b[38;2;58;58;58m") +PRED=$(printf "%b" "\e[31m") +PGRN=$(printf "%b" "\e[32m") +PYLW=$(printf "%b" "\e[33m") +PBLU=$(printf "%b" "\e[34m") +PPUR=$(printf "%b" "\e[35m") +PCYN=$(printf "%b" "\e[36m") +PWHT=$(printf "%b" "\e[37m") +PGRY=$(printf "%b" "\e[90;1m") +PRST=$(printf "%b" "\e[0m") +PBLD=$(printf "%b" "\033[1m") + +# vars +#FULL=▓ +#EMPTY=░ +FULL=━ +EMPTY=━ +#FULL=─ +#FULL=┅ +#EMPTY=┄ + +name=$USER +host=$(uname -n) +distro=$(uname -o | awk -F '"' '/PRETTY_NAME/ { print $2 }' /etc/os-release) +wm="$(xprop -id $(xprop -root -notype | awk '$1=="_NET_SUPPORTING_WM_CHECK:"{print $5}') -notype -f _NET_WM_NAME 8t | grep "WM_NAME" | cut -f2 -d \")" + +get_pkg_count() { + package_managers=('xbps-install' 'apk' 'apt' 'pacman' 'nix' 'dnf' 'rpm' 'emerge') + for package_manager in ${package_managers[@]}; do + if command -v $package_manager 2>/dev/null>&2; then + case "$package_manager" in + xbps-install ) xbps-query -l | wc -l ;; + apk ) apk search | wc -l ;; + apt ) apt list --installed 2>/dev/null | wc -l ;; + pacman ) pacman -Q | wc -l ;; + nix ) nix-env -qa --installed '*' | wc -l ;; + dnf ) dnf list installed | wc -l ;; + rpm ) rpm -qa | wc -l ;; + emerge ) qlist -I | wc -l ;; + esac + + # if a package manager is found return from the function + return + fi + done + echo 'Unknown' +} + +storage=$(df -h / | awk '/^\//{print $3}') +term=$(ps -o sid= -p "$$" | xargs ps -o ppid= -p | xargs ps -o comm= -p) +uptm=$(uptime -p | sed -e 's/hour/hr/' -e 's/hours/hrs/' -e 's/minutes/mins/' -e 's/minute/min/' -e 's/up //') +#uptm=$(uptime -p) + +#Cleanup first +clear + +# find the center of the screen +COL=$(tput cols) +ROW=$(tput lines) +# ((PADY = ROW / 2 - 10 - 22 / 2)) +# ((PADX = COL / 2 - 34 / 2)) +PADY=2 +PADX=2 + +for ((i = 0; i < PADX; ++i)); do + PADC="$PADC " +done + +for ((i = 0; i < PADY; ++i)); do + PADR="$PADR\n" +done + +# vertical padding +printf "%b" "$PADR" +printf "\n" + +PADXX=$((PADX - 3)) +for ((i = 0; i < PADXX; ++i)); do + PADCC="$PADCC " +done + +# Ascii art arms +cat < + + + diff --git a/home/.local/share/asciiart/blocks1 b/home/.local/share/asciiart/blocks1 new file mode 100755 index 0000000..785fe0c --- /dev/null +++ b/home/.local/share/asciiart/blocks1 @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +pcs() { for i in {0..7}; do echo -en "\e[${1}$((30+$i))m \u2588\u2588 \e[0m"; done; } +pcsbright() { for i in {0..7}; do echo -en "\e[${1}$((90+$i))m \u2588\u2588 \e[0m"; done; } +printf "\n%s\n%s\n\n" "$(pcs)" "$(pcsbright '1;')" + diff --git a/home/.local/share/asciiart/pinguco b/home/.local/share/asciiart/pinguco new file mode 100755 index 0000000..c145d54 --- /dev/null +++ b/home/.local/share/asciiart/pinguco @@ -0,0 +1,39 @@ +#!/bin/sh +# Author: lantlos + +initializeANSI() +{ + esc="" + + blackf="${esc}[30m"; redf="${esc}[31m"; greenf="${esc}[32m" + yellowf="${esc}[33m" bluef="${esc}[34m"; purplef="${esc}[35m" + cyanf="${esc}[36m"; whitef="${esc}[37m" + + blackb="${esc}[40m"; redb="${esc}[41m"; greenb="${esc}[42m" + yellowb="${esc}[43m" blueb="${esc}[44m"; purpleb="${esc}[45m" + cyanb="${esc}[46m"; whiteb="${esc}[47m" + + boldon="${esc}[1m"; boldoff="${esc}[22m" + italicson="${esc}[3m"; italicsoff="${esc}[23m" + ulon="${esc}[4m"; uloff="${esc}[24m" + invon="${esc}[7m"; invoff="${esc}[27m" + + reset="${esc}[0m" +} + +initializeANSI + +cat << EOF + + ${boldon}${blackf} ██████${reset} + ${boldon}${blackf}██${reset}██${reset}${bluef}██${reset}${boldon}${blackf}██${reset}${bluef}██${reset} + ${boldon}${blackf}██${reset}██${bluef}██${reset}${boldon}${blackf}██${reset}${bluef}██${reset} + ${boldon}${blackf}██████${reset}${purplef}██████${reset} + ${boldon}${blackf}████${reset}████${boldon}${blackf}██${reset} + ${boldon}${blackf}████${reset}████████${boldon}${blackf}██${reset} + ${boldon}${blackf}████${reset}████████${boldon}${blackf}██${reset} + ${boldon}${blackf}████${reset}████████${boldon}${blackf}██${reset} + ${boldon}${blackf}████${reset}████${boldon}${blackf}██${reset} + ${boldon}${blackf}███${reset}${purplef}███ ████${reset} + +EOF diff --git a/home/.local/share/asciiart/unix b/home/.local/share/asciiart/unix new file mode 100755 index 0000000..9baa3ff --- /dev/null +++ b/home/.local/share/asciiart/unix @@ -0,0 +1,25 @@ +#!/bin/sh +#original artwork by http://www.sanderfocus.nl/#/portfolio/tech-heroes +#converted to shell by #nixers @ irc.unix.chat + +cat << 'eof' + ,_ ,_==▄▂ + , ▂▃▄▄▅▅▅▂▅¾. / / + ▄▆<´ "»▓▓▓%\ / / / / + ,▅7" ´>▓▓▓% / / > / >/% + ▐¶▓ ,»▓▓¾´ /> %/%// / / + ▓▃▅▅▅▃,,▄▅▅▅Æ\// ///>// />/ / + V║«¼.;→ ║<«.,`=// />//%/% / / + //╠<´ -²,)(▓~"-╝/¾/ %/>/ /> + / / / ▐% -./▄▃▄▅▐, /7//;//% / / + / ////`▌▐ %zWv xX▓▇▌//&;% / / + / / / %//%/¾½´▌▃▄▄▄▄▃▃▐¶\/& / + </ /)VY>7; \_ UNIX IS VERY SIMPLE IT JUST NEEDS A + / /</ //<///<_/%\▓ V%W%£)XY _/%‾\_, GENIUS TO UNDERSTAND ITS SIMPLICITY + / / //%/_,=--^/%/%%\¾%¶%%} /%%%%%%;\, + %/< /_/ %%%%%;X%%\%%;, _/%%%;, \ + / / %%%%%%;, \%%l%%;// _/%;, dmr + / %%%;, <;\-=-/ / + ;, l +eof diff --git a/home/.local/share/asciiart/zfetch b/home/.local/share/asciiart/zfetch new file mode 100755 index 0000000..e214803 --- /dev/null +++ b/home/.local/share/asciiart/zfetch @@ -0,0 +1,196 @@ +#!/usr/bin/env bash + +# z0mbi3 +# https://github.com/gh0stzk/dotfiles +# z0mbi3.zk@protonmail.com +# This script is a modified version of https://github.com/Mangeshrex/rxfetch + +esc="" +rst="${esc}[0m" + + +c1=""; c2=""; c3=""; c4="" +c5=""; c6=""; c7=""; c8="" +c9=""; c10=""; c11=""; c12="" +c13=""; c14=""; c15=""; c16="" +c17=""; c18=""; c19=""; c20="" +c21=""; c22=""; c23=""; c24="" +c25=""; c26=""; c27=""; c28="" +c29=""; c30=""; c31=""; c32="" +c33=""; c34=""; c35=""; c36="" +c37=""; c38=""; c39=""; c40="" +c41=""; c42=""; c43=""; c44="" +c45=""; c46=""; c47=""; c48="" +c49=""; c50=""; c51=""; c52="" +c53=""; c54=""; c55=""; c56="" +c57=""; c58=""; c59=""; c60="" +c61=""; c62=""; c63=""; c64="" +c65=""; c66=""; c67=""; c68="" +c69=""; c70=""; c71=""; c72="" +c73=""; c74=""; c75=""; c76="" +c77=""; c78=""; c79=""; c80="" +c81=""; c82=""; c83=""; c84="" +c85=""; c86=""; c87=""; c88="" +c89=""; c90=""; c91=""; c92="" +c93=""; c94=""; c95=""; c96="" +c97=""; c98=""; c99=""; c100="" +c101=""; c102=""; c103=""; c104="" +c105=""; c106=""; c107=""; c108="" +c109=""; c110=""; c111=""; c112="" +c113=""; c114=""; c115=""; c116="" +c117=""; c118=""; c119=""; c120="" +c121=""; c122=""; c123=""; c124="" +c125=""; c126=""; c127=""; c128="" +c129=""; c130=""; c131=""; c132="" +c133=""; c134=""; c135=""; c136="" +c137=""; c138=""; c139=""; c140="" +c141=""; c142=""; c143=""; c144="" +c145=""; c146=""; c147=""; c148="" +c149=""; c150=""; c151=""; c152="" +c153=""; c154=""; c155=""; c156="" +c157=""; c158=""; c159=""; c160="" +c161=""; c162=""; c163=""; c164="" +c165=""; c166=""; c167=""; c168="" +c169=""; c170=""; c171=""; c172="" +c173=""; c174=""; c175=""; c176="" +c177=""; c178=""; c179=""; c180="" +c181=""; c182=""; c183=""; c184="" +c185=""; c186=""; c187=""; c188="" +c189=""; c190=""; c191=""; c192="" +c193=""; c194=""; c195=""; c196="" +c197=""; c198=""; c199=""; c200="" +c201=""; c202=""; c203=""; c204="" +c205=""; c206=""; c207=""; c208="" +c209=""; c210=""; c211=""; c212="" +c213=""; c214=""; c215=""; c216="" +c217=""; c218=""; c219=""; c220="" +c221=""; c222="" + +#colors +CBK=$(tput setaf 0) +CRE=$(tput setaf 1) +CGR=$(tput setaf 2) +CYE=$(tput setaf 3) +CBL=$(tput setaf 4) + +CMA=$(tput setaf 5) +CCY=$(tput setaf 6) +CWH=$(tput setaf 7) +CBD=$(tput bold) +CNC=$(tput sgr0) + +get_init() { + if pidof -q systemd; then + echo 'systemd' + elif [ -f '/sbin/openrc' ]; then + echo 'openrc' + elif [ -f '/sbin/dinit' ]; then + echo 'dinit' + else + cut -d ' ' -f 1 /proc/1/comm + fi +} + +get_uptime() { + uptime -p | sed 's/up//' +} + +get_pkg_count() { + package_managers=('xbps-install' 'apk' 'port' 'apt' 'pacman' 'nix' 'dnf' 'rpm' 'emerge' 'eopkg') + for package_manager in "${package_managers[@]}"; do + if command -v "$package_manager" 2>/dev/null >&2; then + case "$package_manager" in + xbps-install) xbps-query -l | wc -l ;; + apk) apk search | wc -l ;; + apt) if [ "$kernel" != "Darwin" ]; then + echo $(($(apt list --installed 2>/dev/null | wc -l) - 1)) + else + echo 0 + fi + ;; + pacman) pacman -Q | wc -l ;; + nix) nix-env -qa --installed '*' | wc -l ;; + dnf) dnf list installed | wc -l ;; + rpm) rpm -qa | wc -l ;; + emerge) qlist -I | wc -l ;; + port) port installed 2>/dev/null | wc -l | awk 'NR==1{print $1}' ;; + eopkg) eopkg li | wc -l ;; + esac + + # if a package manager is found return from the function + return + fi + done + echo 0 +} + +# Get package information formatted +get_package_info() { + pkg_count=$(get_pkg_count) + + if [ "$pkg_count" -ne 0 ]; then + echo -n "$pkg_count" + else + echo "Unknown" + fi +} + +distro() { + awk -F '"' '/PRETTY_NAME/ { print $2 }' /etc/os-release +} + +storage() { + df -h --output=used / | awk 'NR == 2 { print $1 }' +} + +# Get Memory usage +get_mem () { + free --mega | awk 'NR == 2 { print $3" MB" }' +} + +# Get DE/WM +# Reference: https://github.com/unixporn/robbb/blob/master/fetcher.sh +get_de_wm() { + wm="${XDG_CURRENT_DESKTOP#*:}" + [ "$wm" ] || wm="$DESKTOP_SESSION" + + # for most WMs + [ ! "$wm" ] && [ "$DISPLAY" ] && command -v xprop >/dev/null && { + id=$(xprop -root -notype _NET_SUPPORTING_WM_CHECK 2>/dev/null) + id=${id##* } + wm=$(xprop -id "$id" -notype -len 100 -f _NET_WM_NAME 8t 2>/dev/null | grep '^_NET_WM_NAME' | cut -d\" -f 2) + } + + # for non-EWMH WMs + [ ! "$wm" ] || [ "$wm" = "LG3D" ] && { + wms=('sway' 'kiwmi' 'wayfire' 'sowm' 'catwm' 'fvwm' 'dwm' '2bwm' 'monsterwm' 'tinywm' 'xmonad') + for current_wm in "${wms[@]}"; do + if pgrep -x "$current_wm" 2>/dev/null >&2; then + wm="${current_wm}"; + break + fi + done + } + + echo "${wm:-unknown}" +} + +cat << EOF + + ${CBD}${c1}█${c2}█ + ${c3}█${c4}█${c5}█${c4}█${c6}█${c7}█${c8}█${c9}█${c10}█${c11}█${c12}█ + ${c13}█${c14}█ ${c15}█${c16}█${c17}█${c18}█${c19}█${c19}█${c20}█${c21}█${c22}█${c19}█${c19}█${c23}█${c24}█${c36}█${c25}█${c26}█${c27}█ + ${c28}█${c29}█${c30}█${c31}█${c32}█${c33}█${c34}█${c34}█${c34}█${c34}█${c34}█${c34}█${c34}█${c35}█${c37}█${c38}█${c39}█${c40}█${c41}█${c42}█${c43}█ + ${c5}█${c44}█${c45}█${c46}█${c47}█${c48}█${c49}█${c50}█${c51}█${c52}█${c53}█${c53}█${c53}█${c53}█${c53}█${c53}█${c54}█${c55}█${c56}█${c57}█${c58}█${c59}█${c60}█ ${CMA}os${CWH} $(distro) + ${c61}█${c62}█${c38}█${c63}█${c64}█${c34}█${c65}█${c66}█${c67}█${c68}█${c69}█${c70}█${c70}█${c70}█${c71}█${c72}█${c73}█${c74}█${c75}█${c76}█${c77}█${c78}█${c79}█ ${CGR}ker${CWH} $(uname -r) + ${c61}█${c62}█${c40}█${c80}█${c81}█${c82}█${c83}█${c84}█${c85}█${c84}█${c86}█${c87}█${c88}█${c88}█${c89}█${c90}█${c85}█${c85}█${c91}█${c92}█${c93}█${c78}█${c41}█${c94}█${c95}█ ${CCY}pkgs${CWH} $(get_package_info) + ${c96}█${c97}█${c81}█${c98}█${c99}█${c100}█${c101}█${c102}█${c103}█${c104}█${c105}█${c106}█${c107}█${c108}█${c109}█${c110}█${c111}█${c112}█${c113}█${c114}█${c115}█ ${CBL}sh${CWH} ${SHELL##*/} ${CYE}󰮯 ${CYE} ${CGR}󰊠 ${CGR} ${CBL}󰊠 ${CBL} ${CRE}󰊠 ${CRE} ${CCY}󰊠 ${CCY} ${CMA}󰊠 ${CMA} + ${c116}█${c117}█${c99}█${c118}█${c119}█${c120}█${c121}█${c122}█${c123}█${c124}█${c125}█${c126}█${c127}█${c128}█${c111}█${c112}█${c129}█ ${CYE}ram${CWH} $(get_mem) + ${c116}█${c70}█${c130}█${c131}█${c131}█${c132}█${c133}█${c134}█${c135}█${c135}█${c136}█${c137}█${c138}█${c131}█${c139}█${c140}█${c141}█ ${CRE}de/wm${CWH} $(get_de_wm) + ${c142}█${c143}█${c144}█${c145}█${c146}█${c147}█${c148}█${c149}█${c150}█${c151}█${c152}█${c71}█${c159}█ ${CMA}init${CWH} $(get_init) + ${c153}█${c154}█${c155}█${c156}█${c157}█${c158}█${c160}█${c135}█${c135}█${c161}█${c162}█${c163}█${c164}█${c165}█${c166}█${c167}█${c168}█ ${CBL}disk${CWH} $(storage) Used + ${c169}█${c170}█${c171}█${c172}█${c173}█${c174}█${c175}█${c176}█${c177}█${c157}█${c178}█${c179}█${c180}█${c181}█${c181}█${c135}█${c135}█${c182}█${c183}█${c184}█${c185}█ ${CYE}up${CWH} $(get_uptime) + ${c186}█${c187}█${c187}█${c188}█${c135}█${c135}█${c189}█${c190}█${c191}█${c192}█${c193}█${c194}█${c195}█${c196}█${c197}█${c198}█${c199}█${c135}█${c135}█${c200}█${c201}█${c202}█${c202}█${c203}█${c204}█ + ${c205}█${c206}█${c207}█${c207}█${c207}█${c202}█${c208}█${c209}█${c210}█${c135}█${c211}█${c212}█${c213}█${c214}█${c215}█${c216}█${c217}█${c135}█${c135}█${c135}█${c135}█${c218}█${c219}█${c220}█${c220}█${c207}█${c221}█${c222}█${c168}█${rst} + +EOF