Skip to content

Instantly share code, notes, and snippets.

diff --git a/themes/font/font.theme.sh b/themes/font/font.theme.sh
index c691e57..5a9dcc3 100644
--- a/themes/font/font.theme.sh
+++ b/themes/font/font.theme.sh
@@ -37,12 +37,23 @@ THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:-"%I:%M:%S"}
VIRTUALENV_THEME_PROMPT_PREFIX='('
VIRTUALENV_THEME_PROMPT_SUFFIX=') '
+function _python_venv_prompt {
import taichi as ti
ti.init(ti.gpu)
# global control
paused = ti.field(ti.i32, ())
# gravitational constant 6.67408e-11, using 1 for simplicity
G = 1
PI = 3.141592653
@Honghe
Honghe / README.md
Created April 25, 2019 14:54
Excel vlookup加速方案

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 April 24, 2019 09:03
Convert Mysql database tables to Excel
# -*- coding: utf-8 -*-
import logging
import os
import mysql.connector
import pandas as pd
logging.basicConfig(level=logging.DEBUG)
# 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
@Honghe
Honghe / gist:12a1d6ffc5cc580646aeef55cb306ded
Created October 16, 2018 11:01
Python wav sound convert
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 July 25, 2018 07:13 — forked from kylemcdonald/matplotlib Border Removal.ipynb
How to (mostly) remove all borders and padding with matplotlib.
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 June 22, 2018 07:57 — forked from rduplain/app.py
Add a second static directory to Flask, in ../static/.
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 June 8, 2018 15:16
Install Vim 8 with Python, Python 3, Ruby and Lua support on Ubuntu 16.04
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 June 8, 2018 13:40
.vim config use vundle
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