Skip to content

Latest commit

 

History

History
384 lines (298 loc) · 11.8 KB

README.md

File metadata and controls

384 lines (298 loc) · 11.8 KB

JayRizzoTools

Aggregation of Scripts to make life a bit more interesting.

Python

  • Download Any Youtube Video to an Audio or Video File Format.
  • Automatically Creates And Download Into These Folders
    • Audio Files In MUSIC FOLDER: ~/Music/JayRizzoDL
    • Video Files In Movies FOLDER: ~/Movies/JayRizzoDL
python3 pyTubeGUI.py

20221231_121403

Python

  • Generate a Random Hand of x# of cards. (poker, blackjack)
import pyGenHand

a = pyGenHand.Poker()
a.dealHand(5)

# Returns: 
Hand Dealt: [(' A', '♠'), ('10', '♥'), (' 9', '♣'), (' 3', '♥'), (' J', '♦')]
  • Generate a Random String containing information of the Standard 256 colors.
from random import choice
import pyGenRand256Color


a = pyGenRand256Color
b = dict(choice(a.two56colors))
print(b['colorId'])
print(b['name'])
print(b['hexString'])
print(b['rgb'])
print(b['hsl'])

# Returns:
24
DeepSkyBlue4
#005f87
{'r': 0, 'g': 95, 'b': 135}
{'h': 197.777777777778, 's': 100, 'l': 26}
  • Generate a Random String containing an Adjective.
from random import choice
import pyGenRandAdjective

a = pyGenRandAdjective
b = choice(a.adjectives)
print(b)

# Returns:
Tender-Hearted
  • Generate a Random String containing an Adverb.
from random import choice
import pyGenRandAdverb

a = pyGenRandAdverb
b = choice(a.adverbs)
print(b)

# Returns:
Utterly
  • Generate a Random String containing an Animal.
from random import choice
import pyGenRandAnimal

a = pyGenRandAnimal
b = choice(a.animals)
print(b)

# Returns:
Flamingo
  • Generate a Random String containing a random company name.
from random import choice
import pyGenRandCompanieName

a = pyGenRandCompanieName
b = choice(a.companies)
print(b)

# Returns:
American Electric Power
  • Generate a Random String containing a random Emoji Character.
from random import choice
import unicodedata
import pyGenRandEmoji
from pyGenRandEmoji import emojis

emoji = choice(emojis)
begwrap = "{"
endwrap = "}"
# https://docs.python.org/3/howto/unicode.html?highlight=unicode%20howto#the-string-type
# https://unicode.org/emoji/charts-13.0/emoji-released.html
# NOTE: Sometimes throws an error "No such name"  https://stackoverflow.com/a/24553272/1896134
print(f"Emoji:\t\t\t\t{ascii(emoji)}")
print(f"HEX:\t\t\t\t{emoji.encode('UTF-8')}")
print(f"Unicode Name:\t\t'\\N{begwrap}{unicodedata.name(emoji)}{endwrap}'")
print(f"Returns:\t\t\t{emoji}")

# Returns:
Emoji:              '\U0001f63a'
HEX:                b'\xf0\x9f\x98\xba'  
Unicode Name:       '\N{SMILING CAT FACE WITH OPEN MOUTH}'
Returns:            😺

# Checking: 
print('\U0001f63a')
print(bytes(b'\xf0\x9f\x98\xba').decode('utf-8'))
print('\N{SMILING CAT FACE WITH OPEN MOUTH}')
# All Return the expected emoji:
'😺'
  • Generate a Random String containing a random Font from your Mac Machine.
from random import choice
import pyGenRandFontObj

a = choice(pyGenRandFontObj.getFontList())
FontNameStr = a.split('/')[-1].split('.')[0]
print(f"Your Random Font: {FontNameStr}\tPath: {a}")

# Results:
Your Random Font: Khula-SemiBold    Path: ~/Library/Fonts/Khula-SemiBold.ttf

# OR if you want to know every font you have
# Minus one ('/System/Library/Fonts/Apple Color Emoji.ttc')  Removed for Breaking when used by PIL.

for i in sorted(pyGenRandFontObj.getFontList()):
    FontNameStr = i.split('/')[-1].split('.')[0]
    print(f"CurrentFontName: {FontNameStr}: {i}")

# Results:
CurrentFontName: Arial Unicode: /Library/Fonts/Arial Unicode.ttf
... (list all fonts)
CurrentFontName: ubuntu: ~/Library/Fonts/ubuntu.ttf
  • Generate a Random Tuple containing a random set of 6 numbers.
from pyGenRandLuckyNumbers import generateLuckyNumbers

a = generateLuckyNumbers()[0]  # Returns Comma separated string
print(a)

b = generateLuckyNumbers()[1]  # Returns [LIST]
print(b)

c = generateLuckyNumbers()     # Returns tuple(Comma separated string & [LIST])
print(c)

# Results Respectively for each print statement as Follows:
07, 00, 49, 13, 23, 37
['32', '13', '33', '22', '16', '53']
('48, 21, 40, 46, 43, 13', ['48', '21', '40', '46', '43', '13'])
  • Generate a Random String containing a random HEX.
from pyGenRandHEX import GenerateRandomHEX

a = GenerateRandomHEX()
print(f"Your Random HEX Color is: {a}  'GenerateRandomHEX()'")

# Results Respectively for each print statement as Follows:
Your Random HEX Color is: e4ad64
  • Generate a Random Tuple containing a random set of 6 numbers.
from pyGenRandRGB import GenerateRandomRGB

