Skip to content

Instantly share code, notes, and snippets.

View temberature's full-sized avatar

Tong temberature

  • USA
View GitHub Profile
import anthropic
client = anthropic.Anthropic(
# defaults to os.environ.get("ANTHROPIC_API_KEY")
api_key="my_api_key",
)
message = client.messages.create(
model="claude-3-opus-20240229",
max_tokens=4000,
temperature=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);
@Xeophon
Xeophon / chatgpt_jwt_interceptor.js
Last active March 12, 2024 05:10
ChatGPT Personals
// ==UserScript==
// @name OpenAI Authorization Header Interceptor
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Intercept OpenAI chat requests, store Authorization header once, and exit
// @author Xeophon + ChatGPT
// @match https://chat.openai.com/*
// @grant none
// ==/UserScript==
@doraTeX
doraTeX / ocr.sh
Last active October 31, 2024 11:08
A shell script to perform OCR on images/PDFs using macOS built-in OCR engine
#!/bin/bash
SCRIPTNAME=$(basename "$0")
function realpath () {
f=$@;
if [ -d "$f" ]; then
base="";
dir="$f";
else
base="/$(basename "$f")";
@nelson-liu
nelson-liu / filtering-twitter.md
Created May 27, 2023 20:16
Filter the Twitter /home to only show tweets with arxiv links.
  1. Download an ad blocker that supports EasyList filtering syntax. I personally use uBlock Origin.

  2. Add the following custom filter to the extension:

twitter.com##[aria-label="Timeline: Your Home Timeline"] article:not(:has-text(/arxiv.org/i))
@chenshaoju
chenshaoju / Lock22H2.reg
Last active May 15, 2023 13:23
Lock Windows 10 at 22H2 version
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState]
"TargetProductVersion"="Windows 10"
"TargetReleaseVersion"="22H2"
@Quorafind
Quorafind / AskChatGPT-With-Surfing.js
Created February 19, 2023 11:20
Using Quickadd to ask current selection In ChatGPT
// Version 0.0.1
module.exports = askChatWithPrompt;
function askChat(str, app) {
const prompt = encodeURI(str);
const chatViewEl = app.workspace.getLeavesOfType("surfing-view").find((item)=>{ return /chat\.openai\.com/.test(item?.view?.currentUrl)}).view.webviewEl;
chatViewEl.executeJavaScript(`
var htmlElement = document.querySelector("textarea");
htmlElement.value = decodeURI("${ prompt }");
@bookfere
bookfere / fix-google-translate-cn.sh
Last active July 5, 2024 00:24
Fix Google Translate CN for macOS
#!/bin/bash
# Copyright (c)2022 https://bookfere.com
# This is a batch script for fixing Google Translate and making it available
# in the Chinese mainland. If you experience any problem, visit the page below:
# https://bookfere.com/post/1020.html
set -e
IPS=(
74.125.137.90
@dbrookman
dbrookman / build-mpv_silicon.sh
Last active November 14, 2024 05:30
How to build mpv & mpv.app on an Apple silicon Mac
#!/usr/bin/env bash
# Builds mpv & mpv.app on Apple silicon Macs.
# Run this script from the root directory of the mpv repo.
# if anything fails, gtfo
set -ex
meson setup build
meson compile -C build
@potter0815
potter0815 / add-hypothesis-webclient-every-site.user.js
Last active March 20, 2024 09:37
Hypothes.is everywhere - Tampermonkey / greasemonkey script to enable Hypothes.is web client on all pages
// ==UserScript==
// @name Hypothes.is everywhere
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Enable Hypothesis scriptlet on all pages
// @author https://github.com/potter0815
// @match http://*/*
// @include http://*
// @include https://*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==