Skip to content

Instantly share code, notes, and snippets.

View zhaocai's full-sized avatar
🤨
I may be slow to respond.

Zhao Cai zhaocai

🤨
I may be slow to respond.
View GitHub Profile
@zhaocai
zhaocai / 影巢影视详情页自动补全豆瓣信息.user.js
Last active November 5, 2026 22:42
在影巢影视详情页缺少豆瓣信息时,通过 IMDb ID 或片名自动反查并无缝补全豆瓣链接与评分
// ==UserScript==
// @name 影巢影视详情页自动补全豆瓣信息
// @namespace zhaowu
// @version 1.2.3
// @description 在影巢影视详情页缺少豆瓣或IMDb信息时自动补全链接与评分,并在 IMDb 显示 0.0 异常时自动反查修正真实评分
// @author zhaowu
// @icon data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="%2300B51D" d="M1003.52 872.448c0 72.39-58.68 131.072-131.072 131.072H151.552c-72.39 0-131.072-58.68-131.072-131.072V151.552c0-72.39 58.68-131.072 131.072-131.072h720.896c72.39 0 131.072 58.68 131.072 131.072v720.896z"/><path fill="%23FFF" d="M822.6 184.32H201.4a11.5 11.5 0 0 0-11.5 11.5v46a11.5 11.5 0 0 0 11.5 11.5h621.2a11.5 11.5 0 0 0 11.5-11.5v-46a11.5 11.5 0 0 0-11.5-11.5zm0 586.33H663.84l47.46-150.1h58.89a11.5 11.5 0 0 0 11.5-11.5V330.41a11.5 11.5 0 0 0-11.5-11.5H253.82a11.5 11.5 0 0 0-11.5 11.5v278.64a11.5 11.5 0 0 0 11.5 11.5h364.18l-47.45 150.1H439.32l-34.8-110.05a11.5 11.5 0 0 0-15.14-11.5H319.06c-6.36 0-9.88 5.14-7.86 11.5l34.8 110.05H201.4a11.5 11.5 0 0 0-11.5 11.5v46a11.5 11.5 0 0 0 11.5 11.5h
@zhaocai
zhaocai / utf16toascii.py
Last active October 19, 2016 01:14
decode utf16
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import codecs
encoded_text = open(sys.argv[-1], 'rb').read()
bom= codecs.BOM_UTF16_LE
assert encoded_text.startswith(bom)
encoded_text= encoded_text[len(bom):]
@zhaocai
zhaocai / Liberal Regex Pattern for URLs
Created October 16, 2016 23:07 — forked from winzig/Liberal Regex Pattern for URLs
Updated @gruber's regex with a modified version that looks for 2-13 letters rather than trying to look for specific TLDs. Given the recent addition of ~1400 gTLDs, it may be time to give up on that front.
# Single-line version:
(?i)\b((?:https?:(?:/{1,3}|[a-z0-9%])|[a-z0-9.\-]+[.](?:[a-z]{2,13})(?:[^\s()<>{}\[\]]+|\([^\s()]*?\([^\s()]+\)[^\s()]*?\)|\([^\s]+?\))+(?:\([^\s()]*?\([^\s()]+\)[^\s()]*?\)|\([^\s]+?\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’])|(?:(?<!@)[a-z0-9]+(?:[.\-][a-z0-9]+)*[.](?:[a-z]{2,13})\b/?(?!@)))
# Commented multi-line version:
(?xi)
\b
( # Capture 1: entire matched URL
(?:
@zhaocai
zhaocai / Everything in XYplorer.xys
Created October 10, 2016 06:46
Everything in XYplorer
/* CUSTOMIZATIONS
-------------------------------------------------------------------------------------------------
$path: the path of the folder containing the es.exe executable, with a final
slash.
$paper: the base name of the paper folder containing the search results, without
extension;
$mode: controls how the minus sign, which introduces switches in es.exe, is
treated/escaped. Three modes are available.
@zhaocai
zhaocai / cVim Alfred Style.css
Created September 7, 2016 01:47
cVim Options
#cVim-link-container, .cVim-link-hint, #cVim-command-bar, #cVim-command-bar-mode, #cVim-command-bar-input, #cVim-command-bar-search-results, .cVim-completion-item, .cVim-completion-item .cVim-full, .cVim-completion-item .cVim-left, .cVim-completion-item .cVim-right, #cVim-hud, #cVim-status-bar {
font-family: Helvetica, Helvetica Neue, Neue, sans-serif, Arial;
font-size: 9pt !important;
-webkit-font-smoothing: antialiased !important;
border-radius: 4px!important;
}
#cVim-link-container {
position: absolute;
pointer-events: none;
@zhaocai
zhaocai / .remarkrc.yaml
Created August 28, 2016 21:21
remark rc config
---
plugins:
remark-lint:
blockquote-indentation: 2
final-newline: true
hard-break-spaces: true
list-item-bullet-indent: true
list-item-indent: 'tab-size'
maximum-line-length: false
no-auto-link-without-protocol: true
; WINDOWS KEY + Y TOGGLES FILE EXTENSIONS
#y::
RegRead, HiddenFiles_Status, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, HideFileExt
If HiddenFiles_Status = 1
RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, HideFileExt, 0
Else
RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, HideFileExt, 1
WinGetClass, eh_Class,A
If (eh_Class = "#32770" OR A_OSVersion = "WIN_VISTA")
send, {F5}
<#
.Synopsis
Displays a visual representation of a calendar.
.Description
Displays a visual representation of a calendar. This function supports multiple months
and lets you highlight specific date ranges or days.
.Parameter Start
The first month to display.
From 8c376bdb5e6d22ab56044bd07f4f631eaa40855d Mon Sep 17 00:00:00 2001
From: Zhao Cai <caizhaoff@gmail.com>
Date: Sun, 27 Oct 2013 22:05:23 -0400
Subject: [PATCH] Disable "Pattern not found" message unless verbose > 0
---
src/edit.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/edit.c b/src/edit.c
From 9dfbbe18f2e84da649f28dc1a3b06935ac0e3b17 Mon Sep 17 00:00:00 2001
From: Zhao Cai <caizhaoff@gmail.com>
Date: Wed, 31 Jul 2013 16:43:01 -0400
Subject: [PATCH] Add QueryPartialMatch to ycm_core
---
cpp/ycm/PythonSupport.cpp | 43 +++++++++++++++++++++++++++++++++++++++++++
cpp/ycm/PythonSupport.h | 11 +++++++++++
cpp/ycm/ycm_core.cpp | 1 +
3 files changed, 55 insertions(+)