Skip to content

Instantly share code, notes, and snippets.

View kemadz's full-sized avatar

Kemad Zhong kemadz

View GitHub Profile
<Configuration ID="e63c6e8b-4a8a-4016-99be-fc66689f7da3">
<Info Description="" />
<Add OfficeClientEdition="64" Channel="PerpetualVL2021">
<Product ID="ProPlus2021Volume" PIDKEY="FXYTK-NJJ8C-GB6DW-3DYQT-6F7TH">
<Language ID="zh-cn" />
<ExcludeApp ID="Access" />
<ExcludeApp ID="Lync" />
<ExcludeApp ID="OneDrive" />
<ExcludeApp ID="Outlook" />
<ExcludeApp ID="Publisher" />
/***********************************************************************
* connect.c -- Make socket connection using SOCKS4/5 and HTTP tunnel.
*
* Copyright (c) 2000-2006 Shun-ichi Goto
* Copyright (c) 2002, J. Grant (English Corrections)
* Copyright (c) 2010, Reini Urban (added realm to http_auth basic)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2

Fix high load average

# search for `interrupt-controller@9880`, comment out the last line of the section, e.g. `phandle = <0x1e>;`
pushd /boot/dtb
dtc -I dtb -O dts -o n1.dts meson-gxl-s905d-phicomm-n1.dtb
mv meson-gxl-s905d-phicomm-n1.dtb meson-gxl-s905d-phicomm-n1.dtb.original
sed -i '/interrupt-controller@9880/,+7s/phandle/#phandle/' n1.dts
dtc -I dts -O dtb -o meson-gxl-s905d-phicomm-n1.dtb n1.dts
@kemadz
kemadz / aes_index.js
Last active June 5, 2019 01:24
aes sample code
var aesjs = require('aes-js')
var key = Buffer.from('abcdef1234fedcba')
var iv = aesjs.utils.utf8.toBytes(key)
var text = '1111222233334444'
var textBytes = aesjs.utils.utf8.toBytes(text)
// pkcs5 is a subset of pkcs7
var padded = aesjs.padding.pkcs7.pad(textBytes)
var aesCbc = new aesjs.ModeOfOperation.cbc(iv, iv)
var encryptedBytes = aesCbc.encrypt(padded);
console.log(Buffer.from(encryptedBytes).toString('base64'))
@kemadz
kemadz / enc_hell.py
Created May 10, 2018 04:05
fix encoding hell
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
orig = '孃䱋崸㔴㔵'
if sys.version_info.major > 2:
print(bytes.fromhex(''.join([hex(ord(c)) for c in orig]).replace('0x', '')).decode())
else:
#!/bin/sh
[ ! -f sdat2img.py ] && echo 'No sdat2img.py' && return 1
[ ! -f system.new.dat ] && echo 'No system.new.dat' && return 1
[ ! -f system.transfer.list ] && echo ' No system.transfer.list' && return 1
python sdat2img.py system.transfer.list system.new.dat system.img
[ ! -f system.img ] && echo 'Convertion failed' && return 1
mkdir output
mount -t ext4 -o loop system.img output
@kemadz
kemadz / tcpecho.go
Created March 8, 2017 12:14
Tcp listen and echo server
package main
import (
"flag"
"log"
"net"
)
func main() {
port := flag.String("port", "80", "port to listen")
@kemadz
kemadz / pyWord.py
Last active August 29, 2015 14:27
Append one doc file to another and save as html
# -*- coding: utf-8 -*-
# https://msdn.microsoft.com/en-us/library/Microsoft.Office.Interop.Word.aspx
from win32com import client as win32
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
word = win32.gencache.EnsureDispatch("Word.Application")
@kemadz
kemadz / gpg_public_key_encrypt.go
Last active February 3, 2020 18:14 — forked from jyap808/public_key_encrypt_gpg_base64.go
Encrypt string with GPG public key into armored
package main
import (
"bytes"
"fmt"
"golang.org/x/crypto/openpgp"
"golang.org/x/crypto/openpgp/armor"
)
@kemadz
kemadz / tdxkl.py
Created July 20, 2015 12:54
解析通达信 K 线文件,Python
# -*- coding: utf-8 -*-
# 数据下载 http://www.tdx.com.cn/download
# 上海 http://www.tdx.com.cn/products/data/data/vipdoc/shlday.zip
# 深圳 http://www.tdx.com.cn/products/data/data/vipdoc/szlday.zip
# 通达信 K 线记录格式
'''
日期, date
开盘, open