Skip to content

Instantly share code, notes, and snippets.

View 0x1306a94's full-sized avatar
😶
depressed

0x1306a94 0x1306a94

😶
depressed
  • 01:36 (UTC +08:00)
View GitHub Profile
@0x1306a94
0x1306a94 / XcodeLLM.md
Created July 1, 2024 02:02 — forked from Kyle-Ye/XcodeLLM.md
Enable XcodeLLM for ChinaSKU Mac on macOS 15 Beta 1

Warning

The following guide need to disable SIP to work.

Please confirm the risk of disabling the SIP by yourself.

Another solution which does not require disabling SIP is currently under investigation.

Step 0

Reboot into Recovery OS + Disable SIP

@0x1306a94
0x1306a94 / ChoasLinesShader.metal
Created May 22, 2024 05:05 — forked from realvjy/ChoasLinesShader.metal
Choas Lines - Metal Shader
// Lines
float hash( float n ) {
return fract(sin(n)*753.5453123);
}
// Slight modification of iq's noise function.
float noise(vector_float2 x )
{
vector_float2 p = floor(x);
vector_float2 f = fract(x);
@0x1306a94
0x1306a94 / build_ios.py
Created September 21, 2023 08:12
mars build xcframework
#!/usr/bin/env python
import os
import sys
import glob
from mars_utils import *
SCRIPT_PATH = os.path.split(os.path.realpath(__file__))[0]
@0x1306a94
0x1306a94 / swift_macro_not_use_spm.md
Last active March 28, 2024 12:35
Swift Macro does not use SPM integration

Swift Macro 不使用 Swift Package Manager如何集成

  • Swift Macro分为两部分,一部分为宏的具体实现(编译器插件),一部分为Macro Lib用于导出宏定义以及所需要的附属代码,这里说的不使用SPM指的是编译器插件这部分
  • 仔细观察Xcode使用SPM集成Macro时,在编译命令中通过-load-plugin-executable参数指定了对应宏实现的插件可执行文件路径
  • 同时在swift源码中也找到了相关参数TypeCheckMacros.cpp TypeCheckMacros.cpp
  • swift源码中可得知,宏实现插件即可以是动态库(dylib)也可以是可执行文件
  • 系统内置的宏实现是通过 -plugin-path <dylib path> 加载
  • 内置的宏实现动态库在Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/Lib/swift/host/plugins
具体步骤
  • 编写宏实现代码,这一步可以通过SPM也可以直接通过Xcode创建命令行程序项目,完成宏实现代码编写
@0x1306a94
0x1306a94 / simd_macos_def.h
Last active June 5, 2023 12:30
TenniS SIMD
// source https://github.com/TenniS-Open/TenniS/blob/ef6c8332809a021d0eb5842c0f9d32a7f0b07f96/include/kernels/common/simd_def/simd_base_def.h
#ifndef TENSORSTACK_KERNELS_COMMON_SIMD_DEF_SIMD_MACOS_DEF_H
#define TENSORSTACK_KERNELS_COMMON_SIMD_DEF_SIMD_MACOS_DEF_H
#ifdef TS_USE_MACOS_SIMD
#include <simd/vector.h>
typedef struct _simd_f32x4x3 {
simd_float4 val[3];
} _simd_f32x4x3;
//
// main.cpp
// FaceFeaturesCompare
//
// Created by king on 2023/5/13.
//
#include <chrono>
#include <ctime>
#include <iostream>
use core::slice;
use std::alloc::{alloc, dealloc, Layout};
use std::cmp::min;
const DEFAULT_UNIT_SIZE: usize = 128;
#[derive(Debug)]
pub enum Seek {
Start,
Cur,
@0x1306a94
0x1306a94 / base64_cxx_tmp.cc
Created February 18, 2023 00:16 — forked from unixzii/base64_cxx_tmp.cc
A Base64 implementation using C++ template metaprogramming.
template<auto... Val>
struct List;
template<>
struct List<> {
template<auto Elem>
using Append = List<Elem>;
};
template<auto Head, auto... _Rest>
import Foundation
class Throttle {
private let queue: DispatchQueue
private let delay: Double
private var delayedBlock: (() -> Void)?
private var cancelBlock: (() -> Void)?
private var timer: DispatchSourceTimer?
private var isReady = true
private var hasDelayedBlock: Bool { delayedBlock != nil }
@0x1306a94
0x1306a94 / skip_translate.js
Last active March 1, 2024 14:23
让谷歌翻译插件翻译网页的时候,绕过代码块和一些无需翻译的元素
// ==UserScript==
// @name 谷歌翻译绕过代码块(适配github,mathworks等)
// @version 0.2
// @description 让谷歌翻译插件翻译网页的时候,绕过代码块和一些无需翻译的元素
// @match http*://*/*
// @match localhost:*
// @match 127.0.0.1:*
// @match *
// @license MIT
// @grant none