Skip to content

Instantly share code, notes, and snippets.

View zengjie's full-sized avatar

zengjie zengjie

  • Vertex Games
  • Singapore
View GitHub Profile
@zengjie
zengjie / even_glasses_demo.py
Created October 31, 2024 04:24
Even Realities Smart Glasses Python Demo
import asyncio
from bleak import BleakScanner, BleakClient
from enum import IntEnum
import struct
import time
# Service and Characteristic UUIDs
UART_SERVICE_UUID = "6E400001-B5A3-F393-E0A9-E50E24DCCA9E"
UART_TX_CHAR_UUID = "6E400002-B5A3-F393-E0A9-E50E24DCCA9E" # Write
UART_RX_CHAR_UUID = "6E400003-B5A3-F393-E0A9-E50E24DCCA9E" # Read/Notify
@zengjie
zengjie / SketchSystems.spec
Created June 20, 2023 07:34
My Awesome Sketch
My Awesome Sketch
First State
tap -> Second State
Second State
back -> First State
function render(model){
let current_state_name = model.active_states[0].name;
return $("h1",
{style: {color: "darkBlue"}},
`The current state is: ${current_state_name}`);
}
@zengjie
zengjie / dedao-flomo-notion-readwise.py
Last active August 21, 2024 01:47
把 Flomo 同步到 Notion 的得到电子书笔记,导出到 ReadWise
import csv
from notion_client import Client
from notion_client.helpers import iterate_paginated_api
# Flomo 在 Notion 中的同步数据库需要增加两个字段:
# - 得到电子书:formula 字段,公式为 `contains(prop("Tags"), "得到/电子书")`
# - 书名:formula 字段,公式为 `replaceAll(prop("Tags"), "得到/电子书/", "")`
@zengjie
zengjie / session-split-up.sql
Last active November 22, 2022 05:27
Split Up User Sessions
WITH filtering AS
(
SELECT * FROM mm.ods_event_log_v2_recent WHERE did = '{{ did }}'
),
with_last_event AS
(
SELECT *,
LAG(event_time, 1) OVER
(PARTITION BY did ORDER BY event_time) AS last_event
FROM filtering
邀请顾小北在生财有术圈子做的分享,曹大的圈子也有很多小北的读者,应该会感兴趣,内容同步过来分享给大家。
===
#生财合伙人#
每周三,带你认识一位厉害的生财合伙人。
今天的合伙人是大家的老朋友@顾小北 ,很多圈友都是他公众号小北的梦呓的粉丝,在跨境电商领域小北也有很多忠实的读者和付费会员,我非常佩服他的思维方式、商业嗅觉与执行力,是个真正的“狠”角色。
@zengjie
zengjie / panic.go
Last active October 19, 2018 21:06
racy use of timers
package main
import (
"time"
)
func main() {
done := make(chan struct{})
for i := 0; i < 1000; i++ {
@zengjie
zengjie / update_chinadns.bash
Last active March 21, 2017 03:59
Update ChinaDNS IP Address File
if curl -f 'http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest' -o /tmp/chinaip.list; then
cat /tmp/chinaip.list | grep ipv4 | grep CN | awk -F\| '{ printf("%s/%d\n", $4, 32-log($5)/log(2)) }' > /tmp/chinadns_chnroute.txt
if [[ $(wc -l </tmp/chinadns_chnroute.txt) -ge 100 ]]; then
echo '47.89.44.170/32' >> /tmp/chinadns_chnroute.txt
echo '139.162.86.215/32' >> /tmp/chinadns_chnroute.txt
cp /tmp/chinadns_chnroute.txt /etc/chinadns_chnroute.txt
else
echo 'Too few lines. File corrupted?'
fi;
else
@zengjie
zengjie / SS.conf
Last active November 11, 2016 20:07
Surge
[General]
loglevel = notify
skip-proxy = 127.0.0.1, 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10, localhost, *.local, ::ffff:0:0:0:0/1, ::ffff:128:0:0:0/1
bypass-tun = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12
# dns-server = 119.29.29.29,223.5.5.5,114.114.115.115
# external-controller-access = [email protected]:6155
# ipv6 = true
// REMEMBER TO CHANGE THE external-controller-access' PASSWORD

Keybase proof

I hereby claim:

  • I am zengjie on github.
  • I am zengjie (https://keybase.io/zengjie) on keybase.
  • I have a public key whose fingerprint is 6DAC A97C 8986 65C5 3DAB 95DA 15F2 AD1F 5475 460C

To claim this, I am signing this object: