Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@tachang
tachang / Intel520PassthroughIssues.md
Last active July 13, 2023 12:24
Intel 520 Integrated Graphics Card Passthrough Issues on Proxmox

I am having issues getting my Intel 520 integrated graphics card passing through on qemu. I am using Proxmox Virtual Environment 6.2-4.

I am getting some type of fault code when starting up a virtual machine:

qemu-system-x86_64 -machine q35 -m 2G -accel kvm -cpu host \
-device vfio-pci,host=00:02.0 -nographic -vga none \
-cdrom /var/lib/vz/template/iso/Win10_2004_English_x64.iso
@tachang
tachang / network-restart.sh
Created April 10, 2015 19:37
Cleanly restart the default libvirt network
#!/bin/bash
#
# Yury V. Zaytsev <yury@shurup.com> (C) 2011
#
# This work is herewith placed in public domain.
#
# Use this script to cleanly restart the default libvirt network after its
# definition have been changed (e.g. added new static MAC+IP mappings) in order
# for the changes to take effect. Restarting the network alone, however, causes
# the guests to lose connectivity with the host until their network interfaces
@tachang
tachang / gist:2117833a395504bae0bde9979f4e201e
Created March 10, 2017 20:34
How to install NodeJS without root
wget https://nodejs.org/dist/v6.10.0/node-v6.10.0-linux-x64.tar.xz
tar xvfJ node-v6.10.0-linux-x64.tar.xz
echo 'export PATH=$HOME/node-v6.10.0-linux-x64/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
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%?}"
@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()
@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 / 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 / smtpforwarder.py
Created August 31, 2018 08:42
SMTP Forwarding Script
import smtpd
import asyncore
class CustomSMTPServer(smtpd.SMTPServer, object):
def process_message(self, peer, mailfrom, rcpttos, data):
print 'Receiving message from:', peer
print 'Message addressed from:', mailfrom
print 'Message addressed to :', rcpttos
print 'Message length :', len(data)
@tachang
tachang / CameraToMpegTest.java
Created June 17, 2014 17:43
CameraToMpegTest.java
/*
* Copyright 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software