Skip to content

Instantly share code, notes, and snippets.

@XiGou
XiGou / gist:7804222c5bf69d46f976f0cd3ba76a21
Last active July 24, 2023 02:51
compare 2 binary files and print diff ranges
import hashlib
import sys
BLOCK_SIZE = 4096
def get_blocks(file):
while True:
block = file.read(BLOCK_SIZE)
if not block:
break
@XiGou
XiGou / upload_file.py
Created October 12, 2022 07:01
we usually need to upload file automatically by shell script, using scp or rsync, some we don't want to config ssh-pubkey authentication, use this gist can avoid input password manually.
#! /bin/python3
# alternative for scp command
import logging
import paramiko
class SSHClient:
def __init__(self, host, user, psw) -> None:
self.ssh = paramiko.SSHClient()