Skip to content

Instantly share code, notes, and snippets.

@cdpath
cdpath / popclip.js
Last active January 31, 2024 06:47
Gemini PopClip
// #popclip extension for Google Gemini
// name: Google Gemini
// icon: "square filled G"
// language: javascript
// module: true
// entitlements: [network]
// options: [{
// identifier: apikey, label: API Key, type: string,
// description: 'Obtain API key from Google Cloud Console'
// }, {
@cdpath
cdpath / BACK.html
Created November 30, 2023 03:21
Anki Template with User Action
<div class="entry">
<p class="en_bold">
{{entry}}
</p>
<p class="zh_light">{{definition}}</p>
</div>
{{#sentence}}<p class="separator">☙</p>{{/sentence}}
<div class="context">
@cdpath
cdpath / gen_barcode.py
Created April 20, 2023 10:05
generate random barcode
# pip install "python-barcode[images]"
import random
import barcode
from barcode import generate
from barcode.writer import ImageWriter
def calculate_ean13_checksum(code):
odd_sum = sum(int(x) for i, x in enumerate(code) if i % 2 == 0)
even_sum = sum(int(x) for i, x in enumerate(code) if i % 2 == 1)
@cdpath
cdpath / code_reviewer.js
Created March 3, 2023 08:34
PopClip OpenAI Code Reviewer
// #popclip extension for ChatGPT
// name: ChatGPT Code Reviewer
// icon: "square filled CR"
// language: javascript
// module: true
// entitlements: [network]
// options: [{
// identifier: apikey, label: API Key, type: string,
// description: 'Obtain API key from https://platform.openai.com/account/api-keys'
// }]
@cdpath
cdpath / README.md
Last active November 29, 2022 07:22
微信自定义 Emoji 的输入码

微信自定义 Emoji 的输入码来自:

~/Library/Containers/com.tencent.xinWeChat/Data/Library/Application\ Support/com.tencent.xinWeChat/2.0b4.0.9/<hash>/Stickers/StickerStoreData/NewEmojiConfig/newemoji-config.xml
@cdpath
cdpath / Torrent2DS.md
Last active September 7, 2022 16:37
Torrent2DS

first request sid (so as to communicate Synology API)

python t2ds.py login -u <username> -p <password> [--otp 233333]

then create download task

python t2ds.py task --sid

@cdpath
cdpath / config.yaml
Last active May 19, 2022 09:29
OpenPAI
user: openpai
password: openpai
docker_image_tag: v1.8.0
gcr_image_repo: "registry.aliyuncs.com"
kube_image_repo: "registry.aliyuncs.com/google_containers"
openpai_kubespray_extra_var:
pod_infra_image_repo: "registry.aliyuncs.com/google_containers/pause-{{ image_arch }}"
dnsautoscaler_image_repo: "mirrorgooglecontainers/cluster-proportional-autoscaler-{{ image_arch }}"
@cdpath
cdpath / build.sh
Last active March 28, 2022 07:46
give pandoc a try
pandoc \
preface.md \
part-i.md \
ch1.md \
ch2.md \
ch3.md \
ch4.md \
part-ii.md \
ch5.md \
ch6.md \
@cdpath
cdpath / surfingkeys_conf.txt
Last active January 17, 2024 14:16
surfingkeys_conf
const {
map,
unmap,
iunmap
} = api;
// unmap('w');
// unmap('e');
map('w', 'E');
@cdpath
cdpath / mypy_setup.sh
Created October 25, 2021 03:51
pre-commit and mypy
#!/bin/bash
set -euo pipefail
PRECOMMIT_CONFIG=".pre-commit-config.yaml"
MYPY_CONFIG="mypy.ini"
echo "installing pre-commit"
pip install pre-commit