Skip to content

Instantly share code, notes, and snippets.

View chzyer's full-sized avatar

ChenYe chzyer

  • China
View GitHub Profile
@chzyer
chzyer / designer.html
Last active August 29, 2015 14:07
designer
<link rel="import" href="../polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;

Logstash

目录结构:

client.conf
	用于限定机器的列表,并指定对应机房名称,支持目录glob匹配

permission.conf

用于权限控制

public byte[] readFully(InputStream in) throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
byte[] buffer = new byte[1024]; //you can configure the buffer size
while (true) {
int r = in.read(buffer);
if (r == -1) break;
out.write(buffer, 0, r);
}
return out.toByteArray();
@chzyer
chzyer / deadlink.sh
Last active December 30, 2016 16:46
检查本地死链接
def make(progress):
data = sorted([[v, k] for k, v in progress.iteritems()])
idx = 0
for i in range(len(data)-1, -1, -1):
if i == 0: continue
data[i][0] -= data[i-1][0]
real_data = []
length = 0
for i in data:
if length < 0:
@chzyer
chzyer / manhua.go
Created August 28, 2013 16:36
本地运行后可以看火影漫画
package main
// open http://localhost:8000
import (
"net/http"
"io/ioutil"
"regexp"
)
var RePic = regexp.MustCompile(`"http://pic2.52pk.com/files[^"]+`)
@chzyer
chzyer / read.md
Last active December 16, 2015 18:09
@chzyer
chzyer / a.md
Last active December 16, 2015 05:39

ImageInfo

代码

type ImageInfo struct {
}

函数

@chzyer
chzyer / demo.py
Last active December 16, 2015 01:19
python 模板模块
# -*- coding: utf-8 -*-
import tpl
if __name__ == "__main__":
f = open("tpl.html", "r")
t = tpl.Tpl(f.read())
f.close()
print t.substitute(name="func", return=[dict(name="a"), dict(name="b")])
''' result
@chzyer
chzyer / andfree-refactory.md
Last active December 14, 2015 23:49
andfree重构文档

AndFree 重构计划

目录

1. 数据库封装 (db)
2. 控件封装 (widget)
3. ContentProvider和数据库对等封装 (rdb)
4. 网络库封装 (net)
5. 辅助函数 (helper)
6. 其他