Skip to content

Instantly share code, notes, and snippets.

View midi1996's full-sized avatar

Midi midi1996

View GitHub Profile
@pgaskin
pgaskin / fedora-37-vfio-bind.sh
Created January 27, 2023 23:59
Simple early-boot VFIO device binding by PCI address on Fedora 37.
# enable AMD IOMMU with DMA passthrough
# note: iommu=pt is much faster than the default translated DMA since memory access doesn't need to go through the hypervisor
sudo sed -i '1 s/$/ amd_iommu=on iommu=pt/' /etc/kernel/cmdline
# list IOMMU groups
# record the PCI IDs of all devices in the target group
for d in /sys/kernel/iommu_groups/*/devices/*; do
n=${d#*/iommu_groups/*};
n=${n%%/*};
test $n -eq $pn || printf '\nIOMMU Group %s\n' $n;
@drygdryg
drygdryg / emulating_usb_flash_in_linux.md
Last active October 30, 2025 19:46
How to emulate USB flash drive in Linux

Emulating mass storage USB flash devices in Linux

Create a new disk image with space pre-allocation (4000 MBytes):

fallocate -l 4000M virtual_usb.img

Create Ext4 file system:

mkfs -t ext4 virtual_usb.img
@midi1996
midi1996 / 50-edk2-ovmf-x86_64-secure.json
Last active August 24, 2023 02:19 — forked from Ashymad/PKGBUILD
Slightly updated ovmf-patched-vbios (as of April 2021, now 19 September 2021)
{
"description": "UEFI firmware for x86_64, with Secure Boot and SMM",
"interface-types": [
"uefi"
],
"mapping": {
"device": "flash",
"executable": {
"filename": "/usr/share/edk2-ovmf/x64/OVMF_CODE.secboot.fd",
"format": "raw"
@Dids
Dids / IPA_Install_Apple_Silicon.md
Last active June 6, 2025 02:14
Installing IPAs on the M1

Installing IPAs on Apple Silicon (M1)

  1. Open Apple Configurator 2 and plug in your iPhone or iPad
  2. Click Add, login to the App Store and select the application you want to install
  3. Open up ~/Library/Group\ Containers/K36BKF7T3D.group.com.apple.configurator/Library/Caches/Assets and wait until the TemporaryItems directory appears
  4. Copy the application from the newly created temporary directory, but do note that it will disappear once Apple Configurator is done installing
  5. Double click the .ipa on your Apple Silicon (M1) device and install it
  6. Fix permissions on the installed application by running sudo xattr -rd com.apple.quarantine /Applications/<your_app>.app (if you skip this step, you're unable to start the application)

Note that it's easier if you already have the application installed, as Apple Configurator will prompt you about overwriting the existing installation, at which point the temporary file (the .ipa) will still exist, until you choose an action in the prompt.

@kiler129
kiler129 / prevent-host-driver-in-pci-pass.md
Last active October 20, 2025 16:55
Definitely prevent stubborn devices from being bound by the host driver in PCI passthrough scenario

Deprecated

The method described in this gist has been deprecated/superceeded by kiler129/early-vfio-pci-isolate tool.
It is more robust, configurable, and doesn't hack around scripts that are sometimes overwritten by system updates. The tool uses similar methods to the ones described below, but extends the capabilities by e.g. easy NVMe passthrough by S/N.

The description below has been preserved for historical context. At the time of writing, the tool above has been tested for ~6 months across multiple systems.




@paulo-amaral
paulo-amaral / finalize_recording.sh
Last active March 28, 2024 05:59
Update the recording file name in Jibri - Part of JITSI MEET
#!/bin/bash
#Script to save records by date to better organize your recordings
#Use on :
#mounted NFS SHARE VIA FSTAB or local folder.
#The folder to save records is configured on Jibri json file (config.json.
#Dependencies : mailutils
RECORDINGS_DIR=$1
# Find latest modified directory
@ld100
ld100 / ArchLinuxWSL2.md
Last active November 27, 2025 13:33
Steps for setting up Arch Linux on WSL2

Migrating from Ubuntu on WSL to ArchLinux on WSL2

Obsolete notice

This document was created back in 2020 and might not be actual nowadays. It is not supported anymore, so use thise information at your own risk.

Upgrading to WSL 2

  • Download WSL2 Kernel
  • run wsl --set-default-version 2 in windows command line, so that all future WSL machine will use WSL2.
@ajmassi
ajmassi / LXCBindMount.md
Last active October 12, 2025 17:57
Create a bind mount from a Proxmox host on an unprivileged lxc container

Proxmox Assign Bind Mount To Unprivileged Container

In order for the LXC container to have full access the proxmox host directory, a subgid is set as owner of a host directory, and an ACL is used to ensure permissions.

Bind Mount dataset to LXC

Add the following line to /etc/pve/lxc/<CT_ID>.conf

mp0:/mount/point/on/host,mp=/mount/point/on/lxc

Create group on host

In the default Proxmox configuration, unpriviliged container subgids will have the prefix "10" followed by the expected 4-digit gid.

@travelhawk
travelhawk / ffmpeg_commands.md
Last active November 19, 2025 20:20
Collection of ffmpeg commands (basic usage, streaming, advanced usage)

ffmpeg

ffmpeg is a fast video and audio converter that can also grab from a live audio/video source.

Standard usage

Getting help and information

  • -h show all options
  • -h(elp) topic show help
  • -version show version
  • -formats show available formats
@lac5
lac5 / youtube-anti-anti-afk.meta.js
Last active June 17, 2024 15:04
Stops YouTube from automatically pausing the video.
// ==UserScript==
// @name YouTube - Anti-Anti-AFK
// @namespace larryc5
// @version 1.0
// @description Stops YouTube from automatically pausing the video.
// @author Larry Costigan
// @include /^https?:\/\/(?:[^\/?#]*\.)?youtube.com\/.*$/
// @downloadURL https://gist.githubusercontent.com/larryc5/95c3ae2abbd37b35e2a35ac2c49d9996/raw/youtube-anti-anti-afk.user.js
// @updateURL https://gist.githubusercontent.com/larryc5/95c3ae2abbd37b35e2a35ac2c49d9996/raw/youtube-anti-anti-afk.meta.js
// ==/UserScript==