Skip to content

Instantly share code, notes, and snippets.

View mvandermeulen's full-sized avatar

Mark mvandermeulen

  • Fivenynes
  • Sydney, Australia
  • 13:47 (UTC +10:00)
View GitHub Profile
@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)" } ?? "")
}
@Erica-Iris
Erica-Iris / 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 {
@developer-commit
developer-commit / capture.swift
Created January 25, 2025 07:32
example by window capture
// origanl code : https://stackoverflow.com/questions/78846311/screencapturekit-example-in-go-c
import Foundation
import ScreenCaptureKit
import CoreGraphics
import AppKit
func captureScreenshot(display: SCDisplay?, window: SCWindow, app: SCRunningApplication,completion: @escaping (NSImage?) -> Void) {
let filter: SCContentFilter
@joeblackwaslike
joeblackwaslike / FastAPI_rules.md
Last active June 27, 2025 17:25
Cursorrules I like

You are an expert in Python, FastAPI, and scalable API development.

Key Principles

  • Write concise, technical responses with accurate Python examples.
  • Use descriptive variable names with auxiliary verbs (e.g., is_active, has_permission).
  • Use lowercase with underscores for directories and files (e.g., routers/user_routes.py).
  • Favor named exports for routes and utility functions.
  • Follow SOLID principles and write clean code.
  • Prefer loosely coupled, cohesive interfaces.
  • High level code should depend on high level abstractions rather than low level implementations.
@d01phin
d01phin / uvloop_socket_ipc.py
Created January 13, 2025 19:05
IPC with uvloop and unix sockets
import asyncio
import os
import uvloop
# Set uvloop as the default event loop policy
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
class UnixSocketIPCServer:
def __init__(self, socket_path):
@mimansajaiswal
mimansajaiswal / A1-claude-artifact-llm-chat-to-md.md
Last active January 23, 2025 22:21
Creating a tiny web app that formats md exports from github copilot, chat gpt and claude to the markdown format I want

Note

mimansajaiswal: write me a small app that takes in text like this:

"mimansajaiswal: write notation-fold.ts similar to notion-highlight.ts where if a region is marked to be collapsed, it allows you to collapse it and expand it similar to code folding in ides. this is how it works with multiple lines in code highlight: Use [!code highlight] to highlight a line. ts console.log('Not highlighted') console.log('Highlighted') // [!code highlight] console.log('Not highlighted') Renders (with custom CSS rules): console.log('Not highlighted') console.log('Highlighted') console.log('Not highlighted') // [!code highlight] outputs: The outer

 tag is modified: 
 You can also highlight multiple lines with a single comment: ts // [!code highlight:3] console.log('Highlighted') console.log('Highlighted') console.log('Not highlighted') Renders: console.log('Highlighted') console.log('Highlighted') console.log('Not highlighted')"

and a

@ismasan
ismasan / Claude.mkd
Created January 10, 2025 14:53
Discord DDD-CQRS-ES aggregate boundaries discussion
  1. The discussion started with a question about when to use strong consistency (aggregates) versus eventual consistency, using a dinner reservation system as an example.

  2. Main insights about consistency and design:

  • Consistency boundaries should generally be kept small, ideally supporting single-concurrent-user operations
  • Eventual consistency can sometimes provide better business solutions, allowing for compensatory measures (like waitlists or discounts) rather than simple rejections
  • Consistency boundaries are discovered rather than defined, based on what decisions need to be made together
  1. Key principles about aggregates:
@jamesparsloe
jamesparsloe / autogit.py
Created January 10, 2025 10:30
Silly little script I use to sync my Obsidian notes to GitHub with a descriptive commit message
"""
Commit with a message generated by Claude and push.
"""
import argparse
import os
import subprocess
import anthropic
@kelechi2020
kelechi2020 / setup-mcp.md
Last active January 11, 2025 23:50

Guide to setting up Claude MCP on a MacBook

  1. Install Node.js
    Download the latest LTS version from Node.js.
    Verify installation:
    node --version
    npm --version
@andytriboletti
andytriboletti / social.py
Created January 8, 2025 19:12
Social media manager that integrates X, Instagram, LinkedIn, and uses local AI tools for content generation.
#open source code generated with Claude by Andy
#[email protected]
#The Postiz project is now AGPL.
#this code is public domain
import requests
import json
import time
from datetime import datetime
import schedule