Compare commits

...

19 Commits

Author SHA1 Message Date
0695b2f5ae fix naming 2025-02-16 23:19:46 +01:00
296c6df340 add script to fix naming 2025-02-16 23:19:07 +01:00
0f997bfd1a fixing naming 2025-02-16 23:18:44 +01:00
d7f063b128 Cleaning up from end up till 300 manually 2025-02-16 23:10:20 +01:00
022c9d8fff cleanup waifus + adding script for missing waifu detection 2023-12-11 23:05:05 +01:00
4e9d0b8c03 add new waifus 2023-12-11 22:18:22 +01:00
fe20bfdc1c add new waifus till 442 2023-08-27 22:14:07 +02:00
93e6c14ede Change cache location 2023-08-27 22:13:39 +02:00
f68fc3234d switch submodule url 2022-12-18 14:12:23 +01:00
a36b2aa3f8 Fixing colors when is disabled lolcat 2022-08-19 21:46:07 +02:00
d1ad88abd3 Added make to lolcat instructions 2022-05-25 21:13:25 +02:00
d7517bd21d Fixed link 2022-05-24 22:55:41 +02:00
7e0460cb6c Change lolcat path 2022-05-24 22:52:03 +02:00
afe8a29a24 Updated readme for lolcat 2022-05-24 22:50:50 +02:00
09cfd7d7c1 Updated motd.py, is able to display waifus with icat 2022-05-23 16:19:48 +02:00
6c0ba4b0af Making progress in python 2022-05-13 23:49:27 +02:00
86d70c0e93 intreal lolcat 2022-05-13 23:49:01 +02:00
57a264bbef Start migration to python 2022-05-05 19:50:40 +02:00
c547f33eb5 added 264 waifus 2022-04-11 20:07:40 +02:00
1453 changed files with 188 additions and 22 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "lolcat"]
path = lolcat
url = https://github.com/sevi-kun/lolcat.git

View File

