javascript 节拍器
娃学琴,节奏感糊成一坨了。老师让抖腿打节拍,显然不work。码农特有的穷B气质让我舍不得买个实体的;去找个节拍器app,结果各大市场都是各种广告,怕给娃用不正经;甚至找了很多公众号版的,小程序版的,网页版的,普遍都是各种跳转诱导点击。 失望之余,想起来上次JS播放DTMF对 WebAudio 有点感觉,要不这次自己干脆再手搓一个。调研了一圈发现这玩意没那么容易,主要就是javascript在浏览器里 setInterval 是有时间抖动(jitter)的,不能保证节奏精确。如何才能做到精准采样打节拍呢?连续精心编排 AudioContext 时间轴! 搜了一圈发现一位叫 Grant James 已经写好放在 github 了。那还等什么直接拿来~~针对性的改进了: 无广告 去掉 .js .css 依赖,..
更多

Edge找回丢失的右上角Copilot侧边栏图标
右上角图标和侧边栏的官方截图: 如果不小心关掉了,找回办法: 打开 edge://settings/sidebar/appSettings?hubApp=cd4688a9-e888-48ea-ad81-76193d56b1be F12 或者 Opt+Cmd+I,找到第一个“Show Copilot”开关,把它改成关闭。 如果第二步不会搞,输入 document.querySelector('input[aria-label="Show Copilot"]').removeAttribute('disabled') 可破 为什么会有这个问题,因为政策的原因,Microsoft Copilot 不能在简中使用,于是右上角的按钮点一下会消失;但是开发或者集成测试的为了省事儿,就直接给隐藏掉,导致侧边栏无法..
更多Valid HTTP verbs
从这里 想到,fetch/xhr 可以发起哪些 http verb 呢? python -m http.server 随手测试了下,发现连 !,$ 这种符号都可以作为 http verb,比如 fetch('/asdf', {method:"$"}) 这样的请求是能发起的。于是去 chromium 搜了下 "is not a valid HTTP method" 相关的解析放在 blink/renderer/platform/network/http_parsers.cc // See RFC 7230, Section 3.2.6. bool IsValidHTTPToken(const String& characters) { if (characters.empty()) re..
更多Cappy in a Haystack locations
For the mission from the beloved Fallout 4 Nuka-World DLC coc DLC04KiddieKingdomFunHouse01; player.moveto 06015A94 coc NukaWorldWildWestExt02; player.moveto 06015A8A coc DLC04BottlingPlant01; player.moveto 060445DF coc DLC04BottlingPlant01; player.moveto 0604A812 coc DLC04GalacticZoneExt04; player.moveto 06015A8E coc DLC04GalacticZoneExt04; player.moveto ..
更多Making subprocess async friendly in Python
It's been a while since i wrote something in English, mostly because there's nothing really interesting, until now. Occasionally, when facing a long running task in Python, I would choose either a distrubuted tasks queue system, or for the convenience, just the subprocess module. It's built-in and well designed for grabbing outputs of a child process runn..
更多人声分离简单评测
娃要去表演唱歌,老师要求提供MTV。。 视频是这个,需要去掉人声部分 先用 ffmpeg 提音轨 ffmpeg -i v.mp4 -ac 1 1.mp3 微信小程序上的全是骗充值的,网上的服务: 没卵用 https://vocalremover.org/ 名气很大,搜出来第一就这个 没用 https://www.conversion-tool.com/karaoke/ 卡死 https://www.songpeel.com/song-to-karaoke 要安装 https://github.com/adefossez/demucs 要6G显存 https://github.com/Anjok07/ultimatevocalremovergui 效果很好! https://tunebat.com/Vo..
更多吐槽pynsq,另外给subprocess糊了一个异步
pynsq太烂了 起初是因为需要在 Web API 里消费一个消息队列(nsq),给浏览器返回 EventSource 做实时输出。但是没想到官方库pynsq居然写得这么渣: def _handle_term_signal(sig_num, frame): logging.getLogger(__name__).info( 'TERM Signal handler called with signal %r', sig_num) tornado.ioloop.IOLoop.current().stop() def run(): """ Starts any instantiated :class:`nsq.Reader` or :class:`nsq.Wr..
更多如何删除 C:\Windows\WinSxS 文件
天气热得心慌,看Win10不爽,决定删几个文件玩玩 首先你需要以 SYSTEM 用户启动 cmd.exe Win+R 敲入: "\\live.sysinternals.com@SSL\DavWWWRoot\tools\PsExec.exe" -i -s cmd.exe 回车。确认当前身份敲入 whoami 夺权:takeown /F "C:\Windows\WinSxS\Backup" /A /R /D Y 授权:cacls "C:\Windows\WinSxS\Backup" /T /G SYSTEM:F /C 开删:rd /s /q "C:\Windows\WinSxS\Backup" 爽! 当然,你也可以让系统代替你清理: Dism.exe /online /Cleanup-Image /Sta..
更多从 Leanote 迁移到 Obsidian
差不多积累了10年的笔记,因为软件开发商跑路去做 2B 了,这玩意也没人维护了。换 Obsidian Leanote 不支持导出 .md 但是它自己的格式就是 json,转换一下很简单。 把一个目录下的笔记批量导出为 Leanote 格式,比如导出到 /tmp/folder1 执行Python代码 import json dir = '/tmp/folder1' for n in os.listdir(dir): if not n.endswith('.leanote'): continue with open(f"{dir}{n.replace('.leanote', '.md')}", "w") as f2, open(dir+n) as f1: f2..
更多1900年居然不是闰年?
看HN讨论 昨天2024-02-29有哪些闰年的bug,有一个吃惊了 >>> datetime.datetime.strptime('Feb 29', '%b %d') ValueError: day is out of range for month python的 datetime() 默认 year=1900。但是心里想 1900 不应该也是闰年吗? 查了下还真不是。囧。一年有 365.242374 天: 近似看成 365.25 天就是4年一润; 剩余的精度 365.25-365.242374 == 0.0076 天 而且,0.0076 ✖️ 400 == 3.0504,也就是每400年要润3天 结论就是每100年一润,但是每400年又不润 比如 1700, 1800, 190..
更多