Skip to content

Instantly share code, notes, and snippets.

View CodeBoy2006's full-sized avatar
📚
Learning CS and SE

codeboy CodeBoy2006

📚
Learning CS and SE
View GitHub Profile
@CodeBoy2006
CodeBoy2006 / Get_root_file_example.py
Last active March 19, 2020 14:20
Python 获取根目录示例,可以用在目录混乱的时候统一路径
# Python 获取根目录
#Windows
import os
curPath = os.path.abspath(os.path.dirname(__file__))
rootPath = curPath[:curPath.find("myProject\\")+len("myProject\\")] # 获取myProject,也就是项目的根路径
dataPath = os.path.abspath(rootPath + 'data\\train.csv') # 获取tran.csv文件的路径
#Mac
import os
@CodeBoy2006
CodeBoy2006 / String and BASE64.js
Created May 1, 2020 06:10
字符串与BASE64转换,Javascript 中文不报错不乱码
btoa(unescape(encodeURIComponent( string ))) //字符串转BASE64
atob(unescape(encodeURIComponent( string ))) //BASE64转字符串
@CodeBoy2006
CodeBoy2006 / OI.h
Created October 14, 2021 12:47
OI专用头文件,包含自带调试模式的IO类,值得拥有
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
@CodeBoy2006
CodeBoy2006 / config.cpeditor
Last active September 10, 2022 12:57
备份CPEditor配置
[General]
tab_width=4
cursor_width=1
geometry=@Rect(1468 225 813 600)
editor_font=@Variant(\0\0\0@\0\0\0\x1c\0J\0\x65\0t\0\x42\0r\0\x61\0i\0n\0s\0 \0M\0o\0n\0o@0\0\0\0\0\0\0\xff\xff\xff\xff\x5\x1\0\x32\x10)
use_custom_application_font=true
custom_application_font=@Variant(\0\0\0@\0\0\0\fe\xb9kc|\x97W\x6{\x80OS@(\0\0\0\0\0\0\xff\xff\xff\xff\x5\x1\0\x32\x10)
default_language=C++
format_on_manual_save=false
format_on_auto_save=false
@CodeBoy2006
CodeBoy2006 / caryon.h
Created September 10, 2022 14:24
CarYon 数据生成器
#ifndef CARYON_H
#define CARYON_H
#ifndef _GLIBCXX_NO_ASSERT
# include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
ffmpeg -y -f lavfi -i "
color=white@0.0:1700x520:d=<SECONDS>,
format=rgba,
drawtext=
fontcolor=black:
fontsize=600:
fontfile=<FONT>.ttf:
text='%{eif\:(<SECONDS>-t)/60\:d\:1}\:%{eif\:mod(<SECONDS>-t, 60)\:d\:2}':
x=(w-text_w)/2:
y=(h-text_h)/2:
@CodeBoy2006
CodeBoy2006 / claude_3.5_sonnet_artifacts.xml
Created August 30, 2024 12:41 — forked from dedlim/claude_3.5_sonnet_artifacts.xml
Claude 3.5 Sonnet, Full Artifacts System Prompt
<artifacts_info>
The assistant can create and reference artifacts during conversations. Artifacts are for substantial, self-contained content that users might modify or reuse, displayed in a separate UI window for clarity.
# Good artifacts are...
- Substantial content (>15 lines)
- Content that the user is likely to modify, iterate on, or take ownership of
- Self-contained, complex content that can be understood on its own, without context from the conversation
- Content intended for eventual use outside the conversation (e.g., reports, emails, presentations)
- Content likely to be referenced or reused multiple times
Begin by enclosing all thoughts within <thinking> tags, exploring multiple angles and approaches.
Break down the solution into clear steps within <step> tags. Start with a 20-step budget, requesting more for complex problems if needed.
Use <count> tags after each step to show the remaining budget. Stop when reaching 0.
Continuously adjust your reasoning based on intermediate results and reflections, adapting your strategy as you progress.
Regularly evaluate progress using <reflection> tags. Be critical and honest about your reasoning process.
Assign a quality score between 0.0 and 1.0 using <reward> tags after each reflection. Use this to guide your approach:
0.8+: Continue current approach
0.5-0.7: Consider minor adjustments
Below 0.5: Seriously consider backtracking and trying a different approach
@CodeBoy2006
CodeBoy2006 / scan_project.cpp
Created April 4, 2025 01:09
C++ Windows tool: Scans dir, outputs filtered tree & file contents (Markdown), copies to clipboard (for LLMs/docs).
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <filesystem> // Requires C++17
#include <sstream>
#include <stdexcept>
#include <algorithm>
#include <windows.h> // For Windows Clipboard API
@CodeBoy2006
CodeBoy2006 / Vision3D.js
Last active August 2, 2025 02:52
SillyTavern 3D视野插件 - 让角色的视野可视化 (通过酒馆助手加载)
// ==UserScript==
// @name 全局脚本 - 3D视野组件 (单 Canvas v10.8 Bbox Fixed)
// @version 10.8
// @description 实现遮挡物半透明效果,当模型包裹另一个时,外层模型自动透视,支持玩家显示开关。已优化移动端触摸支持和性能。新增并修复了bbox格式兼容。
// @author Codeboy, 优化 by AI
// @match */*
// @grant none
// ==/UserScript==
(function () {