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 / 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
@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>
@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
"""
package main
import (
"context"
"errors"
"fmt"
"io"
"log"
"net/rpc"
"net/rpc/jsonrpc"
@fy0
fy0 / mb_simple_demo.cpp
Last active May 5, 2018 11:08
包含创建窗口,JS/CPP互调,最大化/最小化,无边框窗口拖动,获取窗口句柄,根据exe文件图标设置窗口图标、只允许单实例等等
/**
Copyright (c) 2018 fy
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
@fy0
fy0 / mpt.py
Last active November 12, 2017 10:24
MicroPython Simple Terminal
import os
import sys
def run():
head, *data = input('> ').strip().split(' ')
if head in ['ls', 'dir']:
path = data[0] if len(data) else ''
for i in os.listdir(path):
print(i)