Skip to content

Instantly share code, notes, and snippets.

@ppkliu
ppkliu / README_hfd.md
Created February 20, 2025 12:04 — forked from relic-yuexi/README_hfd.md
CLI-Tool for download Huggingface models and datasets with aria2/wget+git

🤗Huggingface 模型下载器

考虑到官方的 huggingface-cli 缺乏多线程下载支持,以及 hf_transfer 错误处理不足的问题,这个命令行工具巧妙地利用 wgetaria2 下载 LFS 文件,并使用 git clone 下载其他文件。

特性

  • ⏯️ 断点续传: 你可以随时重新运行或使用 Ctrl+C 中断下载。
  • 🚀 多线程下载: 利用多线程加速下载过程。
  • 🚫 文件排除: 使用 --exclude--include 跳过或指定要下载的文件,节省时间以避免下载模型的重复格式文件(例如 .bin 和 .safetensors)。
  • 🔐 认证支持: 对于需要 Huggingface 登录的私有模型,使用 --hf_username--hf_token 进行身份验证。
  • 🪞 镜像站点支持: 通过设置 HF_ENDPOINT 环境变量使用镜像站点。
@ppkliu
ppkliu / pdftitle.py
Created August 1, 2024 07:42 — forked from hanjianwei/pdftitle.py
Extract title from pdf file.
#!/usr/bin/env python
"""
Extract title from PDF file.
Depends on: pyPDF, PDFMiner.
Usage:
find . -name "*.pdf" | xargs -I{} pdftitle -d tmp --rename {}
@ppkliu
ppkliu / docker-registry-mirrors.md
Created June 13, 2024 06:34 — forked from y0ngb1n/docker-registry-mirrors.md
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized
@ppkliu
ppkliu / download_GoogleDrive.py
Created December 12, 2023 10:16 — forked from henrych4/download_GoogleDrive.py
A python script for downloading file in google drive
#Reference: https://stackoverflow.com/questions/38511444/python-download-files-from-google-drive-using-url
import requests
def download_file_from_google_drive(id, destination):
URL = "https://docs.google.com/uc?export=download"
session = requests.Session()
response = session.get(URL, params = { 'id' : id }, stream = True)
@ppkliu
ppkliu / tds3034.py
Created September 6, 2021 05:51 — forked from hypoxic/tds3034.py
Code used to capture a waveform from the Tek TDS3000 series and send it to python
# Hypoxic Capture via TDS 3034B
# Requires pyvisa and NI-VISA, not tested much, but figured I'd share as it would be helpful for others
import pyvisa
import numpy as np
import time as time
class Tek:
def __init__(self, source = "CH1"):
self.timeout = 5.0
@ppkliu
ppkliu / scpi_tcp.py
Created May 22, 2021 02:34 — forked from pklaus/scpi_tcp.py
Python script to send commands to a Rigol scope (or any LXI/SCPI instrument) from first principles.
#!/usr/bin/env python
"""
Zeroconf Discovery for Rigol DS1000Z-series scopes
--------------------------------------------------
Documentation worth looking at:
* http://lxistandard.org/Documents/Specifications/LXI%20Device%20Specification%202011%20rev%201.4.pdf
* http://lxistandard.org/GuidesForUsingLXI/Introducing%20LXI%20To%20Your%20Network%20Administrator%20May%2024_2013.pdf
* http://lxistandard.org/GuidesForUsingLXI/LXI_Getting_Started_Guide_May_1_2013.pdf
@ppkliu
ppkliu / docker-compose-backup.sh
Created January 28, 2021 09:35 — forked from pirate/docker-compose-backup.sh
Backup a docker-compose project, including all images, named and unnamed volumes, container filesystems, config, logs, and databases.
#!/usr/bin/env bash
### Bash Environment Setup
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
# https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
# set -o xtrace
set -o errexit
set -o errtrace
set -o nounset
set -o pipefail
@ppkliu
ppkliu / fetch_stocks_price.py
Created March 4, 2017 11:56 — forked from dolphinsue319/fetch_stocks_price.py
Fetch Taiwan OTC stocks price.
# coding=utf-8
import StringIO
import csv
import requests
from bs4 import BeautifulSoup
import time
import random
from Models import *