#!/usr/bin/env python3 import re import sqlite3 import glob import sys import random import pyfiglet import termcolor import datetime import textwrap import subprocess # first some rain # subprocess.run(['timeout', '10', 'rain', '-d', '180']) # don't get locked out by the rain subprocess.run(['sl']) # train is okay though # Logo word. word = 'haldo' # who changed this? Tried 'Marketing' but wont work not enough colors? # we want neofetch - but this is python # adding import subrpcess and call it at end maybe? # Choose random font and letter colors. needs more colors for longer then 7 character words font = random.choice(pyfiglet.Figlet().getFonts()) available_colors = [ 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white' ] colors = random.sample(available_colors, len(word)) # 50% chance to convert to uppercase. if bool(random.getrandbits(1)): word = word.upper() # Generate all letters and their corresponding colors. letters_with_colors = [ (pyfiglet.figlet_format(text=letter, font=font).split('\n'), colors[i]) for i, letter in enumerate(word) ] # Print out result. max_line_length = 0 for lines in zip(*[letter_lines for letter_lines, _ in letters_with_colors]): colored_lines = [ termcolor.colored(line, color=color) for (line_list, color), line in zip(letters_with_colors, lines) ] stripped_line = re.sub(r'\x1B\[[0-?]*[ -/]*[@-~]', '', ''.join(colored_lines)) max_line_length = max(max_line_length, len(stripped_line.strip())) if stripped_line.strip(): print(''.join(colored_lines)) print('labs'.rjust(max_line_length) + '\n') db_path = '/var/lib/motd/db_short.sqlite3' conn = sqlite3.connect(db_path) cursor = conn.cursor() cursor.execute("SELECT message FROM motds ORDER BY RANDOM() LIMIT 1;") motd = cursor.fetchone() if motd: print('\033[2m', end='') for line in motd[0].split('\n'): print(textwrap.fill(line, width=70)) print('\033[0m', end='') conn.close() # Now do neofetch - subprocess.run(["neofetch"]) # More! Wont Weebs be confused # subprocess.run(["bsdgames"])