Skip to content

Instantly share code, notes, and snippets.

@zhuth
zhuth / CopyAcrobatEnglishFormatter.ahk
Created September 18, 2023 01:47
Acrobat copy & caps lock ahk script
#SingleInstance
global mode := 0
SendMode Input
$CapsLock::
KeyWait, CapsLock, T0.5
If ErrorLevel
{
@zhuth
zhuth / bitwarden_interop.py
Last active May 20, 2023 02:02
A wrapper for bitwarden cli
import os
import json
import subprocess
import tabulate
import click
from tqdm import tqdm
from PyMongoWrapper import QueryExprInterpreter, QueryExprEvaluator
BW_CLI = "./bw" if os.path.exists("bw") else os.environ.get("BW_CLI")
@zhuth
zhuth / ipfs-downloader.py
Created February 1, 2023 01:04
download from ipfs and send file when ready
from flask import Flask, request, send_file, jsonify
from threading import Thread
import wget
import os, re
ipfsserv = 'http://localhost:8080/ipfs/'
outdir = './'
app = Flask(__name__)
downloads = {}
@zhuth
zhuth / detabtwt.js
Last active January 23, 2023 10:31 — forked from whizvox/detabtwt.js
De-tab Twitter
// ==UserScript==
// @name De-tab Twitter
// @namespace https://whizvox.me
// @version 1.1.1-1
// @downloadURL https://gist.githubusercontent.com/whizvox/2c5eb769c29576bdf4173ac2ee58445a/raw/38eba91a8c3da6da262de56bcd6ce712e153af04/detabtwt.js
// @description Removes "For You" and "Following" tabs, as well as selecting "Following" upon page load
// @author whizvox
// @match https://twitter.com/home
// @icon https://www.google.com/s2/favicons?sz=64&domain=twitter.com
// @grant nonejs
@zhuth
zhuth / fakemailserver.py
Created November 4, 2022 12:24
A fake smtp server for calibre-web to work with dpt-rp1
import os
from email import message_from_bytes
from email.message import Message
from dptrp1 import dptrp1
from io import BytesIO
import smtpd
import asyncore
class FakeSMTPServer(smtpd.SMTPServer):
@zhuth
zhuth / qm-resume-forward.py
Last active September 16, 2022 23:02
resume vm upon connection
#!/usr/bin/python3
import socket
from threading import Thread
import select
import subprocess
import time
import click
@zhuth
zhuth / Library LibGen.js
Created May 6, 2022 00:37
Zotero translator for library.lol (libgen mirror)
{
"translatorID": "433c846d-0a4e-4ae8-9c36-fd6624b07614",
"label": "Library LibGen",
"creator": "zhuth",
"target": "^https?://library\\.lol/main/",
"minVersion": "5.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
@zhuth
zhuth / capture_cam.py
Created October 15, 2021 04:02
capture frame and save images when any key hit
import datetime
import os
import cv2
import time
import readchar
d = datetime.datetime.now().strftime('%Y%m%d%H%M%S')
if not os.path.exists(d):
os.mkdir(d)
@zhuth
zhuth / extract-pdf-annotations.py
Created August 27, 2021 00:16
extract annotations from pdf
import sys
import fitz
import re
def remove_spaces(text):
text = re.sub(r'[\s\n]+', ' ', text)
text = re.sub(r'([\u4e00-\u9fa5,]{1})\s+([\u4e00-\u9fa5,]{1})', '\1\2', text)
return text
// ==UserScript==
// @name bilibili/B站/mooc/慕课倍速控制优化
// @namespace https://gist.github.com/zhuth/641f7ac1ad6d7d9ba82d887ae06c75fb
// @version 2.0.1
// @description '+'、'-'控制倍速;'alt'+'[1-9]' 选择快速选择整数倍速
// @author Asea Q:569389750; zhuth
// @match https://*/*
// @grant none
// @license GPL-3.0-only
// ==/UserScript==