Skip to content

Instantly share code, notes, and snippets.

View vimt's full-sized avatar
💭
Happy

VimT vimt

💭
Happy
View GitHub Profile
@vimt
vimt / m1_mprotect.md
Last active May 29, 2023 03:39
Mac M1 mprotect test (for gomonkey)

do some test about m1 can't use gomonkey (issue: macOS permission denied)

use this code to test

package main

import (
	"fmt"
	"reflect"
	"syscall"
@vimt
vimt / gist:b0a577e664b2e237ede75cb9265f3201
Created January 11, 2018 16:08
python detect GBK and UTF-8
# this util is used to detect file or string bytes encoding
# author: lixk
# email: 1749498702@qq.com
# info: UTF includes ISO8859-1,GB18030 includes GBK,GBK includes GB2312,GB2312 includes ASCII
CODES = ['UTF-8', 'UTF-16', 'GB18030', 'BIG5']
# UTF-8 BOM prefix
UTF_8_BOM = b'\xef\xbb\xbf'