Skip to content

Instantly share code, notes, and snippets.

View wolfired's full-sized avatar
🤣

LinkWu wolfired

🤣
View GitHub Profile
@wolfired
wolfired / README.md
Created August 28, 2025 10:08
bresenham's circle algorithm
$$\text{圆方程:} r^2 - x^2 - y^2 = 0$$ $$x_0 = r$$ $$y_0 = 0$$
@wolfired
wolfired / README.md
Last active August 28, 2025 10:08
Bresenham's line algorithm
$$\text{直线方程:} y - ax - b = 0$$ $$\text{斜率:} a = \frac{dy}{dx}$$ $$dy = y1 - y0$$
@wolfired
wolfired / str.h
Created August 16, 2025 06:04
a simple char buffer
#ifndef STR_H
#define STR_H
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct _Str {
int rdx;
@wolfired
wolfired / simple_git_ipfs.sh
Created July 11, 2025 05:44
git使用ipfs存储大文件的简易方案
# touch .gitattributes
# echo '*.png filter=ipfs binary' >> .gitattributes
# $HOME/.ipfs needs to be backed up on a schedule
if ! git diff --quiet || ! git diff --cached --quiet; then
echo '⚠️ 工作区或暂存区有未提交的更改'
exit 1
elif [[ -n "$(git ls-files --others --exclude-standard)" ]]; then
echo '⚠️ 存在未跟踪的新文件'
@wolfired
wolfired / git_memo.md
Last active June 20, 2025 08:10
Git Memo
  1. 仓库SSH URL特殊处理

git仓库的ssh url有两种格式

  • git@host:user/repo_name
  • ssh://host:port/repo

sublime_merge能正常使用上面的第一种,但无法正常使用第二种,需要补全成

ssh://git@host:port/repo

@wolfired
wolfired / template.md
Last active June 12, 2025 02:36
c结构体内存分配与销毁统一模式

sun.h

#ifndef SUN_H
#define SUN_H

#include <stdint.h>
#include <stdlib.h>

typedef struct Sun_ {
@wolfired
wolfired / GoodCommit.md
Last active May 29, 2025 03:48
一个好的commit

一个好的commit

  • 有意义:完成一件事
  • 独立:专注一件事,在重构就别修bug,在修bug就别新增功能或特性
  • 完整:代码能跑通,不能让项目挂,不能让测试挂
  • 包含:
    • 类型(type,必选)
      • feat(Feature)
        • 用途:新增功能或特性
  • 示例:feat: 添加用户登录功能
@wolfired
wolfired / onedev.patch
Last active June 19, 2025 08:51
onedev补丁:只取消第一个未完成的任务外的其它任务
diff --git a/server-core/src/main/java/io/onedev/server/job/DefaultJobManager.java b/server-core/src/main/java/io/onedev/server/job/DefaultJobManager.java
index dc844133c9..44c4153df0 100644
--- a/server-core/src/main/java/io/onedev/server/job/DefaultJobManager.java
+++ b/server-core/src/main/java/io/onedev/server/job/DefaultJobManager.java
@@ -393,7 +393,9 @@ public class DefaultJobManager implements JobManager, Runnable, CodePullAuthoriz
Optional.ofNullable(pullRequest), paramMapToQuery)) {
if (unfinished.getId() < buildId
&& (pullRequest != null || gitService.isMergedInto(project1, null, unfinished.getCommitId(), commitId))) {
- cancel(unfinished);
+ if (Build.Status.PENDING == unfinished.getStatus()) {
@wolfired
wolfired / cs1_6_shortcut.md
Last active September 1, 2025 11:15
CS1.6数字键盘快捷购买武将弹药装备

cs2屏蔽聊天cl_mute_all_but_friends_and_party 1

install_path/cstrike/config.cfg


bind "-" "bot_kick"
bind "=" "bot_add"
bind "BACKSPACE" "bot_kill"
@wolfired
wolfired / sort.md
Last active March 4, 2025 05:38
排序算法
void swap(uint8_t* a, uint8_t* b) {
    uint8_t t = *a;
    *a        = *b;
    *b        = t;
}

void merge(uint8_t* dest,
           uint8_t* left,