Skip to content

Instantly share code, notes, and snippets.

View cnych's full-sized avatar
🏠
Working from home

阳明 cnych

🏠
Working from home
View GitHub Profile
@cnych
cnych / craw.py
Created March 28, 2023 02:07
基于私有知识库构建ChatGPT问答服务
import requests
import re
import urllib.request
from bs4 import BeautifulSoup
from collections import deque
from html.parser import HTMLParser
from urllib.parse import urlparse
import os
# Regex pattern to match a URL
@cnych
cnych / cloudflare-worker-proxy.js
Created March 8, 2023 07:54 — forked from noobnooc/cloudflare-worker-proxy.js
cloudflare-worker-proxy
// Website you intended to retrieve for users.
const upstream = 'api.openai.com'
// Custom pathname for the upstream website.
const upstream_path = '/'
// Website you intended to retrieve for users using mobile devices.
const upstream_mobile = upstream
// Countries and regions where you wish to suspend your service.
@cnych
cnych / __init__.py
Last active March 18, 2023 14:01
Use Python and OpenAI implement self voice assistant
#!/usr/bin/env python3
"""Library for performing speech recognition, with support for several engines and APIs, online and offline."""
import io
import os
import tempfile
import sys
import subprocess
import wave
@cnych
cnych / Dockerfile
Last active September 3, 2021 07:26
ConfigMaps and Secrets with Kubernetes
FROM python:3.6.4
# 设置工作目录
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# 安装依赖
RUN pip install flask
# 添加应用
ADD . /usr/src/app
@cnych
cnych / backbone-1
Created August 2, 2013 08:01
Backbone入门教程
$(function(){
var Item = Backbone.Model.extend({
defaults: {
part1: 'hello',
part2: 'world'
}
}) ;
var List = Backbone.Collection.extend({