Skip to content

Instantly share code, notes, and snippets.

Honghe /
Created Apr 25, 2019
Excel vlookup加速方案

Excel vlookup加速方案


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

  • 方法2,使用{}返回匹配的整行.
Honghe /
Created Apr 24, 2019
Convert Mysql database tables to Excel
# -*- coding: utf-8 -*-
import logging
import os
import mysql.connector
import pandas as pd
# taken from
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl
View gist:12a1d6ffc5cc580646aeef55cb306ded
with open("audioData_original.wav", 'wb') as of:
audioFile ="audioData_original.wav", 'r')
n_frames = audioFile.getnframes()
audioData = audioFile.readframes(n_frames)
originalRate = audioFile.getframerate()
af ='audioData.wav', 'w')
af.setparams((1, 2, 16000, 0, 'NONE', 'Uncompressed'))
converted = audioop.ratecv(audioData, 2, 1, originalRate, 16000, None)
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 /
Created Jun 22, 2018 — forked from rduplain/
Add a second static directory to Flask, in ../static/.
from flask import Flask, send_from_directory
app = Flask(__name__)
def base_static(filename):
return send_from_directory(app.root_path + '/../static/', filename)
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 / .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 /
Created Jun 8, 2018 — forked from 52cik/
npm 淘宝镜像配置
npm set registry # 注册模块镜像
npm set disturl # node-gyp 编译依赖的 node 源码镜像
## 以下选择添加
npm set sass_binary_site # node-sass 二进制包镜像
npm set electron_mirror # electron 二进制包镜像
npm set puppeteer_download_host # puppeteer 二进制包镜像
npm set chromedriver_cdnurl # chromedriver 二进制包镜像
npm set operadriver_cdnurl # operadriver 二进制包镜像
npm set phantomjs_cdnurl # phantomjs 二进制包镜像
Honghe /
Last active May 8, 2018
Use Google web Translate in Python2
#/usr/bin/env python
import httplib
import md5
import urllib
import urllib2
import HTMLParser
import random