@ -12,6 +12,22 @@ Just a little script and some 256x images for some terminal shine UwU.
Just place this folder somewhere, and add the path of the motd.sh to your .bashrc.
```
git clone https://git.nussnougate.net/Lexeloid/.motd.git
```
### lolcat
> For faster lolcat we use a C implementation from [jaseg](https://github.com/jaseg/lolcat).
```
git submodule init
git submodule update
cd lolcat
make
```
## Limitations
At the moment, it only works in the kitty terminal.

1
lolcat Submodule

Submodule lolcat added at 8173ed8cb6

85
motd.py Executable file
View File

@ -0,0 +1,85 @@
#!/bin/python
from functools import cache
import os
import random
#import ueberzug.lib.v0 as ueberzug
import subprocess
import time
import fnmatch
from curses.textpad import Textbox, rectangle
modpath = os.path.dirname(__file__)
cachefile = "/tmp/waifu.cache"
resolution = 256
center = True
lolcat = False
unameArg = "-sr"
uptimeArg = "--pretty"
terminal = os.get_terminal_size()
minTermW = 200
#unameColor = "\033[1;38;5;93m"
#uptimeColor = "\033[1;38;5;99m"
#print len([name for name in os.listdir(f'{modpath}/waifus') if os.path.isfile(name)])
DIR=modpath + '/waifus'
#print(len([name for name in os.listdir(DIR) if os.path.isfile(os.path.join(DIR, name))]))
#filter waifus
waifulist = os.listdir(DIR)
waifus_raw = fnmatch.filter(waifulist, '*.256.png')
waifus = list(waifus_raw)
waifuindex = random.randint(1, len(waifus))
#print(modpath)
#######################
#If term Kitty
print(len(waifus))
if random.randint(0,1) == 0:
if os.path.getsize(cachefile) != 0:
f = open(cachefile, 'r')
waifuindex = f.read()
print(int(waifuindex))
#print(len(waifus))
#Else Add File
###############
if int(waifuindex) < len(waifus):
waifu = waifus[int(waifuindex)]
waifuindex = int(waifuindex) + 1
f = open(cachefile, 'w')
f.write(str(waifuindex))
else:
waifuindex = random.randint(1, len(waifus))
f = open(cachefile, 'w')
f.write(str(waifuindex))
waifu = waifus[int(waifuindex)]
else:
waifu = waifus[int(waifuindex)]
#######################
#Declare static methods
@staticmethod
def showImage():
subprocess.run(["/usr/bin/kitty", "icat", DIR+"/"+waifu])
def showUname(unameArg):
os.system("/usr/bin/uname " + unameArg)
def showUptime(uptimeArg):
os.system("/usr/bin/uptime " + uptimeArg)
#def doLolcat():
# if __name__ == '__main__':
# showUname(unameArg)
# showUptime(uptimeArg)
showImage()

49
motd.sh
View File

@ -1,41 +1,56 @@
# Fancy waifu motd
#####################################################################
# #
# Fancy waifu motd #
# #
#####################################################################
MOTDPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" # path to motd folder
CACHEFILE="/tmp/waifu.cache" # to cache waifu state
RESOLUTION=256 # resolution of waifu
##### User config
#####################################################################
RESOLUTION=128 # resolution of waifu
CENTER=true # center motd?
LOLCAT=false # use lolcat? (start delay)
LOLCAT=true # use lolcat? (start delay)
UNAMEARG="-sr" # uname arguments
UPTIMEARG="--pretty" # uptime arguments
tput_cols=$(/usr/bin/tput cols) # terminal columns
MINTERMWIDTH=200 # minimal width of term, to display motd
UNAMECOLOR="\033[1;38;5;93m"
UPTIMECOLOR="\033[1;38;5;99m"
MINTERMWIDTH=100 # minimal width of term, to display motd (change depending on resolution, 0 to disable)
MOTDCOLOR="\033[0m" # Bash color code for motd text (no lolcat)
UNAMECOLOR="\033[0m" # Bash color code for uname (no lolcat)
UPTIMECOLOR="\033[0m" # Bash color code for uptime (no lolcat)
#####################################################################
##### Script config
#####################################################################
CACHEFILE="$HOME/.cache/waifu.cache" # to cache waifu state
MOTDPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" # path to motd folder
tput_cols=$(/usr/bin/tput cols) # terminal columns
WAIFUS=$(($(ls $MOTDPATH/waifus/*.256.png | wc -w) - 1)) # count of waifus
lx="$MOTDPATH/lolcat/lolcat" # lolcat
#####################################################################
function output() {
val=0
if [ $1 == "true" ]; then val=$(($val + 1)); fi
if [ $2 == "true" ]; then val=$(($val + 2)); fi
if [ -f "/usr/games/lolcat" ]; then lx="/usr/games/lolcat"; else lx="/usr/bin/lolcat"; fi
case "$val" in
0)
echo -en $UPTIMECOLOR
/bin/cat $MOTDPATH/motd
echo -en $UNAMECOLOR
uname $UNAMEARG
echo -en $UPTIMECOLOR
uptime $UPTIMEARG
;;
1)
/bin/cat $MOTDPATH/motd | $lx
echo "test"
echo -en $UNAMECOLOR
uname $UNAMEARG | $lx
echo -en $UPTIMECOLOR
uptime $UPTIMEARG | $lx
;;
2)
echo -en $MOTDCOLOR
/bin/cat $MOTDPATH/motd | awk '{ z = '$tput_cols' - length; y = int(z / 2); x = z - y; printf "%*s%s%*s\n", x, "", $0, y, ""; }'
echo -en $UNAMECOLOR
uname $UNAMEARG | awk '{ z = '$tput_cols' - length; y = int(z / 2); x = z - y; printf "%*s%s%*s\n", x, "", $0, y, ""; }'
@ -44,9 +59,7 @@ function output() {
;;
3)
/bin/cat $MOTDPATH/motd | awk '{ z = '$tput_cols' - length; y = int(z / 2); x = z - y; printf "%*s%s%*s\n", x, "", $0, y, ""; }' | $lx
echo -en $UNAMECOLOR
uname $UNAMEARG | awk '{ z = '$tput_cols' - length; y = int(z / 2); x = z - y; printf "%*s%s%*s\n", x, "", $0, y, ""; }' | $lx
echo -en $UPTIMECOLOR
uptime $UPTIMEARG | awk '{ z = '$tput_cols' - length; y = int(z / 2); x = z - y; printf "%*s%s%*s\n", x, "", $0, y, ""; }' | $lx
;;
esac
@ -54,8 +67,8 @@ function output() {
printf '\033[0m' #reset colors
}
# if [ $tput_cols -gt $MINTERMWIDTH ]
# then
if [ $tput_cols -gt $MINTERMWIDTH ]
then
if [ $TERM == "xterm-kitty" ]
then
if [ $((0 + RANDOM % 2)) -eq 0 ]
@ -81,4 +94,4 @@ printf '\033[0m' #reset colors
fi
fi
output $LOLCAT $CENTER
# fi
fi

13
waifus/count.py Normal file
View File

@ -0,0 +1,13 @@
# This script checks if corresponding png in format waifu-<count>.<res>.png exists. Values for <res> can be 64, 128, 256.
import sys
import os
count = 513
for i in range(1, count + 1):
for res in [64, 128, 256]:
filename = "waifu-" + str(i) + "." + str(res) + ".png"
if not os.path.exists(filename):
print(filename)

35
waifus/rename-waifus.sh Normal file
View File

@ -0,0 +1,35 @@
#!/bin/bash
shopt -s nullglob # Prevent errors if no files match
# Associative array to store unique image bases
declare -A unique_images
# Extract base names without resolution suffix
for file in *.64.png; do
base="${file%.64.png}"
unique_images["$base"]=1
done
# Convert keys to sorted array
unique_bases=("${!unique_images[@]}")
IFS=$'\n' sorted_bases=($(sort <<<"${unique_bases[*]}"))
unset IFS
# Renaming process
counter=1
for base in "${sorted_bases[@]}"; do
for res in 64 128 256; do
old_file="${base}.${res}.png"
new_file="waifu-${counter}.${res}.png"
if [[ -f "$old_file" ]]; then
mv "$old_file" "$new_file"
echo "Renamed: $old_file -> $new_file"
fi
done
((counter++))
done
echo "Renaming complete."

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

Some files were not shown because too many files have changed in this diff Show More