create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "your_email@youremail.com"
这是我测试的Gist |
create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "your_email@youremail.com"
from django.http import FileResponse | |
def get(self, request, *args, **kwargs): | |
""" download file """ | |
zip_file = get_zip_file() | |
response = FileResponse(open(zip_file, 'rb'), content_type=mimetypes.guess_type(zip_file)[0]) | |
response['Content-Length'] = os.path.getsize(zip_file) | |
response['Content-Disposition'] = "attachment; filename=%s" % os.path.basename(zip_file) | |
return response |
import os | |
from os import path | |
import zipfile | |
def get_zip_files(phone): | |
""" get ziped file path """ | |
files_dir = get_file_dir(phone) | |
ziped = path.join(path.dirname(files_dir), '{}.zip'.format(phone)) |
-- 从另一个表中更新字段. | |
UPDATE tableB | |
INNER JOIN tableA ON tableB.name = tableA.name | |
SET tableB.value = IF(tableA.value > 0, tableA.value, tableB.value) | |
WHERE tableA.name = 'Joe' | |
-- 更细log表中没有version的字段. | |
UPDATE pdv_user_crawl_statistic_log AS log | |
INNER JOIN triple_applicant_user_info as info | |
ON log.user_phone = info.phone |
# 使用SQLAlchemy的连接池 | |
import MySQLdb | |
import MySQLdb.cursors | |
from sqlalchemy import pool | |
def get_read_conn(): | |
''' | |
mysql 读的连接 | |
''' | |
conn = MySQLdb.connect( |
Install ImageMagick for image conversion:
brew install imagemagick
Install tesseract for OCR:
brew install tesseract --all-languages
Or install without --all-languages
and install them manually as needed.
#!/usr/bin/env python | |
import subprocess | |
from flask import Flask, render_template | |
from flask_socketio import SocketIO, send, emit | |
HTML = ''' | |
<html> | |
<head> | |
<title>WEBSHELL</title> |