Skip to content

Instantly share code, notes, and snippets.

View lloydzhou's full-sized avatar
:octocat:
Focusing

Lloyd Zhou lloydzhou

:octocat:
Focusing
View GitHub Profile
@lloydzhou
lloydzhou / gist:fbd50c29128f439f1a1ce89ca7ffc156
Created November 13, 2024 10:51 — forked from LukasKriesch/gist:e75a0132e93ca989f8870c4f95be734b
Python translation Jina AI chunking regex
import regex as re
import requests
MAX_HEADING_LENGTH = 7
MAX_HEADING_CONTENT_LENGTH = 200
MAX_HEADING_UNDERLINE_LENGTH = 200
MAX_HTML_HEADING_ATTRIBUTES_LENGTH = 100
MAX_LIST_ITEM_LENGTH = 200
MAX_NESTED_LIST_ITEMS = 6
MAX_LIST_INDENT_SPACES = 7
@lloydzhou
lloydzhou / ArchLinuxARM-M1
Created October 25, 2024 15:48 — forked from thalamus/ArchLinuxARM-M1
How to boot Arch Linux ARM in QEMU (patched for M1)
/*
* This document is provided to the public domain under the
* terms of the Creative Commons CC0 public domain license
*/
How to boot Arch Linux ARM in QEMU (patched for M1)
Prerequisites:
QEMU - patched for M1 processors - patches: https://github.com/utmapp/qemu
@lloydzhou
lloydzhou / claude_3.5_sonnet_artifacts.xml
Created July 25, 2024 05:38 — forked from dedlim/claude_3.5_sonnet_artifacts.xml
Claude 3.5 Sonnet, Full Artifacts System Prompt
<artifacts_info>
The assistant can create and reference artifacts during conversations. Artifacts are for substantial, self-contained content that users might modify or reuse, displayed in a separate UI window for clarity.
# Good artifacts are...
- Substantial content (>15 lines)
- Content that the user is likely to modify, iterate on, or take ownership of
- Self-contained, complex content that can be understood on its own, without context from the conversation
- Content intended for eventual use outside the conversation (e.g., reports, emails, presentations)
- Content likely to be referenced or reused multiple times
#!/usr/bin/python3
import sys
import asyncio
import greenlet
class AsyncIoGreenlet(greenlet.greenlet):
def __init__(self, driver, fn):
greenlet.greenlet.__init__(self, fn, driver)
self.driver = driver
@lloydzhou
lloydzhou / content.md
Created September 20, 2022 03:37 — forked from baymaxium/content.md
生产环境中使用Docker Swarm的一些建议

原文:Docker

如果你在单个生产节点上用过Docker,然后发现单个节点的资源不够用,那么你会怎么做呢?我也遇到过这种情况! 关于在生产环境中使用Docker Swarm,我会为你提供一些建议,也许能够帮到你。这些都是我一年来积累的一些经验。

另外,如果你对Docker Swam不熟悉的话,可以参考我之前的博客My experience with Docker Swarm - when you may need it?(http://suo.im/1m7qW8)

1. 阅读官方文档

@lloydzhou
lloydzhou / Dockerfile
Created November 29, 2021 08:38 — forked from hermanbanken/Dockerfile
Compiling NGINX module as dynamic module for use in docker
FROM nginx:alpine AS builder
# nginx:alpine contains NGINX_VERSION environment variable, like so:
# ENV NGINX_VERSION 1.15.0
# Our NCHAN version
ENV NCHAN_VERSION 1.1.15
# Download sources
RUN wget "http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz" -O nginx.tar.gz && \
@lloydzhou
lloydzhou / 书籍.md
Created June 7, 2020 12:19 — forked from ckeyer/书籍.md
经典编程书籍大全

经典编程书籍大全

100+ 经典技术书籍,涵盖:计算机系统与网络、系统架构、算法与数据结构、前端开发、后端开发、移动开发、数据库、测试、项目与团队、程序员职业修炼、求职面试 和 编程相关的经典书籍。

这个列表综合了伯乐在线网站以往推荐经典书籍文章中的列表,以及在微信和微博中被广泛推荐的好书。虽然已经包括了100多本,覆盖的面也比较全。仍然有很多方面需要补充,而且相信还有很多没有被收录的好书。欢迎大家在 issues 中推荐或自荐。

计算机系统与网络

@lloydzhou
lloydzhou / redis-aggregate.lua
Last active October 9, 2020 05:53 — forked from Hidendra/redis-aggregate.lua
Aggregate values in a redis sorted set. Returns {count, sum, min, max}
local count = 0
local sum = 0
local min = 0
local max = 0
local cursor = "0"
local result = nil
local data = nil
repeat
result = redis.call("zscan", KEYS[1], cursor, "count", 100)
@lloydzhou
lloydzhou / access.lua
Created May 22, 2018 06:13 — forked from mariocesar/access.lua
Nginx Lua script redis based for Basic user authentication
function password_encode(password)
local bcrypt = require 'bcrypt'
return bcrypt.digest(password, 12)
end
function check_password(password, encoded_password)
local bcrypt = require 'bcrypt'
return bcrypt.verify(password, encoded_password)
end
@lloydzhou
lloydzhou / get-old-chromium-binary.md
Created July 12, 2017 09:38 — forked from cletusw/get-old-chromium-binary.md
Download an old Chromium binary

(source)

Taking [denilson-sá's answer][2] further...

You need revision numbers to grab downloads. So first lookup the full version string from the following URL, adjusting parameters as needed:

https://omahaproxy.appspot.com/history.json?channel=stable&os=mac

For Chrome version 28 the full version string is 28.0.1500.71. Now go to https://omahaproxy.appspot.com and enter the full version string ("28.0.1500.71") into the Position Lookup box. Copy the Base Position number ("209842" in this case).