Skip to content

Instantly share code, notes, and snippets.

@Choumingzhao
Choumingzhao / get_critical_r.py
Created March 30, 2026 08:34
Calculate the critical value of Pearson's r for a given alpha and sample size.
import scipy.stats
from math import sqrt
def get_critical_r(alpha, n, two_tailed=True):
"""Calculate the critical value of Pearson's r for a given alpha and sample size.
Args:
alpha: The significance level.
n: The sample size.
two_tailed: Whether to return a two-tailed critical value.
@Choumingzhao
Choumingzhao / CopyNotify.md
Last active February 9, 2026 06:45
AutoHotkey v2: Visual Notification for Ctrl+C Clipboard Copies

Visual Notification for Ctrl+C Clipboard Copies using AHK v2

A lightweight AutoHotkey v2 script that provides visual feedback (Tooltip) when you copy text using the Ctrl+C shortcut.
Key Features:

  • v2 Syntax: Fully compatible with AutoHotkey v2.0+.
  • User-Centric: Specifically checks for the Ctrl key state so it doesn't trigger when background apps change your clipboard.
  • Non-Intrusive: Uses a temporary ToolTip that follows the mouse and disappears automatically.

How to use:

  1. Install AutoHotkey v2.
  2. Create a new .ahk file and paste the code.
@Choumingzhao
Choumingzhao / evalscript_for_maoming_flood.js
Last active February 4, 2026 09:29
Evalscript for the mapping of flood on 2023.10 in Maoming, Guangdong., PRC
//VERSION=3
// This is a simple adoption from Sentinel-hub use case from [https://custom-scripts.sentinel-hub.com/sentinel-1/flood_mapping/]
// To share a long evalscript, we need a public url. Github Gist's raw url is nice way.
var beforeflood_date = "2023-10-12"; var duringflood_date = "2023-10-24";
function setup() {
return {
input: [{
bands: [
"VV"
]
@Choumingzhao
Choumingzhao / zsh_duplicate_conda_venv_name.md
Created July 1, 2025 07:24
How to fix duplicate conda venv names in zsh prompt?

📛 Title:

Avoid Conda (base) in Zsh but Keep It in Bash (Oh My Zsh + Conda Prompt Fix)


📄 Description:

How to prevent Conda from prepending (base) to your Zsh prompt while keeping it in Bash. This is useful when using a custom prompt like Oh My Zsh that already shows Conda/venv info, avoiding redundant display like (base) 🐍 base.

@Choumingzhao
Choumingzhao / force-gpt4o-mini.user.js
Last active December 7, 2024 17:59
UserScript to Force using GPT4o-mini in ChatGPT.
// ==UserScript==
// @name Force GPT-4o-mini
// @namespace altbdoor
// @match https://chatgpt.com/*
// @grant GM.setValue
// @grant GM.getValue
// @version 1.9
// @author altbdoor(original) and Choumingzhao(current edit)
// @run-at document-start
// @updateURL https://github.com/altbdoor/userscripts/raw/master/force-gpt3.user.js
@Choumingzhao
Choumingzhao / sudo_python.md
Last active March 1, 2024 08:49
Run current python with sudo

A shell function for easier running python script with sudo

#!/usr/bin/env bash
# Invoke current python as sudo
sudo_python() {
    local python_path
    python_path=$(which python)
    if [ -z "$python_path" ]; then
        echo "Python not found in PATH"
@Choumingzhao
Choumingzhao / postgis_quick_notes.md
Last active September 26, 2021 09:47
PostGIS快速上手使用

PostGIS中文速查速用手册

这是PostgreSQL 和 PostGIS的PostGIS部分,主要讲PostgreSQL的空间相关功能的使用

空间相关配置

开启栅格支持

postgres 账户下,修改 ~/.profile,加入如下:

@Choumingzhao
Choumingzhao / pg_quick_notes.md
Last active October 20, 2021 01:27
快速上手使用PostgreSQL和PostGIS

PostgreSQL、PostGIS 中文速查手册

这是一个你可能需要的一个备忘手册,此手册方便你快速查询到你需要的常见功能。有时也有一些曾经被使用过的高级功能。如无特殊说明,此手册仅适用于 Linux 下(基本都可以愉快运行,一般也都可以在 Windows 下的 psql 命令窗运行,只是稍微麻烦一点),部分功能可能需要你的软件版本不能太低。

欢迎添加你认为有价值的备忘!

安装PostgreSQL 和 PostGIS

在Ubuntu上,使用Ubuntu-GIS的专门 ppa 来安装最新 GIS 软件,并保持更新。

@Choumingzhao
Choumingzhao / Linux_notes_for_newbee.md
Last active August 17, 2021 02:44
Useful notes for Linux newbee

Useful Linux notes for novice

Linux Universal

Distribution specific(Debian/Ubuntu)

  1. Locate installed package/libraries by apt
    $ dpkg -L <package-name>