Skip to content

Instantly share code, notes, and snippets.

View fy0's full-sized avatar
🎲
thinking

fy fy0

🎲
thinking
View GitHub Profile
@fy0
fy0 / 幻塔抽卡概率统计.py
Created December 26, 2021 07:53
幻塔抽卡概率统计 v1.0
# 起因:https://nga.178.com/read.php?tid=30008586
# 依赖库:pip install requests lxml cssselect
import re
import requests
from lxml import etree
headers = {
'authority': 'nga.178.com',
'pragma': 'no-cache',
@fy0
fy0 / build.py
Created August 10, 2020 11:58
ungoogled-chromium-performance-test
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2019 The ungoogled-chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
ungoogled-chromium build script for Microsoft Windows
"""
@fy0
fy0 / SnapshotCamera.cs
Created July 29, 2021 02:45 — forked from mickdekkers/SnapshotCamera.cs
Take snapshot images of Prefabs and GameObjects in Unity using Render Textures
using UnityEditor;
using UnityEngine;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
// Object rendering code based on Dave Carlile's "Create a GameObject Image Using Render Textures" post
// Link: http://crappycoding.com/2014/12/create-gameobject-image-using-render-textures/
@fy0
fy0 / 史尔特尔BUG伪代码.ts
Last active April 23, 2021 16:10
史尔特尔BUG伪代码
// 来源: https://www.bilibili.com/video/BV1LB4y1A7VX
/**
生命周期示意图:
https://edotor.net/?engine=dot#digraph%20g%7B%0A%20%20rankdir%3DLR%3B%0A%20%20node%20%5Bshape%3Dbox%5D%3B%0A%0A%20%20%22onAwake%22%20-%3E%20%22onAction%22%20-%3E%20%22onDestroy%22%0A%20%20%0A%20%20%22Buff%E5%8A%A0%E5%85%A5%E7%AE%A1%E7%90%86%E5%99%A8%EF%BC%8C%E8%B0%83%E7%94%A8%22%20-%3E%20%22onAwake%22%20-%3E%20%22%E5%88%B0%E8%BE%BE%E6%89%A7%E8%A1%8C%E6%97%B6%E6%9C%BA%EF%BC%8C%E8%B0%83%E7%94%A8%22%20-%3E%20%22onAction%22%20-%3E%20%22%E5%88%B0%E8%BE%BE%E9%94%80%E6%AF%81%E6%97%B6%E6%9C%BA%EF%BC%8C%E8%B0%83%E7%94%A8%22%20-%3E%20%22onDestroy%22%0A%7D
digraph g{
rankdir=LR;
node [shape=box];
"onAwake" -> "onAction" -> "onDestroy"
@fy0
fy0 / dict_witk_kv_pair.py
Last active April 17, 2021 13:45
pydantic `patternProperties` validator demo
"""
MIT License
Copyright (c) 2021 fy
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
// 程序启动器[win32]
// 一个小玩意,作用就是读取与 exe 同名的 .config 文件,并逐条并行执行,不显示窗口
// 以 # 打头的行忽略
// 用于开机挂载一些自带 cmd 窗口的程序
// 自用 vs2017 编译测试通过
// ver 1.1
// 一个新语法:@命令 可以等待此命令结束后再继续运行
// 例如 @ping 127.1 -n 3 等待3秒
@fy0
fy0 / minievent.ts
Created March 28, 2021 11:29
minievent.ts
// 一个简易事件系统,参考了mitt和nanoevents
// https://github.com/developit/mitt
// https://github.com/ai/nanoevents
// An event handler can take an optional event argument
// and should not return a value
export type EventHandler = (...args: any) => void;
export interface EventsMap {
[event: string]: any;
@fy0
fy0 / script.vue
Created March 1, 2021 02:00
Spine Previewer
<!-- Use preprocessors via the lang attribute! e.g. <template lang="pug"> -->
<template>
<div id="app">
<h1>Spine Previewer</h1>
<div id="player" style="margin-bottom: 10px"></div>
<button ref="holder">Drag JSON/Atlas/Images to Here</button>
<button @click="doSomething" :class="{ disabled: !conditionsOk }">
Load
</button>
<button @click="reset">Reset</button>
# coding: utf-8
# 更新于2017/10/02,python3测试通过
import re
import requests
# 领取 X 铜币
# 每日登录奖励已领取
base_headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.57 Safari/537.36 OPR/40.0.2308.15 (Edition beta)', 'Referer': 'https://www.v2ex.com/signin', 'Origin': 'https://www.v2ex.com'}
package main
import (
"context"
"errors"
"fmt"
"io"
"log"
"net/rpc"
"net/rpc/jsonrpc"