Skip to content

Instantly share code, notes, and snippets.

@tachang
tachang / libvirt-domain.log
Created June 29, 2020 03:37
libvirt domain log
2020-06-29 03:27:05.129+0000: starting up libvirt version: 6.0.0, package: 0ubuntu8.1 (Christian Ehrhardt <christian.ehrhardt@canonical.com> Wed, 20 May 2020 06:59:57 +0200), qemu version: 4.2.0Debian 1:4.2-3ubuntu6.2, kernel: 5.4.0-39-generic, hostname: tachang-desktop
LC_ALL=C \
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin \
HOME=/var/lib/libvirt/qemu/domain-2-fedora-2 \
XDG_DATA_HOME=/var/lib/libvirt/qemu/domain-2-fedora-2/.local/share \
XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain-2-fedora-2/.cache \
XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain-2-fedora-2/.config \
QEMU_AUDIO_DRV=none \
/usr/bin/qemu-system-x86_64 \
-name guest=fedora-2,debug-threads=on \
@tachang
tachang / Notes.md
Created July 12, 2020 01:21
Flashing a new bootloader on WyzeCam V2

The first 128 bytes of the bootloader before flashing.

# dd if=/dev/mtd0 bs=128 count=1 status=none | hexdump -C -v
00000000  06 05 04 03 02 55 aa 55  aa 39 00 00 5c 30 00 00  |.....U.U.9..\0..|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000030  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000040  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
@tachang
tachang / unpacker.py
Created August 28, 2020 18:29
Extract Firmware Pieces from Dump of Flash for Lenovo C2E Camera
#!/usr/bin/env python
# coding=utf-8
import click
import os
CHECK_FOLDER = os.path.isdir("flash")
if not CHECK_FOLDER:
os.makedirs("flash")
@click.command()
sigparse () {
i=0
# bits="$(printf "16i 2o %X p" "0x$1" | dc)" # variant for busybox
bits="$(printf "ibase=16; obase=2; %X\n" "0x$1" | bc)"
while [ -n "$bits" ] ; do
i="$(expr "$i" + 1)"
case "$bits" in
*1) printf " %s(%s)" "$(kill -l "$i")" "$i" ;;
esac
bits="${bits%?}"