Skip to content

Instantly share code, notes, and snippets.

View amorist's full-sized avatar
🔞
Focusing

Amor amorist

🔞
Focusing
View GitHub Profile
@amorist
amorist / chunking-regex.ts
Created August 15, 2024 04:52 — forked from hanxiao/testRegex.js
Use regex to do chunking by using all semantic cues
// Used in https://jina.ai/tokenizer (Aug. 14th version)
// Define variables for magic numbers
const MAX_HEADING_LENGTH = 6;
const MAX_HEADING_CONTENT_LENGTH = 200;
const MAX_HEADING_UNDERLINE_LENGTH = 200;
const MAX_HTML_HEADING_ATTRIBUTES_LENGTH = 100;
const MAX_LIST_ITEM_LENGTH = 200;
const MAX_NESTED_LIST_ITEMS = 5;
const MAX_LIST_INDENT_SPACES = 7;
const MAX_BLOCKQUOTE_LINE_LENGTH = 200;
@amorist
amorist / converter.py
Created May 8, 2019 12:53 — forked from Kronopath/converter.py
WeChat audio converter script. See http://kronopath.net/blog/extracting-audio-messages-from-wechat/ for more details.
# WeChat aud file converter to wav files
# Dependencies:
# SILK audio codec decoder (available at https://github.com/gaozehua/SILKCodec)
# ffmpeg
#
# By Gabriel B. Nunes (gabriel@kronopath.net)
# Adapted from another script by Nicodemo Gawronski (nico@deftlinux.net)
#
import os, argparse, subprocess
@amorist
amorist / across.client.js
Created August 30, 2018 08:45 — forked from yueyuzhao/across.client.js
代理翻墙 (nodejs实现)
// 客户端实现
const net = require('net')
const tls = require('tls')
const localServer = new net.Server()
localServer.on('connection', (socket) => {
socket.pause()
const context = {
@amorist
amorist / zsh.md
Created May 19, 2018 07:38 — forked from tsabat/zsh.md
Getting oh-my-zsh to work in Ubuntu
@amorist
amorist / 提问的智慧.md
Created May 15, 2018 05:16 — forked from zer4tul/提问的智慧.md
Simplified Chinese edition of "How To Ask Questions The Smart Way"