This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from google.appengine.ext import blobstore | |
from google.appengine.ext import ndb | |
# Model for data. | |
class StoredFiles(ndb.Model): | |
file_id = ndb.StringProperty() | |
blob_key = ndb.BlobKeyProperty() | |
def get_upload_url(): | |
"""Generates and returns an upload URL.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def upload(): | |
f = request.vars.file.file # This is the file. | |
# See here for docs: https://cloud.google.com/appengine/docs/python/googlecloudstorageclient/functions | |
gcs_file = cloudstorate.open("mybucket/myfilename", 'w', content_type="image/jpeg") | |
gcs_file.write(f.read()) | |
gcs_file.close() | |
f.close() | |
return "ok" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# this file is released under public domain and you can use without limitations | |
# ------------------------------------------------------------------------- | |
# Sample shopping cart implementation. | |
# ------------------------------------------------------------------------- | |
import traceback | |
def index(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import requests | |
import time | |
import yaml | |
api_info = yaml.load(open('api_info.yaml')) | |
# Files to upload to a comparison. | |
FILE_LIST = map(lambda x: os.path.join('test_files', x), | |
['p1.py', 'p2.py', 'p3.py', 'p4.py', 's1.py', 's2.py', 't1.py', 't4.py']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import argparse | |
import os | |
import shutil | |
import subprocess | |
exifcmd = "/usr/local/bin/exiftool" | |
def main(args): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import zipfile | |
import shutil | |
def zip_all_in_folder(folder_path, base_path, output_zip): | |
# Create a ZIP file | |
with zipfile.ZipFile(output_zip, 'w', zipfile.ZIP_DEFLATED) as zipf: | |
# Walk through the directory | |
for root, dirs, files in os.walk(folder_path): | |
for file in files: |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright Luca de Alfaro, 2024. | |
# BSD License. | |
""" | |
Usage: | |
python ls.py <dir_id> [-d <depth>] [-a] | |
-d: maximum depth at which to inspect directories. Default is 1. | |
-a: list all directories, not just the top one. |