Skip to content

Instantly share code, notes, and snippets.

View jjaychen1e's full-sized avatar
👀
Open to Work

jjaychen jjaychen1e

👀
Open to Work
View GitHub Profile
@jjaychen1e
jjaychen1e / logs.log
Last active January 5, 2024 14:20
NRSDK 2.1.1 Crash logs - 2
2024/01/05 21:24:52.270 25535 25665 Warn XREAL [2024-01-05 21:24:52.269] [25563] [WARN] [NRSDK] Log Info: pid:25535, time:2024-01-05 21:24:52 (+0800)
2024/01/05 21:24:52.270 25535 25665 Info XREAL [2024-01-05 21:24:52.270] [25563] [INFO] [NRSDK] NRSDK Version: 2.1.0.2023092115.N
2024/01/05 21:24:52.270 25535 25665 Info XREAL [2024-01-05 21:24:52.270] [25563] [INFO] [NRSDK] NRSDK Create!
2024/01/05 21:24:52.285 25535 25665 Info XREAL [2024-01-05 21:24:52.285] [25563] [INFO] [NRSDK] NRSDK Init!
2024/01/05 21:24:52.290 25535 25563 Info CONTROLLER loadplugin controller run with ControllerSimple: 0
2024/01/05 21:24:52.293 25535 25665 Info XREAL [2024-01-05 21:24:52.293] [25563] [INFO] [NRSDK] NRSDK Init Switch!
2024/01/05 21:24:52.297 24339 24736 Debug ServerHelper Asked by:com.DefaultCompany.NR_TRTC_Yuv_RGBOnly
2024/01/05 21:24:52.302 24339 24736 Debug ServerHelper Asked by:com.DefaultCompany.NR_TRTC_Yuv_RGBOnly
2024/01/05 21:24:52.306 24339 24736 Debug ServerHelper Asked by:com.DefaultCompany.NR_TRTC_Yuv_RGBOnly
@jjaychen1e
jjaychen1e / logs.log
Created January 5, 2024 14:10
NRSDK 2.1.1 Crash logs
2024/01/05 21:26:35.962 25535 25665 Warn XREAL [2024-01-05 21:26:35.962] [25690] [WARN] [NRSDK] Glasses Event! D:false Q:false S:true F:true
2024/01/05 21:26:35.962 25535 25665 Warn XREAL [2024-01-05 21:26:35.962] [25690] [WARN] [NRSDK] Glasses will goto sleep! on 0
2024/01/05 21:26:35.964 24339 24735 Warn XREAL [2024-01-05 21:26:35.963] [24737] [WARN] [NRService] Device status change:10,1
2024/01/05 21:26:35.964 24339 24735 Warn XREAL [2024-01-05 21:26:35.963] [24737] [WARN] [NRService] Glasses Event! D:false Q:false S:true F:false
2024/01/05 21:26:35.964 24339 24737 Debug LogControl (NRServiceControl.java:37)#onGlassesControlMsg | [status=, 10]
2024/01/05 21:26:35.966 25535 25690 Info Unity [Info][NRDevice] OnGlassesDisconnectEvent: reason=NOTIFY_GOTO_SLEEP, running=True
2024/01/05 21:26:35.966 24339 24737 Warn nebula_GlassSdkManager sdk callback onEvent: 10
2024/01/05 21:26:35.967 25535 25563 Info Unity [Info][NativeTrack] GetFramePresentHeadPose: trackReasonRst=Success, lost_tracking_reason=NONE
2024/01/0
@jjaychen1e
jjaychen1e / script.js
Created December 16, 2023 01:19
JavaScript: Export as PDF pre-processing for ChatGPT Chat in Safari
let targetElement = document.evaluate('//*[@id="__next"]/div[1]/div[2]/main/div[2]/div[1]/div/div/div', document, null, XPathResult.ANY_TYPE, null).iterateNext();
if (targetElement) {
document.documentElement.appendChild(targetElement);
document.body.parentNode.removeChild(document.body);
}
@jjaychen1e
jjaychen1e / lock-free SPSC ring buffer.md
Last active October 10, 2023 15:22
lock-free SPSC ring buffer

要求: 实现一个 single-producer single-consumer 的 lock-free ring buffer

思路:

因为只有一个生产者和一个消费者,我们可以通过想办法保证生产者和消费者互不影响对方的状态来消除数据竞争。

设计 ring buffer 时需要考虑如何代表 empty 状态。通常来说我们会使用 start = end = -1 来代表空状态,但是这样的设计会使得 pushpop 操作存在同时修改 startend 的可能性。

我们采用留空一个 slot 的方式(始终有一个 slot 不存放元素;为空时,start = end = indexSlot)来表示空状态。start永远指向被留空的slot,而(end + 1) % capacity 永远指向新元素将被存储的位置。

@jjaychen1e
jjaychen1e / respeakerd_with_yeelight_demo.py
Created May 19, 2021 14:23
respeakerd_with_yeelight_demo.py
# -*- coding: utf-8 -*-
import os
import time
import logging
import signal
import threading
from respeakerd_source import RespeakerdSource
# from respeakerd_volume_ctl import VolumeCtl
from avs.alexa import Alexa