Skip to content

Instantly share code, notes, and snippets.

View polunzh's full-sized avatar
🎯
Focusing

zhenqiang polunzh

🎯
Focusing
View GitHub Profile
@polunzh
polunzh / express.md
Created January 10, 2017 14:26 — forked from dlutwuwei/express.md
express4.2源码解析

title: express4.2源码解析 date: 2014-05-18 15:00:50 categories: express tags: [nodejs, node, js, express]

express是nodejs平台上一个非常流行的框架,4.2.0是最新的版本,相比3.x版本优化了代码和api,去除了connect模块,自己实现了一个router组件,实现http请求的顺序流程处理,去除了很多绑定的中间件,使代码更清晰。

##1.使用express 如何使用express在官网有很好的讲解,只用experssjs实例app的几个函数,就可以构建构建web程序。

@polunzh
polunzh / Delete all documents in a Solr index using curl.sh
Created September 29, 2016 04:44 — forked from nz/Delete all documents in a Solr index using curl.md
Delete all documents in a Solr index using curl
# http://wiki.apache.org/solr/FAQ#How_can_I_delete_all_documents_from_my_index.3F
# http://wiki.apache.org/solr/UpdateXmlMessages#Updating_a_Data_Record_via_curl
curl http://index.websolr.com/solr/a0b1c2d3/update -H "Content-Type: text/xml" --data-binary '<delete><query>*:*</query></delete>'

解决 Git 在 windows 下中文乱码的问题

原因

中文乱码的根源在于 windows 基于一些历史原因无法全面支持 utf-8 编码格式,并且也无法通过有效手段令其全面支持。

解决方案

  1. 安装
@polunzh
polunzh / pre-commit
Last active September 4, 2017 15:30 — forked from arnobroekhof/pre-commit
Maven pre commit hook
#!/bin/bash
# 放在 <git_directory>/.git/hooks/pre-commit
echo "执行 Maven clean test 检查单元测试是否通过..."
# retrieving current working directory
CWD=`pwd`
MAIN_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# 返回项目主目录
cd $MAIN_DIR/../../
@polunzh
polunzh / recorder.py
Created March 12, 2016 07:50 — forked from sloria/recorder.py
WAV recording functionality using pyaudio
# -*- coding: utf-8 -*-
'''recorder.py
Provides WAV recording functionality via two approaches:
Blocking mode (record for a set duration):
>>> rec = Recorder(channels=2)
>>> with rec.open('blocking.wav', 'wb') as recfile:
... recfile.record(duration=5.0)
Non-blocking mode (start and stop recording):