getcode (gc) — fetch code from GetSomeSleepBro/codes without cloning
Overview
- Simple, intuitive CLI to browse and fetch code from the GitHub repo online (no full clone).
- Defaults to latest version when multiple implementations (v1, v2, …) exist.
- Stdlib-only (urllib); optional GitHub token to avoid rate limits.
Install
- pip install getcodes
- Console scripts:
getcode,gc, andg.
Config
- Env vars:
GETCODE_REPO(default:GetSomeSleepBro/codes)GETCODE_BRANCH(default:main)GITHUB_TOKEN(optional; increases rate limits)
Basic Use
- List subjects with versions:
g subjectsorg subs- Example output:
DSA (v1, v3)— subjects are discovered dynamically.
- Quick shorthand:
g dbms→ list DBMS codes (defaults to latest version when multiple exist)g dbms ddl→ fetch best match for "ddl" in DBMS (copy/save based on default)g DSA/v3/B6_BSTops.cpp→ fetch by repo path
- List codes in a subject (latest version by default):
g list DSAg list CNS --ext .py(only Python)g list DBMS --all-versions --full-path
- Show summary info:
g info(totals and latest version per subject)g info --subject DSA --all-versions
- Search filenames across subjects:
g search bst --ext .cppg search tcp --subject CNS
- Fetch by repo path:
g get DSA/v3/B6_BSTops.cpp --to ./codes
- Fetch by subject + pattern or exact name (simple):
gc get dbms ddl(best match in DBMS)gc get cns sliding_window.py(exact name in CNS)
- Fetch by subject + name (chooses latest version if multiple):
g get -s DSA -n B6_BSTops.cpp --to ./codesg get -s DSA -n B6_BSTops.cpp -v v2(specific version)
- Fetch by subject + pattern (picks best match):
g dsa bst(shorthand; default action applies)g get -s DSA -m bst --to ./codes- Copy instead of saving:
g dsa bst --copy(shorthand)- or
g get -s DSA -m bst --copy
- Flatten save path (avoid nested folders):
g get DSA/v3/B6_BSTops.cpp --flatten
Bulk Download
- Entire repo:
g all - Single subject (all versions):
g all DSA - Single subject, specific version:
g all DSA -v v3 - Custom destination: add
--to ./downloads
Notes
- Version folders appear only when multiple implementations exist. The CLI shows only the latest by default (highest vN). Use
--all-versionsto see others. - Listing recurses into nested folders (e.g.,
CNS/programs,DBMS/sql). - If saving multiple files with
--flattenand names collide, the CLI appends a suffix (e.g.,-v3). - Network errors or API rate limits print a friendly hint to set
GITHUB_TOKEN. - Automatic fallback: if the GitHub API is rate-limited/unavailable, the CLI downloads a temporary ZIP snapshot of the repo and serves listings/reads from it. The snapshot lives in a temp folder and is cleaned up automatically at process exit (including Ctrl+C).
Env Vars
GETCODE_DEFAULT_ACTION=copyto copy by default.GITHUB_TOKENto increase API limits.GETCODE_MODE=zipto force ZIP fallback (offline-friendly).GETCODE_DOWNLOAD_DIRdefault destination for bulk downloads (g all,g all <SUBJECT>).
Clipboard
- Copy text directly: add
--copy(or-c) togc getwhen fetching a single file. - Make copy the default action instead of saving files:
export GETCODE_DEFAULT_ACTION=copy
- Clipboard uses built-in OS tools (macOS
pbcopy, Windowsclip) or stdlibtkinterwhen available.
Help
g helpshows quick examples and tips right in the terminal.
Windows
- PowerShell has a built-in
gcalias forGet-Content. Use thegalias to avoid conflicts.
Metadata
Release files for getcodes 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| getcodes-0.1.5.tar.gz | 19.0 kB | Without provenance | Details for getcodes-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| getcodes-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for getcodes-0.1.5-py3-none-any.whl |
Total release size: 36.2 kB
Release files / getcodes-0.1.5.tar.gz
| Download URL | getcodes-0.1.5.tar.gz |
|---|---|
| Size | 19.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4e0e88371d724e3ea451535fa7cb426e4fab971bc8d8d08983116e098e743d67
|
|
BLAKE2b-256 checksum How to use checksums |
09de7df95feb14541f1f69c5ed58093095c994badc166315fa699098846d5afb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / getcodes-0.1.5-py3-none-any.whl
| Download URL | getcodes-0.1.5-py3-none-any.whl |
|---|---|
| Size | 17.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
10c4b15afd82e86544bed4fd69d672775fcda11250a6f773ca9335096a0472b0
|
|
BLAKE2b-256 checksum How to use checksums |
304817cec17aa5c18aab4279466286bbcee685fde2c1f27cb353493b495a140d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Security for getcodes 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.