Skip to content

Instantly share code, notes, and snippets.

@Likenttt
Likenttt / gist:6bccbc28fdf175f782c65b25a067a86a
Created November 22, 2024 14:51
splits-images-into-parts.py
from PIL import Image
import numpy as np
from pathlib import Path
def is_text_line(line_array, threshold=240):
"""判断是否是文本行(非空白行)"""
# 如果平均像素值接近白色,认为是空白行
return np.mean(line_array) < threshold
@Likenttt
Likenttt / Writing Tools Writeup.markdown
Created August 14, 2024 07:34 — forked from mojavelinux/Writing Tools Writeup.markdown
How To Write A Technical Book (One Man's Modest Suggestions)
@Likenttt
Likenttt / garmin-coros-tri-hr-comparison.py
Last active April 27, 2024 09:58
绘制佳明高驰心率csv到同一坐标系并计算皮尔逊相关系数。佳明文件中包含external heart rate,wrist heart rate,高驰文件中包含heart rate。注意编辑下csv手动对齐时间线,取两端时间线的交集。
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
from matplotlib.font_manager import FontProperties
import pandas as pd
from sklearn.metrics import mean_squared_error
# 指定支持中文的字体路径,这里假设你已经下载了字体文件并放在了相应的路径下
# 请替换成实际字体文件的路径,例如下面的路径只是示例
font_path = '/Users/kent/Downloads/misans/MiSans-Normal.ttf'
@Likenttt
Likenttt / _Google Analytics 4 with Hugo.md
Created October 21, 2022 14:18 — forked from zjeaton/_Google Analytics 4 with Hugo.md
Google Analytics 4 (with Measurement ID) in Hugo

Google Analytics 4 in Hugo

Blog post with slightly more detail can be found here. If you want to just get to it, read on.

I (very) recently decided to reimplement GA in my site, and found that existing implementation in Hugo was not compatible with GA4's new Measurement ID. This is an easy way to drop your Measurement ID into your site. I'm not going to go into how to sign up for GA.

This implementation requires that you create a site parameter for analytics, create a partial, and call the partial. I tweaked the names of the parameters and files so they didn't collide with the built-in hugo code.

Place the GoogleAnalyicsID (Measurement ID) in config.toml within [params].

@Likenttt
Likenttt / .Cloud.md
Created September 22, 2022 17:15 — forked from imba-tjd/.Cloud.md
☁️ 一些免费的云资源

IaaS指提供系统(可以自己选)或者储存空间之类的硬件,软件要自己手动装;PaaS提供语言环境和框架(可以自己选);SaaS只能使用开发好的软件(卖软件本身);BaaS一般类似于非关系数据库,但各家不通用,有时还有一些其它东西。

其他人的集合