Skip to content

Instantly share code, notes, and snippets.

@jedy
jedy / mail.go
Last active March 15, 2017 01:59
sendmail with tls
package main
import (
"crypto/tls"
"errors"
"log"
"net"
"net/smtp"
)
@jedy
jedy / main.go
Created July 10, 2017 00:56
自动获得let's encrypt的证书
package main
// https://blog.kowalczyk.info/article/Jl3G/https-for-free-in-go.html
// To run:
// go run main.go
// Command-line options:
// -production : enables HTTPS on port 443
// -redirect-to-https : redirect HTTP to HTTTPS
import (
  • 读写混合性能相比5.7有很大提升

  • 高竞争场景的性能有很大提升

  • 不支持query cache了

  • 只有innodb支持分区(PARTITION)

  • expire_logs_days废弃了,使用binlog_expire_logs_seconds

@jedy
jedy / unzip.py
Created April 7, 2020 04:01
decompress ZIP file with encoding
import zipfile
import pathlib
import chardet
def unzip(file, path):
z = zipfile.ZipFile(file)
detector = chardet.UniversalDetector()
for i in z.infolist():
if i.flag_bits & 0x800 == 0:
detector.feed(i.filename.encode("cp437"))
@jedy
jedy / read_mylogin.py
Created June 5, 2020 02:19
read mylogin.cnf
import struct
from Crypto.Cipher import AES
LOGIN_KEY_LEN = 20
MY_LOGIN_HEADER_LEN = 24
MAX_CIPHER_STORE_LEN = 4
f = open(".mylogin.cnf", "rb")
f.seek(4)
b = f.read(LOGIN_KEY_LEN)