Create List From Enum (convert Enum To List of values)

var categories = Enum.GetValues(typeof(CategoryType)).Cast<CategoryType>().ToList();

categories.Dump();

categories.ForEach(t => {
    (t == CategoryType.Category2).Dump();
});

public enum CategoryType
{
    Category1 = 1,
    Category2 = 2,
    Category3 = 3,
    Category4 = 4,
    Category5 = 5,
    Category6 = 6,
    Category7 = 7,
    Category8 = 8,
}

JavaScript for triggering Clear & Refresh modifications buttons

JavaScript for triggering Clear & Refresh modifications buttons
// 1. Clear mods
const chkBoxes = document.querySelectorAll('#tab-general .table tbody tr td:first-child input[type="checkbox"]');
chkBoxes.forEach(
	chkBox => {
		chkBox.checked = true;
	}
);
const clrBtn = document.querySelector('.page-header > .container-fluid > .pull-right > a[data-original-title="Clear"]');
clrBtn.click();

// 2. Refresh mods
const chkBoxes = document.querySelectorAll('#tab-general .table tbody tr td:first-child input[type="checkbox"]');
chkBoxes.forEach(
	chkBox => {
		chk

Longest Ideal String

/**
 * @param {string} s
 * @param {number} k
 * @return {number}
 */
var longestIdealString = function(s, k) {
    // Initialize an array to keep track of the longest ideal string ending with each letter
    var dp = new Array(26).fill(0);

    // Iterate over each character in the string
    for (var i = 0; i < s.length; i++) {
        // Convert the current character to its corresponding integer (0-25)
        var c = s.charCodeAt(i) - 'a'.charCodeAt(0);

        // Initialize the maximum len

RegEx IP Address

$IPAddressRegEx = '^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$'

Test if CTRL SHIFT ALT is pressed

Documentação: - [clickData.func](https://docs.dopus.com/doku.php?id=reference:scripting_reference:scripting_objects:func).qualifiers The string can contain any or all of the following: **shift, ctrl, alt, lwin, rwin**. If no qualifiers were down, the string will be: **none** - [Internal Command Modifiers](https://docs.dopus.com/doku.php?id=reference:command_reference:command_modifier_reference) | | | | ------------------------- | ---------------------------------------------------------------| | @keydown:\<qualifiers\> | test for a qualifier key or combination of keys | | @keydown:!\<qualifiers\> | test for a qualifier key or combination of keys NOT being down | | @keydown:any | tests if any qualifier keys are held down | | @keydown:none | instructions that are executed if no qualifiers are held down | | @keydown:common | common instructions that are always executed | ``` DOpus.Output('Iniciando script'); @keydown:common DOpus.Output('Executa independente de alguma tecla ter sido apertada ou não'); DOpus.Output('Útil quando você quer que o código execute sempre'); @keydown:none DOpus.Output('Só executa se nenhuma tecla esiver apertada'); @keydown:ctrl DOpus.Output('Só executa se CTRL tiver sido apertado'); @keydown:ctrlshift DOpus.Output('Só executa se CTRL e SHIFT tiverem sido apertados'); @keydown:any DOpus.Output('Executa se alguma tecla tiver sido apertada'); @keydown:!alt DOpus.Output('Só executa se ALT NÃO tiver sido apertado'); ```
var hKeys = clickData.func.qualifiers;

// If CTRL is pressed
if (hKeys.match(".*ctrl.*")){
    
}

// If SHIFT is pressed
if (hKeys.match(".*shift.*")){
    
}

// If ALT is pressed
if (hKeys.match(".*alt.*")){
    
}

Snippet que genera Tablas para la Documentación interna de MAT a partir de .csv

import pandas as pd
from tabulate import tabulate
import os as os

def csv_to_tabulate_table(file_path, file_name):
    # Load the CSV file into a Pandas DataFrame
    df = pd.read_csv(file_path)
    df = df.reset_index(drop=True)
    # Display the DataFrame
    #print(df.columns)

    table = tabulate(df, headers="keys", tablefmt="outline", showindex='never')

    # Display the Tabulate table
    #print(table)

    with open(f'output_txt/{file_name}.txt', 'w', encoding='utf-8') 

mount network drive

 sudo mount -t drvfs Y: /mnt/y/

popup = CustomPopup(titleName = titleName_ , infoSummary = infoSummary_ , infoDetail

# popup = CustomPopup(titleName = titleName_
#                             , infoSummary = infoSummary_
#                             , infoDetail = infoDetail_
#                             )


class CustomPopup(QDialog):
    def __init__(self
                 , titleName: str
                 , infoSummary: str, infoDetail: str
                 , parent = None):
        super(CustomPopup, self).__init__(parent)
        self.win = titleName + '_' + 'ui'
        # UIの window name (o

Lightbox for 'Panel Slider', 'Slideshow' and 'Overlay Slider' Yootheme Pro Element

Lightbox for 'Panel Slider', 'Slideshow' and 'Overlay Slider' Yootheme Pro Element
<!-- Yootheme Pro sliders with lightbox -->

<!--
1. For the 'Overlay Slider' or 'Panel Slider' Element:
-Add Link to the Image which has to be shown in the Lightbox
-Add element Attribute:
uk-lightbox="toggle: .uk-slider-items a"

2. For the 'SlideShow' Element:
-Add Link to the Image which has to be shown in the Lightbox
-Add element Attribute
uk-lightbox="toggle: .uk-slideshow-items a"
-->

<!-- OPTIONAL: -->
<!--
For the 'Overlay Slider' or 'Panel Slider' Element:

If link is set on Panel or

SVGアップロードを許可する

function add_file_types_to_uploads($file_types){
	$new_filetypes = array();
	$new_filetypes['svg'] = 'image/svg+xml';
	$file_types = array_merge($file_types, $new_filetypes);
	return $file_types;
}
add_action('upload_mimes', 'add_file_types_to_uploads');

popoverAPIサンプル

<button popovertaegrt="popover" popovertargetaction="show" class="popover-open">ポップオーバーを開く</button>
<div id="popover" popover class="popovertarget">
  <div>ポップオーバー</div>
  <button popovertaegrt="popover" popovertargetaction="hide" class="popover-close">ポップオーバーを閉じる</button>
</div>

文字列置換のいろいろ

import re

purePath = r'C:\Users\oki44\Documents\maya\projects\default'
filePath = re.sub(r'\\', '/', purePath) + '/'
fileName = 'fishSurf.xml'
importSkinWeight(filePath, fileName)


purePath = r'C:\Users\oki44\Documents\maya\projects\default'
filePath = purePath.replace("\\", "/") + '/'
fileName = 'fishSurf.xml'
importSkinWeight(filePath, fileName)

ChatGPT - JSON Mode

[**LINK TO RELEVANT DOCUMENTATION**](https://platform.openai.com/docs/guides/text-generation/json-mode)
"""
https://platform.openai.com/docs/guides/text-generation/json-mode
"""

import os

from dotenv import load_dotenv
from openai import OpenAI


# Instanciate and set the client
load_dotenv()
client = OpenAI(api_key = os.getenv("OPENAI_API_KEY"))

# Go by hand
completion = client.chat.completions.create(
  model = "gpt-3.5-turbo-0125",
  response_format = {"type": "json_object"},
  messages = [
    {"role": "system", "content": "You are a helpful assistant designed to output JSON."},
    {"role"

ChatGPT - Structured to Unstructured

"""
Example
Your accountant gives you a data sheet.
Your job is to write the quarterly earnings report!
"""

import json
import os

from dotenv import load_dotenv
from openai import OpenAI


# Instanciating and setting the client
load_dotenv
client = OpenAI(api_key = os.getenv("OPENAI_API_KEY"))


# Set the constant system prompt for the task
SYSTEM_PROMPT = "You are an assistant that writes concise, detailed, " +\
  "and factual quarterly earnings reports given structured data."
  
# Regular co

ChatGPT - Unstructured to Structured

import json
import os
from pprint import pprint

from dotenv import load_dotenv
from openai import OpenAI


# Instanciate and configure client
load_dotenv()
client = OpenAI(api_key = os.getenv("OPENAI_API_KEY"))

# Define the constant prompt for system
SYSTEM_PROMPT = "You are an assistant that returns only JSON " +\
  "objects with the resquested information."

# Usual functions
def complete(user_prompt):
  completion = client.chat.completions.create(
    model = "gpt-3.5-turbo",
    messages =