Skip to content

Instantly share code, notes, and snippets.

ZhangWei zhwei

Block or report user

Report or block zhwei

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
View gist:e15caac74747da95347185225a12a991
[
{"label": "Bei Jing", "value": "bj"},
{"label": "Shang Hai", "value": "sh"},
{"label": "Guang Zhou", "value": "gz"},
{"label": "Shen Zhen", "value": "sz"},
{"label": "Hang Zhou", "value": "hz"}
]
@zhwei
zhwei / generate-release-body.sh
Last active Feb 11, 2017
Generate release body from commits
View generate-release-body.sh
# Example
#
# $ git show `(git tag | tail -n 1)` | head -n 1 | awk -F ' ' '{print $2}' | \
# xargs -IX git log --format='- [%s](https://github.com/wutongwan/Laputa/commit/%h) @%an' X...
#
# - [increment version](https://github.com/wutongwan/Laputa/commit/7e56021) @Zhang Wei
# - [修正 Mode Operator 中 mode 的继承关系 && 使用 HTMLFacade 替换简单 view](https://github.com/wutongwan/Laputa/commit/4e09b9c) @zhwei
# - [修改数据源函数的可见性 && add model() to form](https://github.com/wutongwan/Laputa/commit/2ed41ce) @zhwei
@zhwei
zhwei / php-ufo.md
Last active Mar 27, 2017
PHP 的坑
View php-ufo.md

== && ===

>>> '233' == '233 '
=> false
>>> '233' == ' 233'
=> true
>>> '233' === ' 233'
=> false
View _ide_helper_laravel.php
<?php
/**
* Supplement to [barryvdh/laravel-ide-helper](https://github.com/barryvdh/laravel-ide-helper)
*
* Usage:
* > cd /your/project/
* > curl https://gist.githubusercontent.com/zhwei/f13ea35b157d4b8687118e6b40ff30b7/raw > _ide_helper_laravel.php
*
* Project Link: https://gist.github.com/zhwei/f13ea35b157d4b8687118e6b40ff30b7
*
@zhwei
zhwei / sub-branches.json
Last active Jan 29, 2019
完整国内支行联行号(部分国外,取自中信银行)
View sub-branches.json
This file has been truncated, but you can view the full file.
{
"000998800006": "电子联行转换中心",
"001100001509": "中国人民银行营业管理部营业室",
"001110002715": "中国人民银行天津分行营业管理部",
"001110002774": "中国人民银行天津分行塘沽中心支行营业部",
"001121004527": "中国人民银行石家庄中心支行营业部",
"001121004535": "中国人民银行赞皇县支行",
"001121004543": "中国人民银行元氏县支行",
"001121004551": "中国人民银行赵县支行",
@zhwei
zhwei / BaiduAdCleaner.js
Last active Aug 15, 2016
Baidu Ad Cleaner
View BaiduAdCleaner.js
// ==UserScript==
// @name Baidu Ad Cleaner
// @version 0.2
// @description Baidu Result Set Ad Cleaner
// @author zhwei
// @match ://www.baidu.com/*
// @updateURL https://gist.github.com/zhwei/3c4c595f072d049d416d5b26f5e044f9/raw/4aadcb34dc44c3abb786b89bf535a3fa96355ac7/BaiduAdCleaner.js
// @downloadURL https://gist.github.com/zhwei/3c4c595f072d049d416d5b26f5e044f9/raw/4aadcb34dc44c3abb786b89bf535a3fa96355ac7/BaiduAdCleaner.js
// @grant none
// ==/UserScript==
@zhwei
zhwei / export_as_xlsx.py
Last active May 4, 2016
MySQL Workbench Plugin: Export Result Set As Excel Xlsx
View export_as_xlsx.py
# -*- coding: utf-8 -*-
#
# Export Result Set As Excel Xlsx File
#
# Installation:
# 1. Install Python(2.7) Module "XlsxWriter", See http://xlsxwriter.readthedocs.org/getting_started.html
# 2. In MySQL Workbench
# Scripting => Install Plugin/Module... => <select this script> => <restart mysql workbench>
#
# Usage:
View asyncredis.py
import tornadoredis
class AsyncRedis(Redis):
CONNECTION_POOLS = {}
@classmethod
def get_conn(cls, name='DEFAULT'):
host, port, db = cls._get_config(name)
@zhwei
zhwei / sendmail.py
Last active Aug 29, 2015
Python Send Mail
View sendmail.py
import smtplib
from email.utils import formataddr
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
def send_mail(sender, alias, to, subject, body, msg_type='plain', reply_to=None):
msg = MIMEMultipart('alternative')
msg['From'] = formataddr((alias, sender))
@zhwei
zhwei / rename_file.py
Created Feb 9, 2015
rename file script
View rename_file.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Rename: baixing.log-1420614280.gz => baixing.log-20150107-150440.gz
import os
import datetime
to_date = lambda x: datetime.datetime.fromtimestamp(int(x)).strftime('%Y%m%d-%H%M%S')
file_list = os.listdir(".")
You can’t perform that action at this time.