Skip to content

Instantly share code, notes, and snippets.

View tokers's full-sized avatar
🎯
Focusing

Alex Zhang tokers

🎯
Focusing
View GitHub Profile
" Copyright (C) Alex Zhang (tokers)
"
" This is my own VIM/NVIM configuration file.
"
set nocompatible
set noshowmode
filetype plugin indent on
@tokers
tokers / configmap.go
Created December 22, 2020 07:10
Iterate Lua source codes in envoy-apisix and generate a ConfigMap
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strconv"
"strings"
@tokers
tokers / etcd-bench
Last active June 1, 2020 09:14
etcd benchmark
4c4g
1 node etcd cluster
$ uname -a
Linux gentoo 4.19.37-gentoo #7 SMP Mon Sep 9 11:14:51 CST 2019 x86_64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz GenuineIntel GNU/Linux
# requests sent by etcd client.
$ ./benchmark/benchmark put
10000 / 10000 Boooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo! 100.00% 4s
@tokers
tokers / c
Created June 30, 2019 06:42
epollrdhup
#include <stdio.h>
#include <sys/epoll.h>
#include <sys/socket.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/types.h> /* See NOTES */
#include <netinet/in.h>
This file has been truncated, but you can view the full file.
== Info: Trying 127.0.0.1...
== Info: TCP_NODELAY set
== Info: Connected to 127.0.0.1 (127.0.0.1) port 9080 (#0)
=> Send header, 186 bytes (0xba)
0000: 47 45 54 20 68 74 74 70 3a 2f 2f 70 78 68 34 35 GET http://pxh45
0010: 36 2e 62 30 2e 75 70 61 69 79 75 6e 2e 63 6f 6d 6.b0.upaiyun.com
0020: 2f 75 70 6c 6f 61 64 69 6d 67 2f 32 30 31 38 30 /uploadimg/20180
0030: 34 32 33 2f 31 35 32 34 34 32 35 35 31 31 38 65 423/15244255118e
0040: 38 62 30 32 39 64 62 33 2e 6a 70 67 20 48 54 54 8b029db3.jpg HTT
0050: 50 2f 31 2e 31 0d 0a 48 6f 73 74 3a 20 70 78 68 P/1.1..Host: pxh
@tokers
tokers / cdecl.c
Created April 30, 2018 05:58
Translate the C Declaration into Engilish
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#define MAXTOKENS 100
#define MAXTOKENLEN 64
enum type_tag { IDENTIFIER, QUALIFIER, TYPE };
@tokers
tokers / cdecl.c
Created April 30, 2018 05:58
Translate the C Declaration into Engilish
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#define MAXTOKENS 100
#define MAXTOKENLEN 64
enum type_tag { IDENTIFIER, QUALIFIER, TYPE };
" Copyright (C) Alex Zhang
" for nvim
set runtimepath^=~/.vim runtimepath+=~/.vim/after
"================================================Basic Settings================================================================="
set number
set relativenumber
@tokers
tokers / slice.json
Last active September 15, 2017 03:42
"slice": {
"enable": true,
"url_patterns": [
"/*.avi",
"/*.mp4",
"/*.flv",
"/*.mov",
"/*.3gp",
"/*.asf",
"/*.wmv",
server {
listen 10086;
server_name upmov.a.yximgs.com;
location / {
proxy_pass http://origin;
proxy_set_header Host upmov.a.yximgs.com;
proxy_set_header Accept-Encoding gzip;
proxy_next_upstream error timeout;