Skip to content

Instantly share code, notes, and snippets.

View bloatfan's full-sized avatar
🤒
Out sick

bloatfan bloatfan

🤒
Out sick
View GitHub Profile

Software Engineering Philosophy & Development Protocol

1. Global Integrity & Topology

  • System Awareness: Before implementation, map the dependency graph and system topology. Ensure local changes preserve global invariants and do not trigger "Shotgun Surgery."
  • Orthogonality: Design for independence. Ensure that changes in one module do not leak side effects into others. Minimize coupling and maximize cohesion.

2. Intent & Abstraction Hierarchy

  • Intent-Revealing Design: Prioritize human readability and intent over machine cleverness. Use naming that explains "Why" rather than "How."
  • Single Level of Abstraction (SLA): Adhere strictly to the Single Responsibility Principle (SRP). Each function must operate at a consistent level of abstraction and have exactly one reason to change.
@sunny352
sunny352 / rules.md
Last active January 13, 2026 01:00
Cursor rules

智能编程助手协议 v2.0

1. 角色

首席软件架构师,信奉 "Less is More"。

  • 动手前必须先理解现有系统纹理
  • 删除代码优先于增加代码
  • 遇到复杂递归、并发、算法设计等 LLM 能力边界场景时,必须降速并多次验证

2. 核心哲学

@nicekate
nicekate / app.py
Last active October 23, 2024 12:02
支持 github models的Streamlit应用,可以选择GPT-4o或4o mini,文字或图片对话。
import os
import base64
import streamlit as st
from openai import OpenAI
# 设置环境变量和OpenAI客户端
token = os.environ["GITHUB_TOKEN"]
endpoint = "https://models.inference.ai.azure.com"
model_name = st.sidebar.selectbox("选择模型:", ["gpt-4o", "gpt-4o-mini"])
@selfboot
selfboot / lawer_train.py
Last active September 5, 2025 10:09
Train a classification task, see Full Introduction https://selfboot.cn/2023/12/06/bert_nlp_classify/
#!pip install torch
#!pip install transformers
#!pip install scikit-learn
#!pip install numpy
import json
from sklearn.model_selection import train_test_split
import random
from datetime import datetime
from transformers import BertTokenizer, BertModel
import torch
@ClaraLeigh
ClaraLeigh / Currency.php
Last active September 14, 2024 12:17
Laravel Currency Conversion - Quick workaround
<?php
namespace App\Support;
class Currency
{
/**
* Required base currency
*
* @var null
@todgru
todgru / elasticsearch-setup-apple-macbook-pro-m1.md
Created February 9, 2023 23:52
Install Elasticsearch 7.x on Apple Macbook Pro M1 Ventura 13.2

Elasticsearch Setup Apple MacBook Pro M1

Apple MacBook Pro M1, 32 GB, Ventura 13.2

Documentation based on comments in this Github Elasticsearch issue.

Install Homebrew

@taurusxin
taurusxin / optimize.sh
Created October 30, 2022 18:59
Linux Optimization Script
#!/usr/bin/env bash
echo=echo
for cmd in echo /bin/echo; do
$cmd >/dev/null 2>&1 || continue
if ! $cmd -e "" | grep -qE '^-e'; then
echo=$cmd
break
fi
done
@sidmulajkar
sidmulajkar / wireguard-issue-connecting.md
Created October 10, 2022 18:18
/usr/bin/wg-quick: line 32: resolvconf: command not found

/usr/bin/wg-quick: line 32: resolvconf: command not found

This issue is caused while using the Wireguard in Ubuntu as the installation doesn't come with resolvconf or openresolv

Problem

sid@sid:~$ sudo wg-quick up /etc/wireguard/abc.conf
[sudo] password for sid: 
[#] ip link add abc type wireguard
[#] wg setconf abc /dev/fd/63
@sbailliez
sbailliez / vagrant-vmware-tech-preview-apple-m1-pro.md
Last active May 23, 2025 19:01
Vagrant and VMWare Tech Preview 21H1 on Apple M1 Pro

Vagrant and VMWare Tech Preview 21H1 on Apple M1 Pro

UPDATE November 20, 2022: VMWare Fusion 13

VMWare Fusion 13 is now released. Read Vagrant and VMWare Fusion 13 Player on Apple M1 Pro for the latest.

Summary

This document summarizes notes taken while to make the VMWare Tech preview work on Apple M1 Pro, it originated

@Integralist
Integralist / README.md
Last active January 23, 2026 06:49
Go: timeouts and custom http client #go #http #dns

Server Timeouts
Go Server Timeouts

Tip

Use context.WithTimeout when you need to enforce timeouts on internal operations like database queries or HTTP calls, especially when you want to propagate cancellation signals through the call stack to prevent resource leaks or manage goroutines. It's ideal for fine-grained control within a handler. In contrast, use http.TimeoutHandler when you want a simple way to enforce a timeout on the entire HTTP handler response, particularly when you don’t control the handler logic or don’t need to cancel ongoing work—it only cuts off the response after the timeout but doesn’t stop the underlying processing.

Warning

Be careful when using http.TimeoutHander. If automatically applied to all handlers (as part of a middleware pipeline) then it will not work when it comes to a streaming endpoint (see the relevant Cloudflare article linked in the NOTE below).

**Client Ti