Skip to content

Instantly share code, notes, and snippets.

@lishulongVI
lishulongVI / feishu,webhook
Last active April 27, 2021 02:49
elastic_alert-feishu-webhook
# 配置文件
# 脚本设置
@lishulongVI
lishulongVI / redash v9 deploy
Created March 8, 2021 09:19
redash v9 deploy
vim /opt/redash/env
```
PYTHONUNBUFFERED=0
REDASH_LOG_LEVEL=INFO
REDASH_REDIS_URL=redis://redis:6379/0
POSTGRES_PASSWORD=password
REDASH_COOKIE_SECRET=cookie_secret
REDASH_SECRET_KEY=secret_key
REDASH_DATABASE_URL=postgresql://postgres:password@postgres/postgres
@lishulongVI
lishulongVI / go
Last active December 31, 2020 09:08
go-快速入门
package main
import (
"errors"
"example/c"
"fmt"
"reflect"
"rsc.io/quote"
)
@lishulongVI
lishulongVI / ha
Created December 30, 2020 11:09
ha
https://pingcap.com/blog-cn/best-practice-haproxy/
@lishulongVI
lishulongVI / 同一局域网下,内网无法访问外网的处理办法
Created December 29, 2020 08:16
同一局域网下,内网无法访问外网的处理办法
内网网段:192.168.1.*
外网可访问的机器 ip:192.168.1.44
iptables -F
iptables -t nat -A POSTROUTING -s 192.168.1.0/255.255.255.0 -j SNAT --to 192.168.1.44
echo 'net.ipv4.ip_forward = 1' >> /etc/sysctl.conf
@lishulongVI
lishulongVI / nginx_json
Last active December 26, 2020 09:11
nginx log to json
user www-data;
worker_processes 2;
worker_rlimit_nofile 65535;
pid /run/nginx.pid;
events {
worker_connections 65535;
}
@lishulongVI
lishulongVI / jsonschema test
Created December 18, 2020 06:40
jsonschema test
# {"name": "Eggs", 'price': 1223, 'us': ['12334']}
schema = {
"type": "object",
"properties": {
"price": {"type": "number"},
"name": {"type": "string"},
"us": {
"type": "array",
"items": {
"type": "string", "maxLength": 5
@lishulongVI
lishulongVI / gzip request post
Created December 8, 2020 10:04
gzip request post
import gzip
import io
from requests.adapters import HTTPAdapter
import requests
class GzipAdapter(HTTPAdapter):
"""Adapter used with `requests` library for sending compressed data."""
@lishulongVI
lishulongVI / similarity
Last active November 27, 2020 06:20
similarity
import difflib
from string import digits
from typing import Tuple, Any
class Similarity:
remove_digits = str.maketrans('', '', digits)
@classmethod
def remove_digit(cls, s) -> str:
@lishulongVI
lishulongVI / presto,pyhive,kerberos auth
Created November 11, 2020 03:42
presto,pyhive,kerberos auth
import os
from functools import wraps
import kerberos
from pyhive import presto
presto_cli = presto.connect(**RUN_ENV.PRESTO_MRS_CONF)