Skip to content

Instantly share code, notes, and snippets.

View jbdemonte's full-sized avatar
🏠
Working from home

jean-baptiste demonte jbdemonte

🏠
Working from home
View GitHub Profile
@jbdemonte
jbdemonte / get_content_disposition.py
Last active December 10, 2015 23:28 — forked from tlebel/get_content_disposition.py
fix les browsers anonymes
from django.utils.encoding import iri_to_uri
import base64
def __get_content_disposition(request, nom_fichier):
"""
Permet de générer la bonne chaine de caractère, selon le navigateur représentant le nom du fichier
"""
if 'HTTP_USER_AGENT' in inRequest.META and ("Firefox/" in inRequest.META['HTTP_USER_AGENT'] or "Chrome/" in inRequest.META['HTTP_USER_AGENT']):
# FF et Chrome: aiment le format base64 splitté en petits blocs
# attachment; filename="=?UTF-8?B?VW4gZmljaGllciBzcMOpY2lhbCBhdmVjIGFjY2VudCBtYWlzIA==?= =?UTF-8?B?YXZlYyB1biB0csOocyBsb25nIG5vbSBkZSBmaWNoaWVyLnR4dA==?="
@jbdemonte
jbdemonte / curl-download.sh
Created August 30, 2018 08:05
Google Drive large file download script using curl
#!/bin/bash
# Based on http://blog.mclain.ca/download-large-files-from-google-drive-via-curl/
# Usage: ./curl-download.sh file_id
file_id=$1
if [[ -z "$file_id" ]]; then
echo "ERROR - file_id is missing"
echo " Usage: ./curl-download.sh file_id"