Skip to content

Instantly share code, notes, and snippets.

View ghostflyby's full-sized avatar

ghostflyby ghostflyby

  • Shanghai
  • 08:41 (UTC +08:00)
View GitHub Profile
@ghostflyby
ghostflyby / tokenizer.swift
Created March 16, 2025 15:22
swift NaturalLanguage framwork tokenization
#!/usr/bin/env swift
import Foundation
import NaturalLanguage
import Cocoa
// Check if there are input arguments
guard CommandLine.arguments.count > 1 else {
print("Usage: nlp_split.swift <input_string>")
exit(1)
@ghostflyby
ghostflyby / MDQuery.swift
Last active December 28, 2024 16:53
NSMetaDataQuery example
#!/usr/bin/env swift
import Cocoa
class MetadataQueryExample: NSObject {
var query: NSMetadataQuery?
override init() {
super.init()
startQuery()
}
@ghostflyby
ghostflyby / recipe.ts
Created December 28, 2024 14:10
minecraft add recipe typescript type example
type item = "minecraft:stick" | "minecraft:fuck" | "minecraft:wool" | "mymod:ingot"
type letters = 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I'
type craftInput = letters | ' '
type craftInputLine = `${craftInput}${craftInput}${craftInput}`
type craftInputMatrix = [craftInputLine, craftInputLine, craftInputLine]
@ghostflyby
ghostflyby / copy.swift
Created December 25, 2024 11:16
Swift script copy files to NSPasteBoard
#!/usr/bin/env swift
import AppKit
import Foundation
let arguments = CommandLine.arguments
guard arguments.count > 1 else {
print("Usage: script.swift <file-path1> <file-path2> ...")
exit(1)
@ghostflyby
ghostflyby / schema.json
Created March 13, 2024 10:39
LiteLoaderQQNT-manifest-schema
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "LiteLoaderQQNT Plugin manifest",
"properties": {
"manifest_version": {
"type": "integer",
"enum": [
1,
2,
3,
@ghostflyby
ghostflyby / cloudflare.yaml
Last active January 29, 2025 17:26
clash rule set for cloudflare
payload:
- 173.245.48.0/20
- 103.21.244.0/22
- 103.22.200.0/22
- 103.31.4.0/22
- 141.101.64.0/18
- 108.162.192.0/18
- 190.93.240.0/20
- 188.114.96.0/20
- 197.234.240.0/22
@ghostflyby
ghostflyby / Tencent-trace.yaml
Created February 25, 2024 07:57
clash rule set for qq trace
payload:
- otheve.beacon.qq.com
- tpstelemetry.tencent.com
- h.trace.qq.com
- report.gamecenter.qq.com
const headers = $request.headers;
let ua_start = headers['User-Agent'].match(/(Mozilla\/5.0 \()(.+?)\)/);
if (ua_start == null) {
$done({});
} else {
ua_start = ua_start[0];
}
delete headers["user-agent"];