Skip to content

Instantly share code, notes, and snippets.

View cpuwolf's full-sized avatar
🎯
Focusing

Wei Shuai cpuwolf

🎯
Focusing
View GitHub Profile
@cpuwolf
cpuwolf / switch.asm
Created June 11, 2021 06:07
IA real mode, protected mode, 64bit mode, 64bit compat mode
# we can boot from BOOTLOADER function logic_boot_emmc_init()
# please make sure paging is disabled
# before enter into sbft_call
.text
.section REALMODE_CODE, "ax"
.code32
##########################################
/*
* written by Wei Shuai <[email protected]> 2021-Oct
*/
#include <stdio.h>
#include <inttypes.h>
#include <string.h>
typedef struct {
uint64_t b1;
uint64_t b2;
//
// main.cpp
// fdouble
//
// Created by wshuai on 2021/12/29.
//
#include <stdio.h>
void * store[3];
<html>
<head>
<meta charset="utf-8" />
<style type="text/css">
.algolia-autocomplete {
width: 80%;
max-width: 700px;
}
@cpuwolf
cpuwolf / datetime.bat
Created July 24, 2023 09:39
Windows 10 batch get date time string
set hour=%time:~0,2%
if "%hour:~0,1%" == " " set hour=0%hour:~1,1%
echo hour=%hour%
set min=%time:~3,2%
if "%min:~0,1%" == " " set min=0%min:~1,1%
echo min=%min%
set secs=%time:~6,2%
if "%secs:~0,1%" == " " set secs=0%secs:~1,1%
echo secs=%secs%
@cpuwolf
cpuwolf / rmNvidia.ps1
Last active September 24, 2023 22:46
#written by [email protected] 2023 Sep.
#
# Set-WinUILanguageOverride -Language en-US
# pop up msg box for users
#$PSScriptRoot
# get script path
$scriptPath = split-path -parent $MyInvocation.MyCommand.Definition
Write-Host "script dir=$scriptPath"
Add-Type -AssemblyName System.Windows.Forms
@cpuwolf
cpuwolf / run.cmd
Last active September 23, 2023 22:13
run power shell script from batch file
::written by [email protected] 2023 Sep.
::
::must run as administrator
@chcp 437 >nul 2>&1
:: Add value for UAC shield icon:
REG ADD "HKCR\Microsoft.PowerShellScript.1\Shell\runas" /v HasLUAShield /t REG_SZ /d "" /f
:: Add value to create context menu item:
REG ADD "HKCR\Microsoft.PowerShellScript.1\Shell\runas\command" /ve /t REG_EXPAND_SZ /d "\"%%SYSTEMROOT%%\System32\WindowsPowerShell\v1.0\powershell.exe\" -executionpolicy bypass -nologo -file \"%%1\"" /f
@cpuwolf
cpuwolf / gist:2b884e0d9432208a1b54f026f130e039
Created December 21, 2023 09:49
Xiaomi Miot Auto延迟问题,反应慢
Xiaomi Miot Auto是以默认15秒轮询的方式运行。
所以不要用Xiaomi Miot Auto实时触发事件,Node-RED中,最好也用轮询来开始你的逻辑。
对于实时触发事件,我建议放在米家做,比home assitant效果好很多
作者给出了详细的解释,非常合理
https://github.com/al-one/hass-xiaomi-miot/issues/100#issuecomment-909031222
@cpuwolf
cpuwolf / AirScript.js
Last active January 12, 2024 06:12
金山文档数据表查询脚本AirScript
//
// Get a date object for the current time
var d = new Date();
// Set it to one month ago
d.setMonth(d.getMonth() - 1);
d.setDate(1)
// Zero the time component
d.setHours(0, 0, 0, 0);
// Get the time value in milliseconds and convert to seconds
@cpuwolf
cpuwolf / AirScriptII.js
Last active January 12, 2024 07:37
金山数据表Airscript数据处理
//
// Get a date object for the current time
var d = new Date();
// Set it to one month ago
d.setMonth(d.getMonth() - 1);
d.setDate(1)
// Zero the time component
d.setHours(0, 0, 0, 0);
// Get the time value in milliseconds and convert to seconds