Skip to content

Instantly share code, notes, and snippets.

View lewangdev's full-sized avatar
🐢
Running

LE lewangdev

🐢
Running
View GitHub Profile
@lewangdev
lewangdev / subnet
Last active December 14, 2020 03:09
subnet calculator
#!/usr/bin/env python3
import ipaddress
import sys
def get_cidr_ip_info(ip_net):
try:
net = ipaddress.ip_network(ip_net, strict=False)
print('IP版本号 | %s ' % str(net.version))
print('是否是私有地址 | %s ' % str(net.is_private))
@lewangdev
lewangdev / SimpleHTTPServerWithUpload.py
Created November 17, 2021 09:17 — forked from UniIsland/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
@lewangdev
lewangdev / update-on-select.md
Last active July 8, 2022 10:08
Pattern of writing UPDATE query based on SELECT Query

Pattern:

UPDATE
    `table1` AS `dest`,
    (
        SELECT
            *
        FROM
 `table2`
@lewangdev
lewangdev / qiniu_sslcert.py
Last active July 6, 2023 11:26
qiniu_sslcert
#!/usr/bin/env python
## Dependencies:
#
# pip install qiniu
#
## Tips for Deploy certs to Qiniu:
#
# export DOMAIN=lewangdev.com
# export QINIU_DOMAIN=images.${DOMAIN},staticfiles.${DOMAIN}
@lewangdev
lewangdev / README.md
Last active March 14, 2023 15:28
Change caps_lock to command+control+option+shift.(Post left_control+spacebar if press alone)

Import to Karabiner-Elements

Change caps_lock to command+control+option+shift.(Post left_control+spacebar if press alone)

Click to Import

@lewangdev
lewangdev / default.custom.yaml
Last active June 15, 2025 07:36
雾凇拼音自定义配置,MacOS-like & Wechat-like Dark/Light Color Scheme For Rime
patch:
# 菜单
menu:
page_size: 8 # 候选词个数
# alternative_select_labels: [ ①, ②, ③, ④, ⑤, ⑥, ⑦, ⑧, ⑨, ⑩ ] # 修改候选项标签
# alternative_select_keys: ASDFGHJKL # 如编码字符占用数字键,则需另设选字键
# ascii_mode、inline、no_inline、vim_mode 等等设定,可参考 /Library/Input Methods/Squirrel.app/Contents/SharedSupport/squirrel.yaml
# 中西文切换
#
# 【good_old_caps_lock】 CapsLock 切换到大写或切换中英。
@lewangdev
lewangdev / cf-reverse-proxy.js
Created April 26, 2023 11:25
cf-reverse-proxy
// node_modules/reflare/dist/src/database/workers-kv.js
var WorkersKV = class {
namespace;
constructor(namespace) {
this.namespace = namespace;
}
get = async (key) => {
const value = await this.namespace.get(key, {
type: "json",
cacheTtl: 60
@lewangdev
lewangdev / joystick_event.py
Created May 12, 2023 06:23
read xbox 360 joystick event
def joystickLoop(eventFile):
FORMAT = 'llHHI'
EVENT_SIZE = struct.calcsize(FORMAT)
with open(eventFile, 'rb') as infile:
while True:
event = infile.read(EVENT_SIZE)
_, _, t, c, v = struct.unpack(FORMAT, event)
print(t, c, v)
if t == 3 and v == 4294967295:
if c == 17:
@lewangdev
lewangdev / sc-openai-c2-L5-vid6_2-translated.srt
Last active June 6, 2023 11:25
Building Systems with the ChatGPT API 视频的中英文字幕,用 Faster-Whisper 和 GPT-3.5 自动生成:https://learn.deeplearning.ai/chatgpt-building-system/lesson/6/chaining-prompts
1
00:00:04,880 --> 00:00:11,880
在这个视频中,我们将学习如何通过将多个提示链接在一起将复杂任务分解为一系列简单子任务。
In this video, we'll learn how to split complex tasks into a series of simple sub-tasks by chaining multiple prompts together.
2
00:00:12,340 --> 00:00:13,540
你可能会问,
You might be wondering,
@lewangdev
lewangdev / 1665840314039545856-translated.srt
Last active June 8, 2023 00:52
大熊老师介绍 chatdoc 的视频中英文字幕,视频地址:https://twitter.com/i/status/1666051559774474242
1
00:00:00,000 --> 00:00:09,400
想象一下,你可以上传一个大的PDF文档,使用人工智能分析出你需要的所有见解。
Imagine you can upload a large PDF document and use AI to analyze all the insights you need for you.
2
00:00:09,740 --> 00:00:10,560
听起来不错吧?
That sounds good?