Skip to content

Instantly share code, notes, and snippets.

@isocroft
Last active June 24, 2026 07:20
Show Gist options
  • Select an option

  • Save isocroft/97db2e4b3a2ec6fd3ca1eaa93c74be28 to your computer and use it in GitHub Desktop.

Select an option

Save isocroft/97db2e4b3a2ec6fd3ca1eaa93c74be28 to your computer and use it in GitHub Desktop.
A python cli script to that prints the lyrics to a song character by character and line by line with timer delays using an idle wait on the main thread
from time import time
import sys
def display_lyrics():
song_lyrics_with_roll_timing = [
("They say, \"the holy waters' watered down\"", 0.020),
("and this towns' lost its' faith.", 0.030),
("Our colors will fade", 0.015),
("eventually", 0.001)
]
song_lyric_line_pause = [0.2, 0.1, 0.1]
print("\n Song Title: Ordinary")
print("\n Song Owner: Alex Warren")
time.sleep(1)
for line_index, (lyric_line, lyric_line_roll_delay) in enumerate(song_lyrics_with_roll_timing):
for char in lyric_line:
print(char, end='')
sys.stdout.flush()
time.sleep(lyric_line_roll_delay)
time.sleep(song_lyric_line_pause[line_index])
if __name__ == "__main__":
display_lyrics()
@isocroft

Copy link
Copy Markdown
Author
import unicodedata

def prit_char_info(char):
     try:
         name = unicodedata.name(char)
     except ValueError:
         name = "<unknown>"
    
      codepoint = f"U+{ord(char):04x}"
      utf8_bytes = char.encode('utf-8')
      bytes_str = ' '.join(f"0x{byte:02x}" for byte in utf8_bytes)

      print(f"Character: {char}")
      print(f"Character Code: {ord(char)}")
      print(f"Code Point: {codepoint}")
      print(f"UTF-8 Bytes: {byte_str}")
      print(f"Name: {name}")
      print(f"-" * 20)

def main():
     print("Byte Display Tool\n\n")
     print("Enter text to see byte representation (Press Ctrl+C to exit)")
  
     try:
         while True:
             user_input = input("\nEnter text: ")
             if not user_input:
                 continue
      
             for char in user_input:
                 print_char_info(char)
       
     except KeyboardInterrupt:
         print("\nExiting....")
         
 if __name__ == "__main__":
      main()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment