Skip to content

Instantly share code, notes, and snippets.

View kiler129's full-sized avatar

Gregory House kiler129

  • noFlash
  • Chicago, IL (USA)
View GitHub Profile
@kiler129
kiler129 / prevent-host-driver-in-pci-pass.md
Last active April 13, 2024 02:02
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
#!/bin/bash
set -e -o errexit -o pipefail -o nounset
###################################
# This script can be used by itself, but it's recommended that you read
# a tutorial on Proxmox forum first: https://forum.proxmox.com/threads/hey-proxmox-community-lets-talk-about-resources-isolation.124256/
###################################
# Do not modify these variables (set by Proxmox when calling the script)
vmId="$1"
@kiler129
kiler129 / generate_smbios.sh
Created April 12, 2023 07:38
Script to generate real SMBIOS for QEMU
#!/bin/bash
# See https://www.qemu.org/docs/master/system/invocation.html?highlight=smbios#hxtool-4
declare -A smb0
declare -A smb1
declare -A smb2
declare -A smb3
declare -A smb4
declare -A smb11
declare -A smb17
@kiler129
kiler129 / README.md
Last active March 4, 2024 01:49 — forked from seeker2921/ilo-console.sh
Run iLO remote console from shell

iLO Remote Console

This small script lets you start iLO Java-based console from shell.

But why not HTML5?

  • iLO 2/3 doesn't have HTML5 console
  • Mounting local (from the client computer) ISOs is PAINFULLY slow via HTML5 client

TL;DR

If you just start it, it will ask you for everything:

@kiler129
kiler129 / twilio_sms_to_telegram.js
Created February 28, 2024 03:57
CloudFlare worker to redirect SMS to Telegram
// Receives Twilio SMS WebHook and sends message via Telegram
//
//Define the following as variables on CF:
// - ACCESS_USER (encrypt): long unpredictible string, shared with Twilio
// - ACCESS_PASS (encrypt): long unpredictible string, shared with Twilio
// - TELEGRAM_CHAT_ID: chat id for Telegram conversation
// - TELEGRAM_API_TOKEN (encrypt): API token for Telegram intragration
//
// Configure Twilio with SMS WebHook to call https://<ACCESS_USER>:<ACCESS_PASS>@<worker name>.<cf login>.workers.dev/notify
// e.g. https://foo:bar@twilio-telegram-fwd.superuser123.workers.dev/notify
@kiler129
kiler129 / iommu.sh
Last active December 20, 2023 02:34 — forked from Roliga/iommu.sh
#!/bin/bash
### Improved IOMMU/PCIe list script
# The script was originally authored by Roliga (https://gist.github.com/Roliga/d81418b0a55ca7682227d57af277881b)
# This version changes:
# 1) enable listing of devices even if IOMMU is disabled
# 2) add support for NVMe & SAS block devices
# 3) display disks serial & firmware (if available)
# 4) QOL improvements: disabled paging by default; don't crash on missing lsusb
@kiler129
kiler129 / cloudflare_update.script
Last active October 11, 2023 09:10
Automatic script for Mikrotik RouterOS updating record on CloudFlare.
#########################################################################
# ================================================== #
# $ Mikrotik RouterOS update script for CloudFlare $ #
# ================================================== #
# #
# - You need a CloudFlare account & api key (look under settings), #
# a zone and A record in it #
# - All variables in first section are obvious, except CFid, #
# To obtain CFid use following command in any unix shell: #
# curl https://www.cloudflare.com/api_json.html -d 'a=rec_load_all' -d 'tkn=YOUR_API_KEY' -d 'email=email@example.com' -d 'z=domain.com'|python -mjson.tool
@kiler129
kiler129 / replace-cert.sh
Last active August 10, 2023 09:25
Replace certificate for an isolated service running on TrueNAS SCALE and restart the service if needed
#!/bin/bash
#set -e
set -o errexit -o pipefail -o noclobber -o nounset
if [ "$#" -ne 4 ]; then
echo "Usage: ${0} CertTargetDir CertName OutputFormat<pem|p12> AssociatedService"
exit 1
fi
certTargetDir="${1}"
@kiler129
kiler129 / scrypted-webhook-disable-enable-homekit.ts
Created June 12, 2023 04:36
Scrypted WebHook to disable/enable HomeKit via webhook
class DisableEnableHomeKitWebHook implements HttpRequestHandler {
readonly devType = 'Camera';
readonly roomName = 'Inside';
// readonly roomName = 'Outside';
readonly sharedSecret = 'kfjshflhwfiwheifhawleichiewchewiucahewihc';
async onRequest(request: HttpRequest, response: HttpResponse) {
const query = this.getQueryParams(request);
if (!this.verifySecret(query)) {
response.send("Invalid secret");
@kiler129
kiler129 / cf-worker-twilio-to-telegram.js
Last active January 25, 2023 06:29
CloudFlare worker code forwards text messages from Twilio to your Telegram chat
/**
* This CloudFlare worker code forwards text messages from Twilio to your Telegram chat.
*
* You need to define the following variables in CloudFlare:
* ACCESS_USER - any user
* ACCESS_PASS - any password
* TELEGRAM_API_TOKEN - get from @BotFather
* TELEGRAM_CHAT_ID - get from https://api.telegram.org/bot<TELEGRAM_API_TOKEN>/getUpdates after messaging the bot
*
* Then set the following URL in Twilio as a POST WebHook: