Skip to content

Instantly share code, notes, and snippets.

Honghe Honghe

Block or report user

Report or block Honghe

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Honghe
Honghe / README.md
Created Apr 25, 2019
Excel vlookup加速方案
View README.md

Excel vlookup加速方案

方案

  • 方法1,使用Python merge 在使用Excel时,我用的最多函数就是vlookup;在使用SQL查询的时候,我用的最多应该是join;这两个都有相同的功能,将多表匹配、合并,然后达到对比、查漏等等效果。在pandas里面也有类似的功能函数就是pd.merge()。merge的用法跟SQL中join很像。

https://zhuanlan.zhihu.com/p/30113030

  • 方法2,使用{}返回匹配的整行.
@Honghe
Honghe / sql_to_xlsx.py
Created Apr 24, 2019
Convert Mysql database tables to Excel
View sql_to_xlsx.py
# -*- coding: utf-8 -*-
import logging
import os
import mysql.connector
import pandas as pd
logging.basicConfig(level=logging.DEBUG)
View simple-https-server.py
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl
View gist:12a1d6ffc5cc580646aeef55cb306ded
with open("audioData_original.wav", 'wb') as of:
of.write(message['audio'])
audioFile = wave.open("audioData_original.wav", 'r')
n_frames = audioFile.getnframes()
audioData = audioFile.readframes(n_frames)
originalRate = audioFile.getframerate()
af = wave.open('audioData.wav', 'w')
af.setnchannels(1)
af.setparams((1, 2, 16000, 0, 'NONE', 'Uncompressed'))
converted = audioop.ratecv(audioData, 2, 1, originalRate, 16000, None)
@Honghe
Honghe / matplotlib Border Removal.ipynb
Created Jul 25, 2018 — forked from kylemcdonald/matplotlib Border Removal.ipynb
How to (mostly) remove all borders and padding with matplotlib.
View matplotlib Border Removal.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Honghe
Honghe / app.py
Created Jun 22, 2018 — forked from rduplain/app.py
Add a second static directory to Flask, in ../static/.
View app.py
from flask import Flask, send_from_directory
app = Flask(__name__)
@app.route('/base/<path:filename>')
def base_static(filename):
return send_from_directory(app.root_path + '/../static/', filename)
@Honghe
Honghe / gist:45e01ef6083268d1f43dad24b74ddab0
Last active Jun 8, 2018
Install Vim 8 with Python, Python 3, Ruby and Lua support on Ubuntu 16.04
View gist:45e01ef6083268d1f43dad24b74ddab0
sudo apt-get remove --purge vim vim-runtime vim-gnome vim-tiny vim-gui-common
sudo apt-get install liblua5.1-dev luajit libluajit-5.1 python-dev ruby-dev libperl-dev libncurses5-dev libatk1.0-dev libx11-dev libxpm-dev libxt-dev
#Optional: so vim can be uninstalled again via `dpkg -r vim`
sudo apt-get install checkinstall
# use `which vim` to locate the vim directory first
sudo rm -rf /usr/local/share/vim /usr/bin/vim /usr/local/bin/vim
@Honghe
Honghe / .vimrc
Created Jun 8, 2018
.vim config use vundle
View .vimrc
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
set runtimepath^=~/.vim/bundle/ctrlp.vim
" TUI 颜色设置
" set termguicolors
" TUI 颜色设置,不然 vim-airline等着色不对
"set t_Co=256
@Honghe
Honghe / npm.taobao.sh
Created Jun 8, 2018 — forked from 52cik/npm.taobao.sh
npm 淘宝镜像配置
View npm.taobao.sh
npm set registry https://registry.npm.taobao.org # 注册模块镜像
npm set disturl https://npm.taobao.org/dist # node-gyp 编译依赖的 node 源码镜像
## 以下选择添加
npm set sass_binary_site https://npm.taobao.org/mirrors/node-sass # node-sass 二进制包镜像
npm set electron_mirror https://npm.taobao.org/mirrors/electron/ # electron 二进制包镜像
npm set puppeteer_download_host https://npm.taobao.org/mirrors # puppeteer 二进制包镜像
npm set chromedriver_cdnurl https://npm.taobao.org/mirrors/chromedriver # chromedriver 二进制包镜像
npm set operadriver_cdnurl https://npm.taobao.org/mirrors/operadriver # operadriver 二进制包镜像
npm set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs # phantomjs 二进制包镜像
@Honghe
Honghe / translateByGoogle.py
Last active May 8, 2018
Use Google web Translate in Python2
View translateByGoogle.py
#/usr/bin/env python
#coding=utf8
import httplib
import md5
import urllib
import urllib2
import HTMLParser
import random
You can’t perform that action at this time.