Skip to content

Instantly share code, notes, and snippets.

@ifree
ifree / windows_live_captions_recorder.py
Last active March 14, 2024 16:07
Windows live captions recorder
from pywinauto.application import Application
import time
import math
import re
from collections import Counter
WORD = re.compile(r"\w+")
# cosine similarity https://stackoverflow.com/a/15174569/309846
def get_cosine(vec1, vec2):
@goldengrape
goldengrape / ChatGPT-Translate-Long-Text.js
Created October 1, 2023 19:39 — forked from JimLiu/ChatGPT-Translate-Long-Text.js
使用ChatGPT自动分页翻译长文
// WARNING:此脚本仅做学习和演示用途,在不了解其用途前不建议使用
// 本脚本的用途是将输入内容分页,每次提取一页内容,编辑第二条消息,发送,然后收集结果
// 使用前,需要有两条消息,参考模板 https://chat.openai.com/share/17195108-30c2-4c62-8d59-980ca645f111
// 演示视频: https://www.bilibili.com/video/BV1tp4y1c7ME/?vd_source=e71f65cbc40a72fce570b20ffcb28b22
//
(function (fullText) {
const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
const groupSentences = (fullText, maxCharecters = 2800) => {
const sentences = fullText.split("\n").filter((line) => line.trim().length > 0);
@JimLiu
JimLiu / ChatGPT-Translate-Long-Text.js
Last active April 8, 2024 07:26
使用ChatGPT自动分页翻译长文
// WARNING:此脚本仅做学习和演示用途,在不了解其用途前不建议使用
// 本脚本的用途是将输入内容分页,每次提取一页内容,编辑第二条消息,发送,然后收集结果
// 使用前,需要有两条消息,参考模板 https://chat.openai.com/share/17195108-30c2-4c62-8d59-980ca645f111
// 演示视频: https://www.bilibili.com/video/BV1tp4y1c7ME/?vd_source=e71f65cbc40a72fce570b20ffcb28b22
//
(function (fullText) {
const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
const groupSentences = (fullText, maxCharecters = 2800) => {
const sentences = fullText.split("\n").filter((line) => line.trim().length > 0);
from langchain.callbacks.base import BaseCallbackHandler
import azure.cognitiveservices.speech as speechsdk
import os
import base64
import time
class StreamDisplayHandler(BaseCallbackHandler):
def __init__(self, container, initial_text="", display_method='markdown'):
self.container = container
self.text = initial_text
self.display_method = display_method
@ninehills
ninehills / chatglm-openai-api.ipynb
Last active April 16, 2024 01:15
chatglm-openai-api.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ninehills
ninehills / chatpdf-zh.ipynb
Last active April 9, 2024 06:40
ChatPDF-zh.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@IanColdwater
IanColdwater / twittermute.txt
Last active April 22, 2024 17:26
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@Piasy
Piasy / install_ffmpeg.sh
Last active April 14, 2024 05:40
brew install ffmpeg with all options
brew options ffmpeg
brew install ffmpeg \
--with-chromaprint \
--with-fdk-aac \
--with-fontconfig \
--with-freetype \
--with-frei0r \
--with-game-music-emu \
--with-libass \
#Program to drive Sonic Pi 3 visualiser written in "processing"
#by Robin Newman, September 2017
#see article at https://rbnrpi.wordpress.com
#set up OSC address of processing sketch
use_osc '127.0.0.1',5000
#select shapes to show
osc "/viz/shapes","e" #"s" "e" "r" Star,Ellipse, Rectangle or combination
sleep 0.1
live_loop :c do
@bonzanini
bonzanini / search_biopython.py
Last active February 9, 2024 21:44
Searching PubMed with Biopython
# This code uses Biopython to retrieve lists of articles from pubmed
# you need to install Biopython first.
# If you use Anaconda:
# conda install biopython
# If you use pip/venv:
# pip install biopython
# Full discussion: