Skip to content

Instantly share code, notes, and snippets.

View kittozheng's full-sized avatar

lkkkk kittozheng

View GitHub Profile
@hustlzp
hustlzp / process_image.py
Last active January 21, 2018 12:10
将Flask中上传的图片居中裁剪为正方形、缩放、保存
import os
import uuid
from PIL import Image
from flask.ext.uploads import extension
def random_filename():
"""生成伪随机uuid字符串,用做文件名"""
return str(uuid.uuid4())
@mattupstate
mattupstate / app.py
Created March 15, 2012 19:08
Flask application configuration using an environment variable and YAML
os
from flask_extended import Flask
app = Flask(__name__)
app.config.from_yaml(os.join(app.root_path, 'config.yml'))
#!/usr/bin/env python
#
# Converts any integer into a base [BASE] number. I have chosen 62
# as it is meant to represent the integers using all the alphanumeric
# characters, [no special characters] = {0..9}, {A..Z}, {a..z}
#
# I plan on using this to shorten the representation of possibly long ids,
# a la url shortenters
#