a = GenerateRandomRGB()
print(f"Your Random RGB Color is: {a}  'GenerateRandomRGB()'")
print(f"R: {a[0]}")
print(f"G: {a[1]}")
print(f"B: {a[2]}")

# Results Respectively for each print statement as Follows:
Your Random RGB Color is: (62, 38, 216)  'GenerateRandomRGB()'
R: 62
G: 38
B: 216
  • Generate a Random String containing a random phrase.
python3 pyGenRandStatement.py

# Do Not Lie
  • Generate your system uptime in a readable format from epoch time.
python3 pyGetSystemUpTime.py

# ('000', '000', '001', '00', '05', '53', '923530')
# 000 Years, 000 Months, 001 Days, 00 Hours, 05 Minutes, 53 Seconds, 923530 MicroSeconds.
# 000 Years, 000 Months, 001 Days, 00 Hours, 05 Minutes, 53 Seconds, 923530 MicroSeconds.
  • Generate a standard python header
python3 pyHeaderMac.py      

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# =============================================================================
# Created Syst: macOS Monterey 12.6 (21G115) Kernel: Darwin 21.6.0
# Created Plat: Python 3.10.8 ('v3.10.8:aaaf517424', 'Oct 11 2022 10:14:40')
# Created By  : jayrizzo
# Created Date: Sat Dec 31 12:18:45 2022 CST
# Last ModDate: Sat Dec 31 12:18:45 2022 CST
# =============================================================================
# Notes:
# =============================================================================
  • Easily Download images from other sites. * Supports (JPG/JPEG/PNG/TIFF/GIF/)
python3 pyImageDownloader.py

File was created: /Users/jayrizzo/Pictures/JayRizzoDL/logo-stackoverflow.png

Or as an import:

from pyImageDownloader import ImageDownloader

ImageDownloader("https://stackoverflow.design/assets/img/logos/so/logo-stackoverflow.png")
  • Generate a true or false if your list is containing another list. Needed to prevent iteration problems when looping over lists.
python3 pyListChecker.py    

# Examples are as follows:
#    bb = ['test', 'consolidated list should return True']
#    f = ListChecker().main(bb)
#    print(f"{f}")
#    # Returns: (False, ['test', 'consolidated list should return True'])
#    try:
#        aa = ['test', ['another list should return False']]
#        d = ListChecker().main(aa)
#        print(d)
#    except Exception as e:
#        print(f"{e}")
#        # Returns: (True, ['test', ['another list should return False']], ERROR: This List Contains Another list Please Fix the list & try again!)
#        exit()
#
#(False, ['test', 'consolidated list should return True'])
#(True, ['test', ['another list should return False']], ERROR: This List Contains Another list Please Fix the list & try again!)
  • Generate your Mac Operating System Name. Using sw_vers into python variables.
# ('macOS', 'Monterey', '12.6', '21G115')
#
# Product Type        : macOS
# Product Name        : Monterey
# Product Version     : 12.6
# Product Build Number: 21G115
# 
# Os Name for 11.4:           Big Sur
# Os Name for 11.04:          Big Sur
# Os Name for 11.14:          Big Sur
# Os Name for 10.02:          X Jaguar
# Os Name for 10.9:           X Mavericks
# Os Name for 10.09.424.24:   X Mavericks
# Os Name for 11.4:           Big Sur
# Os Name for 11.4.2:         Big Sur
# Os Name for 75.02:          ('',)

Shell

This is a bash script to download the google fonts to your current working directory

  • Easily download 1200 fonts from google just by calling this file from the terminal. Downloads to current working directory.
  • Contains Most of the current Known URL's for Google Fonts.
  • Uses curl to download the zip files.
  • Uses unzip to Unzip the files into your current working directory.
  • This Does not automatically install the font files, must run info below:

Mac Install

  1. mkdir ~/Downloads/Fonts
  2. mkdir ~/Downloads/GoogleFonts
  3. cd ~/Downloads/GoogleFonts
  4. bash GoogleFontList.sh
    1. Wait for downloads to complete
  5. Show all Fonts in current Directory & SubDirectories
# Show all Fonts in current Directory & SubDirectories
find . -name '*.otf'  ## OpenType® font
find . -name '*.ttf'  ## TrueType® font
find . -name '*.ttc'  ## TrueType® font collection
  1. Move all Fonts from Directory & SubDirectories >> into Download Fonts Folder
# Move all Fonts from Directory & SubDirectories >> into Download Fonts Folder
find -s . -type f -name "*.otf" -exec cp {} ~/Downloads/Fonts \; -print
find -s . -type f -name "*.ttf" -exec cp {} ~/Downloads/Fonts \; -print
find -s . -type f -name "*.ttc" -exec cp {} ~/Downloads/Fonts \; -print
  1. Move all Fonts from Download Fonts Folder >> into ~/Library/Fonts/
# Move all Fonts from Download Fonts Folder >> into ~/Library/Fonts/
find -s ~/Downloads/Fonts -type f -name "*.otf" -exec cp {}  ~/Library/Fonts/ \; -print
find -s ~/Downloads/Fonts -type f -name "*.ttf" -exec cp {}  ~/Library/Fonts/ \; -print
find -s ~/Downloads/Fonts -type f -name "*.ttc" -exec cp {}  ~/Library/Fonts/ \; -print
  1. open /System/Applications/Font\ Book.app
    1. Wait for system to recognize the new fonts.
    2. Right Click on Font Name
    3. Select Resolve Duplicates
    4. Wait for system to recognize the Duplicate fonts & Display Dialog Box.
    5. Select Resolve Automatically Wait for another popup.
    6. When Asked to move duplicates to TRASH -> Select OK

Complete. You now have over a Thousand New Font Variations.