This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import matplotlib.pyplot as plt | |
# Hex value to analyze | |
hex_value = 0x12345678 | |
# Break into bytes (big-endian order) | |
bytes_big_endian = [(hex_value >> (i * 8)) & 0xFF for i in range(3, -1, -1)] # [0x12, 0x34, 0x56, 0x78] | |
bytes_little_endian = bytes_big_endian[::-1] # Reverse for little-endian: [0x78, 0x56, 0x34, 0x12] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import matplotlib.pyplot as plt | |
# List of numbers from 0 to 15 with decimal, hexadecimal, and binary representations | |
numbers = [ | |
(i, f'0x{hex(i)[2:].upper().zfill(2)}', f'{bin(i)[2:].zfill(4)}') | |
for i in range(16) | |
] | |
# Create DataFrame |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import matplotlib.pyplot as plt | |
# List of common unit conversions | |
conversions = [ | |
('Length', '1 inch', '2.54 cm'), | |
('Length', '1 foot', '0.3048 m'), | |
('Length', '1 mile', '1.60934 km'), | |
('Length', '1 meter', '3.28084 ft'), | |
('Length', '1 kilometer', '0.621371 mi'), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import matplotlib.pyplot as plt | |
# List of SI prefixes with symbols and exponents, limited to zetta and below | |
prefixes = [ | |
('zetta', 'Z', 21), | |
('exa', 'E', 18), | |
('peta', 'P', 15), | |
('tera', 'T', 12), | |
('giga', 'G', 9), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from CogFileFame import CogName | |
client = commands.Bot(command_prefix=".", intents=discord.Intents.all(), case_insensitive=True) | |
@client.event | |
async def on_ready(): | |
await setup(client) | |
async def setup(client: commands.Bot): | |
await client.add_cog(Cogname(client)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import win32ui | |
import win32con | |
import win32gui | |
from PIL import Image | |
def png_to_uncompressed_ico(input_file, output_file): | |
try: | |
# Open the PNG image | |
img = Image.open(input_file) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
def png_to_ico(input_file, output_file): | |
try: | |
# Open the PNG image | |
img = Image.open(input_file) | |
# Convert it to an ICO icon | |
img.save(output_file, format="ICO") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pandas as pd | |
from sklearn.feature_extraction.text import TfidfVectorizer | |
from sklearn.decomposition import NMF | |
class NMFTopicModel: | |
def __init__(self, n_topics=5, max_features=1000): | |
self.n_topics = n_topics | |
self.max_features = max_features | |
self.vectorizer = TfidfVectorizer(max_features=self.max_features, stop_words='english') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pandas as pd | |
from sklearn.feature_extraction.text import CountVectorizer | |
from sklearn.decomposition import LatentDirichletAllocation | |
class LDATopicModel: | |
def __init__(self, n_topics=5, max_features=1000): | |
self.n_topics = n_topics | |
self.max_features = max_features | |
self.vectorizer = CountVectorizer(max_features=self.max_features, stop_words='english') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
import tensorflow as tf | |
from tensorflow.keras.layers import Input, Dense, Lambda | |
from tensorflow.keras.models import Model | |
from tensorflow.keras.losses import mse | |
from tensorflow.keras import backend as K | |
class SimpleVAE: | |
def __init__(self, input_dim, latent_dim): |
NewerOlder