Skip to content

Instantly share code, notes, and snippets.

View mvandermeulen's full-sized avatar

Mark mvandermeulen

  • Fivenynes
  • Sydney, Australia
  • 13:07 (UTC +11:00)
View GitHub Profile
@clemlesne
clemlesne / enum.py
Last active August 17, 2025 03:26
Embed documentation, pretty name, and value, in a native Python enum that can still be serialized with Pydantic.
from enum import StrEnum
def main() -> None:
print(MyEnum.INFRASTRUCTURE_AS_CODE)
print(str(MyEnum.INFRASTRUCTURE_AS_CODE))
print(MyEnum.INFRASTRUCTURE_AS_CODE.__doc__)
class StrEnumWithDocstring(StrEnum):
@clemlesne
clemlesne / redis_bytes_io.py
Last active June 27, 2025 17:23
Stream a blob with the native BytesIO and AsyncIterable Python interfaces, from async Redis.
import asyncio
import io
from asyncio import AbstractEventLoop
from collections.abc import AsyncGenerator, Awaitable, Buffer
from contextlib import asynccontextmanager
from logging import getLogger
from os import environ as env
from threading import Thread
from typing import TypeVar, cast
@cmin764
cmin764 / async-redis-cache.py
Created February 13, 2025 17:11
Async Redis caching (with cluster mode support)
import os
from redis.asyncio import Redis, RedisCluster
from servicelib.logging import get_our_logger
logger = get_our_logger(__name__)
class RedisCache:
@SoMaCoSF
SoMaCoSF / README.md
Created February 13, 2025 01:38
MCP (Model Context Protocol) Documentation and Integration Guide

MCP (Model Context Protocol) Documentation

A comprehensive toolkit for managing AI model interactions within the Cursor editor environment, featuring an LCARS-inspired interface design and real-time communication capabilities.

Features

  • 🌟 Real-time context awareness
  • 🔄 Multi-profile support
  • 🔌 WebSocket-based communication
  • 🧩 Extensible plugin architecture
@adam-zethraeus
adam-zethraeus / LogUtil.swift
Last active September 2, 2025 20:54
OSLog visualizer
import UniformTypeIdentifiers
import SwiftUI
import OSLog
import Foundation
import Observation
extension Logger {
public static func make(file: StaticString = #file, category: StaticString? = nil) -> Logger {
Logger(
subsystem: Bundle.main.bundleIdentifier ?? "some.recorder",
@0xdevalias
0xdevalias / google-image-search-url-parameters.md
Created January 29, 2025 03:50
Some notes on Google Image search URL parameters

Google Image Search URL Parameters

Some notes on Google Image search parameters.

Table of Contents

@JamesSedlacek
JamesSedlacek / View+OpenUrl.swift
Last active June 30, 2025 13:50
This file provides a safe way to open URLs in SwiftUI applications.
//
// View+OpenUrl.swift
//
// Created by James Sedlacek on 11/26/24.
//
/// This file provides a safe way to open URLs in SwiftUI applications.
/// It adds a view modifier that handles URL opening with user confirmation
/// and multiple opening options (browser, in-app, or copy to clipboard).
///
@sohamb1390
sohamb1390 / AnalyticsManager.swift
Last active February 24, 2025 20:45
Complete code gist of Analytics Service and Analytics Manager
import Foundation
import UIKit
@MainActor
final class AnalyticsManager {
static let manager: AnalyticsManager = AnalyticsManager()
private var services: [any AnalyticsService] = []
private init() {}
@Amzd
Amzd / Version.swift
Last active February 24, 2025 20:45
Semantic Version decoding in Swift. Does not validate the identifier.
/// https://gist.github.com/Amzd/93f2e7b4712242ec4e17476146f528a2
public struct Version: Codable {
public var major: UInt
public var minor: UInt
public var patch: UInt
public var identifier: String?
public var stringValue: String {
"\(major).\(minor).\(patch)" + (identifier.flatMap { "-\($0)" } ?? "")
}
@irisWirisW
irisWirisW / a.swift
Last active February 24, 2025 20:45
保存到app default
private let defaults = UserDefaults.standard
private let usernameKey = "username"
private let passwordKey = "password"
func saveLoginInfo(username: String, password: String) {
defaults.set(username, forKey: usernameKey)
defaults.set(password, forKey: passwordKey)
}
func getSavedUsername() -> String {