Skip to content

Instantly share code, notes, and snippets.

View amontalban's full-sized avatar

Andres Montalban amontalban

View GitHub Profile
@amontalban
amontalban / prevent-host-driver-in-pci-pass.md
Created July 28, 2023 16:31 — forked from kiler129/prevent-host-driver-in-pci-pass.md
Definitely prevent stubborn devices from being bound by the host driver in PCI passthrough scenario

Scenario

You're running a KVM-based virtualization. You want to do PCI/PCIe passthrough of some device. You don't want it to attach to the host OS at all.

Your device looks like that:

00:1f.2 SATA controller [0106]: Intel Corporation 6 Series/C200 Series Chipset Family SATA AHCI Controller [8086:1c02] (rev 05)
	Subsystem: Hewlett-Packard Company 6 Series/C200 Series Chipset Family 6 port Desktop SATA AHCI Controller [103c:330d]
	Kernel driver in use: ahci
	Kernel modules: ahci
@amontalban
amontalban / checkiftablexists
Last active August 11, 2016 21:44 — forked from SpekkoRice/checkiftablexists
BASH: Check if MySQL Table exists
#!/bin/bash
checkIfMySQLTableExists() {
table=$1;
DB=$2;
if [ $(mysql -N -s -u root -p -e \
"select count(*) from information_schema.tables where \
table_schema='${DB}' and table_name='${table}';") -eq 1 ]; then
echo "Table ${table} exists! ...";
else
@amontalban
amontalban / dumper.pl
Last active April 25, 2017 17:22 — forked from erincerys/dumper.pl
MySQLdump filter -- Removes or replaces the DEFINER clauses from a dump
#!/usr/bin/env perl
use strict;
use warnings;
use Getopt::Long qw(:config no_ignore_case );
my $replace = undef;
my $delete = undef;
my $help = 0;
GetOptions (