Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tools

Small, standalone command-line utilities.

ghget.py

ghget.py is a small tool for downloading individual files from GitHub. It converts GitHub file page URLs to raw.githubusercontent.com URLs and then runs wget via exec. Except for the URLs, all command-line arguments are passed to wget unchanged and in their original order.

Initial Download

wget https://raw.githubusercontent.com/yeads/tools/main/ghget.py

Requirements

  • Python 3
  • requests
  • wget

Install the Python dependency:

python3 -m pip install requests

Usage

python3 ghget.py [wget options] GITHUB_FILE_URL

For example:

python3 ghget.py -O basic.rs \
  https://github.com/yeads/rrid/tree/main/examples/basic.rs

The URL above is converted to:

https://raw.githubusercontent.com/yeads/rrid/main/examples/basic.rs

Standard GitHub file URLs using /blob/ are also supported:

python3 ghget.py -q --show-progress \
  https://github.com/OWNER/REPOSITORY/blob/BRANCH/PATH/FILE

Options such as -O, -q, and --show-progress are not processed by ghget.py; they are passed to wget unchanged. If a URL on the command line is not a github.com file URL, the program reports an error and exits. When no URL is provided, the arguments are also passed to wget unchanged, so you can use python3 ghget.py --help to view the wget help text.

If a branch or tag name contains /, a GitHub page URL cannot unambiguously distinguish the name from the file path. In this case, use a tag without / or a commit hash.

gptdump.py

gptdump.py downloads a public ChatGPT shared conversation and saves it as a Markdown file. It preserves headings, lists, tables, code blocks, links, and image references, and converts ChatGPT citation and entity annotations into readable Markdown.

Run it with a public chatgpt.com/share URL:

python3 gptdump.py \
  'https://chatgpt.com/share/6aa79994-820c-83e9-a91c-592e2dbd70a4'

By default, the output filename is based on the conversation title. Use -o to choose a path:

python3 gptdump.py SHARE_URL -o conversation.md

The script automatically honors the standard http_proxy and https_proxy environment variables. A proxy can also be provided explicitly:

python3 gptdump.py SHARE_URL --proxy http://127.0.0.1:7890

Existing files are not overwritten unless --force is used with -o. Use --timeout SECONDS to change the default 30-second request timeout, or run python3 gptdump.py --help to see all options.

dnspod.py

dnspod.py manages DNS records hosted by Tencent Cloud DNSPod. It can create or update a record with set, query a hostname with get, list a domain with ls, and remove a record with delete.

Set your Tencent Cloud credentials before use:

export TENCENTCLOUD_SECRET_ID="your-secret-id"
export TENCENTCLOUD_SECRET_KEY="your-secret-key"

Then run commands such as:

python3 dnspod.py set www.example.com 192.0.2.1
python3 dnspod.py get www.example.com
python3 dnspod.py ls example.com
python3 dnspod.py delete www.example.com

Use options such as --type, --line, --line-id, and --ttl to select or configure a record. Run python3 dnspod.py --help for all options. Temporary credentials can also use TENCENTCLOUD_SESSION_TOKEN.

alidns.py

alidns.py manages DNS records hosted by Alibaba Cloud DNS. Like the DNSPod tool, it supports set, get, ls, and delete operations.

Set your Alibaba Cloud credentials before use:

export ALIBABA_CLOUD_ACCESS_KEY_ID="your-access-key-id"
export ALIBABA_CLOUD_ACCESS_KEY_SECRET="your-access-key-secret"

Then run commands such as:

python3 alidns.py set www.example.com 192.0.2.1
python3 alidns.py get www.example.com
python3 alidns.py ls example.com
python3 alidns.py delete www.example.com

Use options such as --type, --line, and --ttl to select or configure a record. Run python3 alidns.py --help for all options. The aliases ALIYUN_ACCESS_KEY_ID and ALIYUN_ACCESS_KEY_SECRET are also accepted, and temporary credentials can use ALIBABA_CLOUD_SECURITY_TOKEN or ALIYUN_SECURITY_TOKEN.

About

personal tools

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages