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
| #!/bin/bash | |
| # zswap Setup Script | |
| # Example: curl -sL https://gist.githubusercontent.com/cnmoro/f7b8935736150dbac4d754051dc07e4b/raw/6c3489e2d612756acddb5152a136484a816b6528/activate_zswap.sh | sudo bash -s 4 | |
| set -e | |
| # Check if running as root | |
| if [ "$EUID" -ne 0 ]; then | |
| echo "Error: This script must be run as root (use sudo)" |
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
| #!/bin/bash | |
| # zRAM Setup Script | |
| # Example: curl -sL https://gist.githubusercontent.com/cnmoro/32a898436388e8245fbb67cd7b6bb1e6/raw/98de143fdfe1a9c2d8649a5b5c572835c32b45e1/activate_zram.sh | sudo bash -s 4096M | |
| set -e | |
| # Check if running as root | |
| if [ "$EUID" -ne 0 ]; then | |
| echo "Error: This script must be run as root (use sudo)" |
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
| 1 - Identificar o device | |
| cat /proc/bus/input/devices | |
| Look for something that says "keyboard" in the N: Name= line. In this example, it's "AT Translated Set 2 keyboard". The important part is the Handlers= line—it shows event1, which means the device is /dev/input/event1. | |
| 2 - Validar o dispositivo | |
| sudo evtest | |
| 3 - Atualizar o código C com o device | |
| Linha "input_fd = open("/dev/input/event0", O_RDONLY);" - trocar o eventX |
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
| ## Converter Imports | |
| from transformers import AutoTokenizer | |
| from gliclass import GLiClassModel | |
| import torch | |
| ## Quantizer Imports | |
| from onnxruntime.quantization import quantize_dynamic, QuantType | |
| ## Inference imports | |
| from tokenizers import Tokenizer |
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 | |
| def sequence_mining_analysis(df, id_col, date_col, cat_col): | |
| if not pd.api.types.is_datetime64_any_dtype(df[date_col]): | |
| raise TypeError(f"Column '{date_col}' must be datetime.") | |
| df = (df[[id_col, date_col, cat_col]] | |
| .sort_values([id_col, date_col])) | |
| grp = df.groupby(id_col)[cat_col] |
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 traceback, inspect, re, datetime | |
| def log_exception(e, custom_msg=None): | |
| # Get the frame of the caller (the function where the exception was caught) | |
| frame = inspect.currentframe().f_back | |
| func_name = frame.f_code.co_name | |
| filename = frame.f_code.co_filename | |
| line_no = frame.f_lineno |
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
| # pip install -U insightface mxnet onnx onnxruntime | |
| # Initialize the FaceAnalysis app with the Antelope model | |
| from insightface.app import FaceAnalysis | |
| app = FaceAnalysis(name='antelopev2', root='./', providers=['CPUExecutionProvider']) | |
| # Remove nested folder from download if needed | |
| app.prepare(ctx_id=-1, det_size=(640, 640)) | |
| from PIL import Image | |
| img = Image.open('82.png') |
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 torch | |
| import torch.nn as nn | |
| import torch.nn.functional as F | |
| from torch.utils.data import DataLoader, Dataset | |
| from torchtext.vocab import build_vocab_from_iterator |
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 torch | |
| from torch.utils.data import DataLoader, Dataset | |
| from collections import defaultdict | |
| class WordGraph: |
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 random | |
| from collections import defaultdict | |
| class GraphWalkEncoder: | |
| def __init__(self, vocab_size, vector_size=64, walk_length=5): |
NewerOlder