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/sh | |
| SWAP_FILE="/root/swap1" | |
| SWAP_SIZE=10240 | |
| FSTAB="/etc/fstab" | |
| SWAP_ENTRY="md99\tnone\tswap\tsw,file=${SWAP_FILE},late\t0\t0" | |
| # Check if swapfile line is already in /etc/fstab | |
| if ! grep -qF "${SWAP_FILE}" "${FSTAB}"; then |
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 hashlib | |
| from datetime import datetime, UTC | |
| from django.conf import settings | |
| from django.core.exceptions import FieldError | |
| from django.http import HttpResponseNotModified, HttpResponse | |
| from django.utils import timezone | |
| from django.utils.http import http_date, urlencode, parse_http_date | |
| from rest_framework.response import Response |
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 asyncio | |
| import threading | |
| import time | |
| # Stop event to signal the thread to terminate | |
| stop_event = threading.Event() | |
| async def proc1(): | |
| """ | |
| Infinite loop async |
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 timeit | |
| from matplotlib.colors import ListedColormap | |
| import matplotlib.pyplot as plt | |
| import re | |
| def version_1(string: str) -> str: | |
| digits = [] | |
| for char in string: | |
| if char.isdigit(): |
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 | |
| ### VARIABLES | |
| # Logfile | |
| SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | |
| LOGFILE="${SCRIPT_DIR}/dns_acme.log" | |
| # Source acmesh scripts | |
| export ACME_FOLDER="/mnt/mdata/system_tools/acme/acme.sh" # Change this path to reflect yourf environment |
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 timeit | |
| import matplotlib.pyplot as plt | |
| def version_1(category: str) -> tuple[str, str | None, str | None]: | |
| category_list = category.split("-", 4) | |
| category_list_length = len(category_list) | |
| folder_type = category_list[0] | |
| version_tag = category_list[1] if category_list_length > 1 else None | |
| version = category_list[2] if category_list_length > 2 else None |
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 sys | |
| from enum import Enum | |
| from functools import lru_cache | |
| if sys.version_info >= (3, 11): | |
| from enum import StrEnum | |
| else: | |
| class StrEnum(str, Enum): ... |
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 sys | |
| from enum import Enum | |
| from functools import lru_cache | |
| if sys.version_info >= (3, 11): | |
| from enum import StrEnum | |
| else: | |
| class StrEnum(str, Enum): ... |
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 types import MethodType | |
| class Person: | |
| def __init__(self, name): | |
| self.name = name | |
| # A function to add dynamically as a method | |
| def say_hello(self): | |
| return f"Hello, my name is {self.name}" |
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
| class Person: | |
| def __init__(self, name): | |
| self.name = name | |
| def greet(self): | |
| return "Hi there!" | |
| def new_greet(self): | |
| return f"Hello, {self.name}!" |
NewerOlder