Skip to content

Instantly share code, notes, and snippets.

View MicroCBer's full-sized avatar
💭
Studying

MicroBlock MicroCBer

💭
Studying
View GitHub Profile
@MicroCBer
MicroCBer / wall_convert.py
Last active March 28, 2022 23:42
Convert models into cubes which can be used by ScuffedWalls ModelToWalls func.
# How to use this
# 1. Rename the model you want to convert into '1'
# 2. Copy the script into the text editor in the blender (you can find it in the Scripting tab, create a file and rename it into gen.py if needed)
# 3. Click the start button.
# It may spend a long time to covert it due to the slow runtime speed of python. Blender might keep no response. Just wait patiently.
# You can see the progress in the console. Open the console by clicking Window->Switch system console.
# By MicroBlock
# 2021.2.1
# If you are changing the script and republishing it, please include the original author and address
@MicroCBer
MicroCBer / 403.html
Created March 7, 2022 04:39
extremely short auto reload&show cc protection tip code
<body onload="a=30;setInterval(()=>{t.innerText=`aa${(a--)||location.reload()}`},1000)"><c style="text-align: center;"><h1>xxxx</h1><h3 id=t><h3>WGzeyu
@MicroCBer
MicroCBer / start.sh
Created March 19, 2023 07:11
Start a typescript server with esbuild-register with pm2
pm2 start server.ts --interpreter="node" --node-args="-r esbuild-register"
@MicroCBer
MicroCBer / dom_select.js
Last active March 25, 2023 05:15
Prompt for a dom
function selectAnyElement() {
return new Promise((resolve, reject) => {
if(document.querySelector('.tinyNCM-Selected')){
reject("Already selecting");
return;
}
// create fixed tips
let tips = dom("div",
{
style: {
@MicroCBer
MicroCBer / ncm.css
Created April 8, 2023 07:37
NCM PC Client CSS
This file has been truncated, but you can view the full file.
// extracted from ncm 2.10.8, with lots of betterncm plugins installed
.playbackrate-settings { right: 140px !important; }.playbackrate-settings-popup { position: fixed; transition: opacity 0.2s ease 0s, transform 0.2s ease 0s; opacity: 0; padding: 15px; border-radius: 10px; background-color: rgba(0, 0, 0, 0.204); backdrop-filter: blur(10px); transform: translateY(10px); z-index: 99999; color: white; }.playbackrate-settings-popup * { color: white; }.pbr-slider-wrapper { display: flex; flex-direction: column; align-items: flex-start; margin-bottom: 20px; position: relative; padding-bottom: 4px; overflow: hidden; transition: all 0.3s ease 0s; }.pbr-slider-label { margin-bottom: 12px; }.pbr-slider { appearance: none; background-color: rgba(223, 225, 228, 0.133); border-radius: 20px; width: 100%; height: 8px; }.pbr-slider:first-child { margin-top: 5px; }.pbr-slider::-webkit-slider-thumb { appearance: none; width: 10px; height: 10px; background: rgb(255, 255, 255); cursor: pointer; border-radius: 10px; transition
@MicroCBer
MicroCBer / inspect-object.js
Last active July 18, 2023 12:52
Inspect operations on an object
const apiMap = {}
function make_proxy(obj, path = '') {
if (typeof obj === "object" || typeof obj === "function")
return new Proxy(obj, {
get(target, prop) {
if (prop === '_origin_') return obj._origin_ ?? obj;
const fullPath = path ? `${path}.${String(prop)}` : String(prop);
@MicroCBer
MicroCBer / findPaths.js
Last active April 20, 2024 08:35
find value in object
function findPaths(obj, kwd, maxDepth = 1, exclude=[]) {
const paths = [];
function exploreObject(obj, path, depth) {
if (depth > maxDepth) {
return;
}
for (const key in obj) {
const value = obj[key];
@MicroCBer
MicroCBer / ProgressFloatingWindow.js
Created July 13, 2023 17:32
进度浮窗,支持多窗口
class FloatingWindow {
static instanceCount = 0;
constructor() {
let body = document.body;
this.containerDiv = document.createElement('div');
this.containerDiv.setAttribute('style',
`bottom: ${10 + 110 * FloatingWindow.instanceCount}px;`
);
@MicroCBer
MicroCBer / cloneEx.js
Created August 17, 2023 08:22
Create an element delegate/proxy in js
const createElementDelegate = (ele, config) => {
const old2NewMap = new WeakMap(), new2OldMap = new WeakMap();
const clone = (ele, {cloneParent, syncProps, delegateEvents=true, delayedElementListChange}={}) => {
if(ele == null) return ele;
// clone, and delegate events, and preserve parent classes
let cloned = ele.cloneNode();
old2NewMap.set(ele, cloned);
new2OldMap.set(cloned, ele);
// clone child also
@MicroCBer
MicroCBer / fanctrl.sh
Created January 27, 2024 12:21
Basic fan control script for P40
#!/bin/bash
# Check if running with sudo
if [ "$EUID" -ne 0 ]; then
echo "Please run with sudo:"
echo "sudo $0"
exit
fi
# Enable PWM