/VoytasCodeLab

A diverse collection of scripts, snippets, and functions

Primary LanguagePythonMIT LicenseMIT

Welcome to VoytasCodeLab

ko-fi

Explore a diverse collection of my scripts, snippets, and functions across multiple programming languages. Whether you're working with PowerShell, Python, Bash, JavaScript, or more, VoytasCodeLab provides a valuable resource for automation, development, and learning. Dive into various coding examples and enhance your programming toolkit with Voytas.

The Code

  1. [Python] [CrewAI] [Azure OpenAI]

    The crewai-PROD-TechDiscussionAssistant.py script is designed to run CrewAI for technical discussions and assistance. This script allows users to specify a topic for discussion and provides various modes such as planning and manager modes. It utilizes configurations and tools from the CrewAI framework to facilitate discussions and generate professional reports.

    Key Features:

    • Topic Discussion: Specify a topic for in-depth technical discussion.
    • Multiple Modes: Enable planning and manager modes for hierarchical or sequential processing.
    • Verbose Output: Option to enable detailed output for better insights.
    • Result Count: Specify the number of web results to retrieve.
    • Caching and Memory Options: Enable or disable caching and memory for the crew.
    • Agent-Based Tasks: Utilizes specialized agents for tasks such as web search, data verification, relevance analysis, and report writing.
    • Markdown Reports: Generates structured markdown-formatted reports with detailed sections including responses, findings, recommendations, and timelines.

    Example Usage:

    python crewai-PROD-TechDiscussionAssistant.py --topic "What's new in Windows Server" --result_count 5

    Source Code: crewai-PROD-TechDiscussionAssistant.py

  2. [Python] [CrewAI] [Azure OpenaAI]

    The crewai-PROD-News_analyzer_A2_v2.py script is designed to run CrewAI for comprehensive news search and analysis. This script allows users to specify a topic for analysis and provides various modes such as planning and manager modes. It utilizes configurations and tools from the CrewAI framework to perform detailed analysis and generate professional reports.

    Key Features:

    • Topic Analysis: Specify a topic for in-depth news analysis.
    • Multiple Modes: Enable planning and manager modes for hierarchical or sequential processing.
    • Verbose Output: Option to enable detailed output for better insights.
    • Result Count: Specify the number of web results per provider to retrieve.
    • Caching and Memory Options: Enable or disable caching and memory for the crew.
    • Agent-Based Tasks: Utilizes specialized agents for tasks such as web search, data verification, trend analysis, and report writing.
    • Markdown Reports: Generates structured markdown-formatted reports with detailed sections including trends, findings, recommendations, and timelines.

    Example Usage:

    python crewai-PROD-News_analyzer_A2_v2.py --topic "What's new in Windows Server" --planning --verbose --result_count 5

    Source Code: crewai-PROD-News_analyzer_A2_v2.py

  3. [PowerShell]

    Calculates the cyclomatic complexity of a PowerShell script or code block, including both functions and top-level code.

    PowerShell Gallery

    Published version: Powershell gallery

    Source code

    Example

    $code = @"
        if ($true) { Write-Output "True" }
        else { Write-Output "False" }
        function Test {
            if ($true) { Write-Output "True" }
            else { Write-Output "False" }
        }
        "@
    Get-CyclomaticComplexity -CodeBlock $code
    Get-CyclomaticComplexity -CodeBlock (Get-Content "D:\path\to\file.ps1" -raw)
    Get-CyclomaticComplexity -FilePath "C:\path\to\file.ps1"
  4. [PowerShell]

    A script to generate a series of random numbers using different methods and formats.

    The script uses both built-in PowerShell capabilities and .NET classes to generate random numbers. It showcases different ways to generate random numbers as UInt64 and UInt32, both as a full range and a fractional number between 0 and 1.

    If you need random numbers for cryptographic purposes, it's recommended to use classes from "System.Security.Cryptography", such as "RandomNumberGenerator", which provides cryptographic strength random number generation.

    Linkedin

    random.ps1

  5. [PowerShell]

    Converts a YouTube transcript into a structured format with timestamps and corresponding text.

    This script takes a YouTube transcript (glasp.co - transcript extension) as input and extracts the timestamps and their corresponding text. It returns an array of custom objects, each containing a timestamp and the associated text.

    Example

    $transcript = @"
    (00:00) on September 1st last year a team of 16 scientists made a stunning discovery that sent shock waves through the scientific Community they ...
    (05:52) essentially cease to exist for them they are momentary in a sense passing through the fabric of SpaceTime without experiencing the passage ...
    (10:09) unfolding this concept becomes even more exciting when applied to photons or particles of light photons have no clear past present or future ...
    (12:24) basic assumptions of The Big Bang Theory
    "@
    
    $results = Convert-YouTubeTranscript -transcript $transcript
    $results | Format-Table -AutoSize

    Source code

    transcript extension

  6. [PowerShell]

    Retrieves the Access Control List (ACL) and Extended Rights for a specified Active Directory user.

    This script fetches the ACL for a user object in Active Directory and maps any Extended Rights GUIDs to their corresponding names. It outputs the ACL entries in a formatted table.

    Example

    IdentityReference                            ActiveDirectoryRight       ExtendedRightName     ExtendedRightGUID
    -----------------                            --------------------       -----------------     -----------------
    XYZ\TASK-T2-User-ResetPassword                      ExtendedRight          Reset Password     00299570-246d-11d0-a768-00aa006e0529
    XYZ\TASK-T2-User-Move                               ExtendedRight          Reset Password     00299570-246d-11d0-a768-00aa006e0529
    XYZ\TASK-T2-User-DisableEnable                      WriteProperty          N/A                N/A                                 
    XYZ\TASK-T2-User-MemberOf                           WriteProperty          N/A                N/A                                 
    XYZ\TASK-T2-User-ResetPassword        ReadProperty, WriteProperty          N/A                N/A                                 
    XYZ\TASK-T2-User-Move                    CreateChild, DeleteChild          N/A                N/A                                 
    XYZ\TASK-T2-User-Move                               WriteProperty          N/A                N/A                                 
    

    Source code