This file contains 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 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 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 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 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 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 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 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}!" |
This file contains 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 | |
# | |
# PROVIDE: iscsi_mount | |
# REQUIRE: NETWORKING | |
# BEFORE: LOGIN | |
# KEYWORD: shutdown | |
. /etc/rc.subr | |
name="iscsi_mount" | |
rcvar="iscsi_mount_enable" |
This file contains 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 | |
# PROVIDE: iscsi-zfs | |
# REQUIRE: iscsid iscsictl mountcritlocal var | |
# KEYWORD: nojail shutdown | |
. /etc/rc.subr | |
name="iscsi_zfs" | |
start_cmd="${name}_start" |