Skip to content

Instantly share code, notes, and snippets.

@b1tg
b1tg / netbios.rs
Created September 13, 2022 15:22
NETBIOS 主机名编码算法 (rust)
// https://cloud.tencent.com/developer/article/1116151
// https://stackoverflow.com/questions/13652319/decode-netbios-name-python
// When correctly reversed, Netbios_Name should output in ASCII : "TESDTDDSSS"
const NetbiosName: &str = "\x46\x45\x45\x46\x46\x44\x45\x45\x46\x45\x45\x45\x45\x45\x46\x44\x46\x44\x46\x44\x43\x41\x43\x41\x43\x41\x43\x41\x43\x41\x43\x41";
fn netbios_encode(input: &str) -> Vec<u8> {
let mut res: Vec<u8> = vec![];
for c in input.bytes() {
res.push(c/0x10+0x41);
res.push(c%0x10+0x41);
@b1tg
b1tg / NTFS-Linux.md
Created August 15, 2021 07:42
mount NTFS disk on linux

Arch linux

sudo pacman -S ntfs-3g
lsblk
sudo mount /dev/sdx1 /mnt

Debian linux

@b1tg
b1tg / build_7z.sh
Last active August 3, 2021 14:42
build 7z on centos to extract dmg file
wget -L https://github.com/jinfeihan57/p7zip/archive/refs/tags/v17.04.zip
#7z x v17.04.zip
unrar -x v17.04.zip
cd p7zip-17.04/
make 7z
./bin/7z
@b1tg
b1tg / x265-not-found.md
Last active August 31, 2020 00:56
ERROR: x265 not found using pkg-config on Ubuntu 20.04

rebuild the x265 source not work for me.

my solution:

0x00. find "x265.pc"

sudo find / -name "x265.pc" 
01000011x10001000x000100000100x010000010010
ShellScript
https://www.shellscript.sh/
Acl
http://www.gsp.com/cgi-bin/mdroid.cgi?topic=extattrctl
http://www.onlamp.com/pub/a/bsd/2003/08/14/freebsd_acls.html
https://linux.die.net/man/1/setfacl
https://www.bing.com/search?q=ACLs+with+Samba+andWindows&src=IE-TopResult&FORM=IETR02&conversationid=
https://en.wikipedia.org/wiki/Chmod
let log = function(varStr) {
if (typeof varStr !== "string"){
console.log(`[*] unknow ${varStr}`)
} else {
console.log(`[*]${varStr}: ${eval(varStr)}`)
}
}
@b1tg
b1tg / p.sh
Created November 25, 2018 03:19
curl POST json
# method 0
vim body.json # write json
curl -H "Content-Type: application/json" --data @body.json http://localhost:8080/ui/webapp/conf
# method 1
curl --header "Content-Type: application/json" \
--request POST \
--data '{"username":"xyz","password":"xyz"}' \
http://localhost:3000/api/login
@b1tg
b1tg / connect.sh
Last active June 11, 2018 02:12
[树莓派指定端口连接]
ssh-copy-id -p 53 pi@172.20.62.63 # 复制密钥,无密码登录
scp -P 53 ~/Downloads/ngrok-stable-linux-arm.zip pi@172.20.62.63:/home/pi # scp -P 指定端口
ssh -p 53 pi@172.20.62.63 # ssh -p 指定端口
import xmlrpclib
import random
import schedule
address="127.0.0.1"
proxy = xmlrpclib.ServerProxy("http://"+ address +":8000/", allow_none = True)
multicall = xmlrpclib.MultiCall(proxy)
def tt():
value={
@b1tg
b1tg / schedule_demo.py
Created June 10, 2018 16:08
[定时调用] schedule库
import schedule
import time
def job():
print("I'm working...")
schedule.every(10).minutes.do(job)
schedule.every().hour.do(job)
schedule.every().day.at("10:30").do(job)
schedule.every().monday.do(job)