Skip to content

Instantly share code, notes, and snippets.

View lewangdev's full-sized avatar
🐢
Running

lewang lewangdev

🐢
Running
View GitHub Profile
@lewangdev
lewangdev / add-public-keys.md
Last active November 21, 2023 10:07
how-to-add-ssh-public-keys

推荐 通过 ssh-import-id 命令导入 ssh 公钥

$ sudo apt install -y ssh-import-id
$
$ ssh-import-id-gh lewangdev
2023-11-21 09:29:24,308 INFO Authorized key ['2048', 'SHA256:Pu/8zz7rT6zKH0aklqk+7j1XNqAfB7COIan4Kryo3+Y', 'lewangdev@github/8809471', '(RSA)']
2023-11-21 09:29:24,313 INFO Authorized key ['3072', 'SHA256:2/aQDHc+ULG3moyvTr9h3702Btb49I5Y3UGKf7kqJRI', 'lewangdev@github/61522538', '(RSA)']
2023-11-21 09:29:24,318 INFO Authorized key ['256', 'SHA256:oLZ91UAqwhQgnb7wC+NrgEAYq+sxg9xmLCrI6t+N93M', 'lewangdev@github/66075094', '(ED25519)']
2023-11-21 09:29:24,323 INFO Authorized key ['256', 'SHA256:ymuGSnvAOSrJylWtaFVVGARv+AcsKnrG+B3HHptXews', 'lewangdev@github/75841698', '(ED25519)']
2023-11-21 09:29:24,324 INFO [4] SSH keys [Authorized]
@lewangdev
lewangdev / openai-api.conf
Created November 11, 2023 13:20
nginx proxy for openai api
server {
listen 80;
server_name openai-api.xxx.link;
error_log /var/log/nginx/openai-api/nginx-error.log;
access_log /var/log/nginx/openai-api/nginx-access.log main;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
@lewangdev
lewangdev / edge_tts_voices.py
Created October 24, 2023 14:13
Get Edge TTS Voice Name List
import asyncio
from edge_tts import list_voices
async def print_voices() -> None:
"""Print all available voices."""
voices = await list_voices()
voices = sorted(voices, key=lambda voice: voice["ShortName"])
print("| Name | Gender | Language |")
print("| :--- | :----- | :--------|")
@lewangdev
lewangdev / Step-1.js
Last active July 3, 2023 13:17
Get Twitter followings and add them to your private list
(function(window) {
function saveAsLocalStorage(username) {
// 将 Set 转换为 Array
let followerIdsArray = Array.from(followerIds);
// 存储到localStorage
localStorage.setItem('MyFollowingIds', JSON.stringify(followerIdsArray));
}
function saveAsCSV(username) {
@lewangdev
lewangdev / convert-mkv-to-mp4.sh
Last active June 30, 2023 06:33
Convert mkv to mp4 in h264 and aac
#!/bin/bash
if [ -z "$1" ]
then
echo "Please provide the directory as an argument."
exit 1
fi
for file in "$1"/*.mkv
do
@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?
@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 / 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 / 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 / default.custom.yaml
Last active April 24, 2024 05:47
雾凇拼音自定义配置,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 切换到大写或切换中英。