Skip to content

Instantly share code, notes, and snippets.

View TrickBit's full-sized avatar

TrickBit TrickBit

  • Australia
View GitHub Profile
@TrickBit
TrickBit / gh_url_to_raw_gh_url.py
Created June 29, 2023 11:37 — forked from fedarko/gh_url_to_raw_gh_url.py
Convert a github file URL to a raw.githubusercontent.com URL (that can be directly accessed for things like view.qiime2.org or wget)
# your link goes here
link = "https://github.com/knightlab-analyses/qurro-mackerel-analysis/blob/master/AnalysisOutput/qurro-plot.qzv"
# note: this will break if a repo/organization or subfolder is named "blob" -- would be ideal to use a fancy regex
# to be more precise here
print(link.replace("github.com", "raw.githubusercontent.com").replace("/blob/", "/"))
# example output link:
# https://raw.githubusercontent.com/knightlab-analyses/qurro-mackerel-analysis/master/AnalysisOutput/qurro-plot.qzv