Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
#=================================================================#
# System Required: CentOS 6+, Debian 7+, Ubuntu 12+ #
# Description: One click Install Shadowsocks-Python server #
# Author: Teddysun <[email protected]> #
# Thanks: @clowwindy <https://twitter.com/clowwindy> #
# Intro: https://teddysun.com/342.html #
#=================================================================#
@foolishflyfox
foolishflyfox / python_cv.py
Last active February 4, 2019 13:06
常用的python计算机视觉操作函数
# 对一幅灰度图像进行直方图均衡化
def myhisteq(im, nbr_bins=256):
"""
@im: PIL.Image.Image, mode is L
@return: PIL.Image.Image
"""
np_im = np.asarray(im)
imhist, bins = np.histogram(np_im.flatten(), nbr_bins)
csum = np.cumsum(imhist)
csum = 255 * csum / csum[-1]
@foolishflyfox
foolishflyfox / getip.py
Created March 23, 2019 05:46
Get local address with python
import socket
def getip():
try:
_s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
_s.connect(('8.8.8.8', 80))
ip = _s.getsockname()[0]
finally:
_s.close()
return ip
@foolishflyfox
foolishflyfox / vsc_treejs.md
Created April 4, 2019 08:36
在 vscode 下为three.js 添加自动提示功能
@foolishflyfox
foolishflyfox / .vimrc
Created August 29, 2019 07:22
vim 配置
set filetype=python
"au BufNewFile,BufRead *.py,*.pyw setf python
autocmd FileType python set expandtab
set helplang=cn "中文帮助文档(前提是下了中文包)
syntax enable
syntax on " 自动语法高亮
set number"显示行号
colorscheme desert" 设定配色方案
set guifont=Consolas:h12:cANSI"英文字体
set guifontwide=SimSun-ExtB:h12:cGB2312