Skip to content

Instantly share code, notes, and snippets.

@flisboac
flisboac / _README.md
Last active October 1, 2023 00:10
Proxmox-VE 7.x: Enable PCI passthrough for I226-V Ethernet network devices, with non-passthrough exceptions for specific ports (tested with CWWK's CW-MBX-AD12 2.5Gbps 6-port mini-PC).

Some notes:

  • Disable Above 4G in BIOS, otherwise vfio-pci (on the host) will panic all the time when turning off the Opnsense VM, and the only way to get off the problem is to hard-reset the host entirely.
  • On Opnsense Guest, go to the Web GUI, option System -> Settings -> Tunables, click "Add", and add the virtio_console_load=YES config Make sure QEMU Guest Agent is disabled.
@flisboac
flisboac / tps6104x-calculate-components.py
Last active September 22, 2023 13:05
Calculates component values for a TPS6104x buck-boost regulator setup, given a target input value.
from bisect import bisect_left
import math
r_mult_values_smd = [
0.1, 1, 10, 100, 1000, 10000, 100000
]
r_base_values_smd =[
10, 11, 12, 13, 15, 16, 18, 20,
22, 24, 27, 30, 33, 36, 39, 43,
47, 51, 56, 62, 68, 75, 82, 91,
@flisboac
flisboac / jq-jsonobject-set.sh
Last active April 20, 2023 03:02
Various slow-ish portable Shell utilities for JSON values (all depending on `jq`)
#!/bin/sh
##
# Sets properties in a JSON object.
#
# Properties are given in the format `KEY[:TYPE]=VALUE`, as a var-arg argument to the function.
# `TYPE` is optional; if not provided, the value will be simply serialized to string, regardless
# of its format. But if a type is informed, some conversion and validation occurs prior to
# assignment. Type names are case insensitive. Accepted types:
#
@flisboac
flisboac / fix-intel_wifi_aer-avell_g1513_fire_v3
Last active February 12, 2023 15:58
Temporary fix for AER's excessive `severity=Corrected` logging for Intel Wireless (Avell G1513 Fire V3) (Arch Linux)
silly gist hack, why do we need you? :(
@flisboac
flisboac / join-string.state-function.json
Last active January 3, 2023 13:59
simple state function to perform join with json serialization
{
"StartAt": "CreateCliParams",
"States": {
"CreateCliParams": {
"Type": "Pass",
"Next": "CreateCliParams_ifJoinParams",
"Parameters": {
"CliParameterSeparator.$": "$.CliParameterSeparator",
"CliCurrentParameterSeparator": "",
"CliParameters.$": "$.CliParameters[*][*]",
@flisboac
flisboac / download.js
Created August 21, 2013 22:37
Download file using JScript. Not tested (yet), because of work's proxy policies and Stupid Windows!
var fs = new ActiveXObject("Scripting.FileSystemObject");
var shell = new ActiveXObject("WScript.Shell");
var url = WScript.Arguments(0);
var to;
try {
to = WScript.Arguments(1);
} catch(err) {
to = null;
@flisboac
flisboac / certificate_utils.py
Last active September 3, 2022 05:57
Utility Python library and CLI capable of downloading a whole certificate chain; barely tested
# Requires at least Python 3.7, and typing_extensions
from __future__ import annotations
import collections.abc
import datetime
import functools
import os
import pathlib
import re
import shutil
@flisboac
flisboac / test_hipsycl.cpp
Last active August 25, 2022 07:08
An attempt on building a SYCL example program. Build and execute with `build.sh`.
@flisboac
flisboac / backoff.dart
Last active August 12, 2022 13:47
backoff.dart
//
// https://gist.github.com/flisboac/6af02b5254088558362757593dc54f9c
import {
Abstract,
DynamicModule,
INestApplicationContext,
Type,
} from '@nestjs/common';
import { ContextId } from '@nestjs/core';
import {