Hello World
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
def split_status(text: str, length: int = 280, footer: bool = False) -> list[str]: | |
text = text.replace("\r", "").strip() | |
lines = text.split("\n") | |
out = [] | |
cur = [] | |
curs = 0 | |
fotempla = "\n(%s/%s)" | |
if footer: | |
length -= len(fotempla) |
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 RPi.GPIO as GPIO | |
import random | |
import time | |
#basepins = 14, 15, 18, 23, 24, 25, 8 | |
#extrapins = 7, 11, 9, 10, 22, 27, 17, 2, 3, 4 | |
#pins = list(basepins + extrapins) |
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
<?php | |
ignore_user_abort(true); | |
$sign = $_SERVER['HTTP_X_SIGNATURE_ED25519'] ?? ''; | |
$stam = $_SERVER['HTTP_X_SIGNATURE_TIMESTAMP'] ?? ''; | |
if (strlen($sign) !== 128) { | |
http_response_code(405); | |
echo "Bad signature length\n"; | |
#error_log("Bad signature length " . strlen($sign) . " when it needs 128 "); |
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 time, shutil, os | |
class AtomicWrittenFile: | |
def __init__(self, name, mode="w"): | |
self.temp = f"{name}.{int(time.time()):X}.{os.getpid()}.tmp" | |
self.file = open(self.temp, mode) | |
self.name = name | |
def __enter__(self): | |
return self.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
#[allow(unused)] | |
#[derive(Debug, Clone, Copy, PartialEq)] | |
pub struct Vector2 { | |
pub x: f64, | |
pub y: f64, | |
} | |
#[allow(unused)] | |
#[derive(Debug, Clone, Copy, PartialEq)] | |
pub struct Vector3 { |
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
def itrd(obj, file=None): | |
stack = [] | |
path = "obj" | |
pos = 0 | |
def push(pathh, ob): | |
nonlocal obj, pos, path | |
stack.append((obj, pos, path)) | |
obj, pos, path = ob, 0, pathh |
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
use std::path::Path; | |
fn main() { | |
let path = Path::new(".").canonicalize().unwrap(); | |
println!("{:?}", path); | |
listdir(path.as_path()); | |
} | |
fn listdir(path: &Path) { | |
for a in path.read_dir().unwrap() { |
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
user yeen; | |
worker_processes auto; | |
pid /run/nginx.pid; | |
include /etc/nginx/modules-enabled/*.conf; | |
events { | |
worker_connections 768; | |
# multi_accept on; | |
} |
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
<?php | |
declare(strict_types=1); | |
namespace OCA\YeenMonitor\AppInfo; | |
use OCP\AppFramework\Bootstrap\IRegistrationContext; | |
use OCP\AppFramework\Bootstrap\IBootstrap; | |
use OCP\AppFramework\Bootstrap\IBootContext; | |
use OCP\EventDispatcher\IEventDispatcher; |
NewerOlder