Skip to content

Instantly share code, notes, and snippets.

View chaozh's full-sized avatar
🎯
Focusing

chaozh chaozh

🎯
Focusing
View GitHub Profile
@chaozh
chaozh / plugin-name.php
Created May 24, 2018 07:52
simple boilerplate for wordpress plugin development
<?php
/*
Plugin Name: Plugin Name
Plugin URI: http://www.chaozh.com/
Description: [Plugin desc] This version of Plugin requires at least WordPress 3.1 and PHP 5.0+ to work.
Version: 0.1
Author: chaozh
Author URI: http://chaozh.com/
*/
### INSTALLATION/USAGE INSTRUCTIONS ###
@chaozh
chaozh / mongodb
Created March 5, 2017 02:21
mongodb在init.d下服务化脚本
#!/bin/sh
# chkconfig: 35 85 15
# description: Mongo is a scalable, document-oriented database.
# processname: mongod
# config: /etc/mongod.conf
# pidfile: /var/run/mongo/mongo.pid
. /etc/rc.d/init.d/functions
MONGOHOME="/usr/local/mongodb"
@chaozh
chaozh / mongo.conf
Created March 5, 2017 02:16
mongodb数据库配置文件
# mongo.conf
dbpath = /data/db
#port = 27017
#
#where to log
logpath = /var/log/mongodb.log
logappend = true
rest = true
@chaozh
chaozh / lianjia.py
Created February 15, 2017 06:13
链家信息爬虫
# -*- coding: utf-8 -*-
"""
@author: 冰蓝
@site: http://lanbing510.info
"""
import re
import urllib2
import sqlite3
import random
@chaozh
chaozh / pom.xml
Created May 4, 2016 05:46
For Jmeter with maven bug fixed
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
<version>2.8.1-SNAPSHOT</version>
<packaging>pom</packaging>
<dependencies>
<dependency>
@chaozh
chaozh / stl_views.py
Created March 29, 2016 13:49
STL GDB evaluators/views/utilities
#
# STL GDB evaluators/views/utilities - 1.03
#
# The new GDB commands:
# are entirely non instrumental
# do not depend on any "inline"(s) - e.g. size(), [], etc
# are extremely tolerant to debugger settings
#
# This file should be "included" in .gdbinit as following:
# source stl-views.gdb or just paste it into your .gdbinit file
@chaozh
chaozh / varnish.py
Created March 29, 2016 00:42
varnish缓存清理
#!/usr/bin/env python
import sys,os
varnish_adm='varnishadm'
try:
var=sys.argv[1:][0]
if 'http://' in var or 'HTTP://' in var:
domain=var.split('/')[2]
url=var.split(domain)[1]
if url == "":
url=sys.argv[1:][1]
@chaozh
chaozh / CommandOptions.java
Created September 30, 2015 01:53
A storage class for both command line options and shell commands. <code from ZK>
/**
* A storage class for both command line options and shell commands.
*
*/
static class CommandOptions {
private Map<String,String> options = new HashMap<String,String>();
private List<String> cmdArgs = null;
private String command = null;
#!/bin/sh
usage()
{
local name=${0##*/}
cat >&2 <<-END
Rewrite history to squash all commits wiht message starts with 'fixup!' to
its first parent. By drdr.xp@gmail.com