执行命令:protoc --go_out=. param.proto 时,生成go文件报错,完整报错信息如下:
protoc-gen-go: program not found or is not executable
Please specify a program using absolute path or make sure the ...
#!/usr/bin/ruby
require 'openssl'
class AesEcb256
def encrypt(key, data, padding)
aes = OpenSSL::Cipher.new("AES-256-ECB")
aes.encrypt
aes.key = key
aes.padding = paddi...
logrus 仓库地址:https://github.com/sirupsen/logrus
实现代码:
func init() {
// 配置日志格式
logrus.SetReportCaller(true)
logrus.SetFormatter(&MyFormatter{})
logrus.SetL...
function format(date, format = "yyyy-MM-dd hh:mm:ss") {
//new Date 在 ios safari浏览器有兼容性问题处理如下:
// ? 兼容safari : 兼容其他浏览器
let $this = new Date(date) == 'Invalid D...
table, td{
border: 1px solid #000000;
border-collapse: collapse;
line-height:40px;
}
魔法方法
含义
基本的魔法方法
__new__(cls[, ...])
1. __new__ ...
#!/usr/bin/python3
import os
import paramiko
class DownFile(object):
ssh = paramiko.SSHClient()
def __exit__(self, exc_type, exc_val, exc_tb):
self.ssh.close()
...
安装依赖:
go get github.com/oschwald/geoip2-golang
数据库文件下载地址(需注册用户):
https://www.maxmind.com/en/accounts/current/geoip/downloads
示例代码:
type Result struct {
...
基于:github.com/gorilla/websocket 实现
func main() {
interrupt := make(chan os.Signal, 1)
signal.Notify(interrupt, os.Interrupt)
ws := "ws://127.0.0.1:8080/ws"
c, _, err := ...
etcdctl基本使用
增加一条数据
etcdctl put "/school/class/name" "helios"
获取一条数据
etcdctl get "/school/class/name"
得到一组数据
etcdctl get "/school/class/" --prefix
得到所有的ke...
限量核心代码:limit.go
type Limit struct {
Name string
Key string
Rate int64
Max int64
Default int64
}
func (l *Limit) Add(a, b float64) float64 {
r...
获取请求报文
请求报文格式说明
HTTP请求报文由请求行、请求头、空行、请求体四个部分组成,如下图:
请求行
请求行由方法字段和HTTP协议版本字段3个部分组成,他们呢之间使用空格隔开。...
完整报错信息:
logstash.outputs.elasticsearch] retrying failed action with response code: 403 ({"type"=>"cluster_block_exception", "reason"=>"blocked by: [FORBIDDEN/12/index read-only / allo...
js文件调用方式:
<script src="./xx.js?a=b"></script>
获取参数的方法:
function getQueryVariable(variable)
{
var src = document.currentScript.src;
var getParam = src.su...
网络分层架构
典型协议
传输层:常见协议有TCP/UDP协议
应用层:常见的协议有HTTP协议,FTP协议
网络层:常见协议有IP协议,ICMP协议,IGMP协议
网络接口层:常见协议有ARP协议,RARP协议
TCP传...