Skip to content

Instantly share code, notes, and snippets.

View ZhangYet's full-sized avatar
:octocat:
Focusing

dantezy ZhangYet

:octocat:
Focusing
View GitHub Profile
@ZhangYet
ZhangYet / app.py
Last active March 17, 2021 05:23
a flask app example for
# Run with `gunicorn app:app`
import os
from flask import Flask
def create_app(test_config=None):
# create and configure the app
app = Flask(__name__, instance_relative_config=True)
app.config.from_mapping(
@ZhangYet
ZhangYet / grpc_note.html
Created June 27, 2020 05:13
grpc_note.html
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2020-06-27 六 13:10 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>grpc-go 源代码阅读笔记</title>
<meta name="generator" content="Org mode" />
@ZhangYet
ZhangYet / random_string_test.go
Created May 1, 2020 02:32
生成随机字符串并检查重复性
package main
import (
"fmt"
"github.com/dchest/uniuri"
)
func init() {
uniuri.StdChars = []byte("1234567890QWERTYUIOPASDFGHJKLZXCVBNM")

Keybase proof

I hereby claim:

  • I am zhangyet on github.
  • I am dantezy (https://keybase.io/dantezy) on keybase.
  • I have a public key ASAoFZnJz639hZHW99UZ-X2ngAs7W4qDmaAjW02fWXbe4Ao

To claim this, I am signing this object:

package generator
import (
"bytes"
"flag"
"fmt"
"go/format"
"html/template"
"strings"
@ZhangYet
ZhangYet / fetch_ziroom_price.py
Created September 23, 2019 12:26
抓自如房租价格
import requests
from bs4 import BeautifulSoup
css = '''
<style>
i {
background-repeat: no-repeat;
background-size: auto 30px;
display: inline-block;
height: 30px;
@ZhangYet
ZhangYet / demo_st_deparse.R
Created March 1, 2017 19:46
demo_st_deparse.R
require('sourcetools')
get_index <- function(col, width, control) {
if (control == 'forward') {
temp <- col[col<=width]
return(which(col==max(temp)))
} else {
temp <- col[col>=width]
return(which(col==min(temp)))
}
@ZhangYet
ZhangYet / gist:e52380f412d200b48f18a174bbd48672
Created January 9, 2017 12:33
没有经过 ysgge 的请求
POST /2/upyun/upload.json HTTP/1.0
Host: opentest.seriousapps.cn
X-Real-IP: 61.49.105.18
X-Forwarded-For: 61.49.105.18, 61.49.105.18
X-Original-URI: /2/upyun/upload.json
REQUEST_URI: /2/upyun/upload.json
X-Forwarded-Proto: http
Connection: close
Content-Length: 27573
Origin: http://enjoy.ricebook.net
@ZhangYet
ZhangYet / c
Last active December 1, 2016 14:22
用 NULL 判断是否取到 ERU_INFO
if (clcf->server_tokens) {
u_char *other_info = (u_char *)getenv("ERU_INFO");
if (other_info == NULL) {
other_info = (u_char *) "null_eru";
}
u_char eru_tail[48];
// ngx_snprintf 会把 eru_tail 后面的空位也返回来,然后就乱码
ngx_sprintf(eru_tail, "<hr><center>%s</center>\r\n</body>\r\n</html>\r\n", other_info);
len = sizeof(eru_tail) - 1;
tail = eru_tail;
Oct 25 20:16:29 c2-eru-1.ricebook.link eru-core[14117]: panic: runtime error: makeslice: len out of range
Oct 25 20:16:29 c2-eru-1.ricebook.link eru-core[14117]: goroutine 228 [running]:
Oct 25 20:16:29 c2-eru-1.ricebook.link eru-core[14117]: panic(0xaf4700, 0xc42023bb60)
Oct 25 20:16:29 c2-eru-1.ricebook.link eru-core[14117]: /usr/lib/go/src/runtime/panic.go:500 +0x1a1 fp=0xc4203baac0 sp=0xc4203baa30
Oct 25 20:16:29 c2-eru-1.ricebook.link eru-core[14117]: runtime.makeslice(0xa7a7c0, 0xffffffffffffffff, 0xffffffffffffffff, 0x103b000010fa, 0x105b000010fa, 0x103b000010fa)
Oct 25 20:16:29 c2-eru-1.ricebook.link eru-core[14117]: /usr/lib/go/src/runtime/slice.go:49 +0x148 fp=0xc4203bab18 sp=0xc4203baac0
Oct 25 20:16:29 c2-eru-1.ricebook.link eru-core[14117]: gitlab.ricebook.net/platform/core/cluster/calcium.(*calcium).doCreateContainerWithCPUPeriod(0xc4201be540, 0xc42023a9c0, 0xb, 0xffffffffffffffff, 0x3fe0000000000000, 0xc420482380, 0x11, 0xc4203c0840, 0xc4202e48e0, 0x1, ...)
Oct 25 20