Skip to content

Instantly share code, notes, and snippets.

@imneonizer
Last active July 25, 2020 12:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imneonizer/c80e10fc733de87bb8abc7f7b04acda5 to your computer and use it in GitHub Desktop.
Save imneonizer/c80e10fc733de87bb8abc7f7b04acda5 to your computer and use it in GitHub Desktop.

Download from google drive using wget

Set the file to Public, get sharing link and extract FILEID

for small files These can also be directly download by visiting the address or using wget

wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O FILENAME

for large files

wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=FILEID" -O FILENAME && rm -rf /tmp/cookies.txt
# to sort list in numerical/alphabetical
def sort_names(data):
convert = lambda text: int(text) if text.isdigit() else text.lower()
alphanum_key = lambda key: [ convert(c) for c in re.split('([0-9]+)', key) ]
return sorted(data, key=alphanum_key)
#OR
sorted(data, key=lambda x:[int(c) if c.isdigit() else c.lower() for c in re.split('([0-9]+)', x)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment