docker logs container
docker logs --tail 100 container
docker logs -f container
#!/usr/bin/env bash | |
# server-snapshot.sh | |
# Purpose: Print a concise, human-readable snapshot of a Linux server state. | |
# Safe defaults: exits on errors/undefined vars; degrades when optional tools are missing. | |
# Intended usage: run manually or via cron; pipe to file for later inspection. | |
set -euo pipefail | |
# Ensure predictable output regardless of system locale | |
export LC_ALL=C |
import requests | |
import os | |
def fetch_cloudflare_ips(): | |
url = "https://www.cloudflare.com/ips-v4/" | |
response = requests.get(url) | |
if response.status_code == 200: | |
return response.text.strip().split("\n") | |
else: | |
raise Exception(f"Failed to fetch Cloudflare IPs: {response.status_code}") |
// Variant type for clarity | |
type TZVariant = { | |
name: string; // Human-readable timezone name | |
iana: string[]; // One or more IANA zones (first is canonical) | |
note?: string; // Optional note (DST/legacy/unofficial/etc.) | |
}; | |
// Map: Abbreviation -> possible variants | |
export const TZ_MAP_PART_A: Record<string, TZVariant[]> = { | |
// Military letter zone. Note the inverted sign in Etc/GMT*: Etc/GMT-1 === UTC+1 |
// Early Hints | |
app.Use(func(c *fiber.Ctx) error { | |
if c.Method() != fiber.MethodGet || | |
!strings.Contains(c.Get("Accept", ""), "text/html") { | |
return c.Next() | |
} | |
for _, entry := range Manifest { | |
switch ext := strings.ToLower(filepath.Ext(entry.File)); ext { | |
case ".js": | |
c.Append("Link", fmt.Sprintf("</%s>; rel=preload; as=script", entry.File)) |
/** | |
* Formatting options for prettyNumber. | |
* Extends all standard Intl.NumberFormatOptions and adds an optional locale override. | |
*/ | |
export interface PrettyNumberOptions extends Intl.NumberFormatOptions { | |
/** BCP 47 language tag, e.g. 'en-US', 'ru-RU'. Defaults to 'en-US'. */ | |
locale?: string; | |
} | |
/** Cache key → Intl.NumberFormat instance */ |
#!/usr/bin/env python3 | |
import re | |
import csv | |
import unicodedata2 | |
import urllib.request | |
EMOJI_TEST_URL = 'https://unicode.org/Public/emoji/latest/emoji-test.txt' | |
MIN_CHAR = 0x20 | |
MAX_CHAR = 0x100000 | |
OUTPUT_CSV = 'unicode.csv' |
@utility scrollbar-hide { | |
-ms-overflow-style: none; | |
scrollbar-width: none; | |
&::-webkit-scrollbar { | |
display: none; | |
} | |
} |
/** | |
* Convert various source URLs (GitHub, npm, unpkg, WordPress) to jsDelivr CDN URLs. | |
* @param sourceUrl — the original file URL | |
* @returns jsDelivr URL or null if the format is not recognized | |
*/ | |
export function toJsDelivr(sourceUrl: string): string | null { | |
const url = new URL(sourceUrl); | |
const { hostname, pathname, searchParams } = url; | |
// GitHub: handle both github.com/blob/... and raw.githubusercontent.com |
import { useEffect } from "preact/hooks"; | |
// Custom hook that calls handler when a click is detected outside of the given ref element | |
const useOnClickOutside = ( | |
ref: { current: HTMLElement | null }, | |
handler: (event: MouseEvent | TouchEvent) => void | |
) => { | |
useEffect(() => { | |
// Listener that calls handler if click is outside of ref element | |
const listener = (event: MouseEvent | TouchEvent) => { |