Skip to content

Instantly share code, notes, and snippets.

View hellowac's full-sized avatar
💖
I may be slow to respond.

hello_wac hellowac

💖
I may be slow to respond.
View GitHub Profile
@hellowac
hellowac / test.txt
Last active April 19, 2017 07:36
测试
这是我测试的Gist
@hellowac
hellowac / multiple_ssh_setting.md
Created May 14, 2017 15:30 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@hellowac
hellowac / dango-send-file.py
Last active November 7, 2017 03:15
django-download-files
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
@hellowac
hellowac / python-zip-files.py
Last active November 7, 2017 03:28
python2.7-zip-files
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))
@hellowac
hellowac / mysql.sql
Last active November 20, 2017 09:16
mysql 语句操作
-- 从另一个表中更新字段.
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(
@hellowac
hellowac / mysql.md
Last active August 31, 2023 11:42
mysql操作注意事项
@hellowac
hellowac / ocr.markdown
Created March 8, 2018 09:07 — forked from henrik/ocr.markdown
OCR on OS X with tesseract

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.

@hellowac
hellowac / webshell.py
Created December 26, 2018 01:54 — forked from phoemur/webshell.py
Basic webshell with Python + Flask and WebSockets (Flask-SocketIO)
#!/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>