Skip to content

Instantly share code, notes, and snippets.

View JucaRei's full-sized avatar
:electron:
Focusing

JucaRei

:electron:
Focusing
View GitHub Profile
@AnnoyingTechnology
AnnoyingTechnology / custom_debian_lxc_image_proxmox_arm64.md
Last active April 4, 2025 19:30
Build your own arm64 Debian LXC image. (avoid unable to open file '/etc/network/interfaces.tmp.0000000' - No such file or directory)

On another Debian (x86 or arm64, doesn't matter much).

apt install distrobuilder qemu-system-common

Create a configuration file (debian.yml for example) for your LXC image :

image:
  description: |-
    Nearly stock Debian Bookworm image
@fbraz3
fbraz3 / openwrt_add_guest.sh
Last active July 4, 2025 19:05
[OpenWRT] Shell Script to Create a Fully Isolated Guest Network with Bandwidth Control
#!/bin/sh
#
# FOR USE IN OPENWRT
# This script creates a guest network fully isolated from the main one.
# Tested on a Xiaomi AX3000T router; should work on any OpenWRT-powered router.
#
# - Ensure the Wi-Fi interfaces retain their default names (radio0 and radio1).
# - For enable download/upload limits, install the sqm-scripts package on your OpenWRT router.
#
@suuhm
suuhm / setup_openwrt_lxc_container_proxmox.sh
Last active May 12, 2025 18:56
Setup OpenWrt 23.05 LXC Container in Proxmox - Updated Version: 2024
#!/bin/bash
# Setting Up OpenWRT on a Virtual Machine with Proxmox
# Based on: https://community.bigbeartechworld.com/t/setting-up-openwrt-on-a-virtual-machine-with-proxmox/257
# Set your wished version:
export VER="23.05"
export ARCH="amd64"
export INDEX_URL="https://images.linuxcontainers.org/images/openwrt/$VER/$ARCH/default"
#export BUILDDATE=$(date -d "yesterday" '+%Y%m%d')
@v-fox
v-fox / NVMe_tweaks.md
Last active July 3, 2025 01:19
Linux kernel optimizations for NVMe

By default Linux distros are unoptimized in terms of I/O latency. So, here are some tips to improve that.

Most apps still don't do multi-threaded I/O access, so it's a thread-per-app which makes per-app speed always bottlenecked by single-core CPU performance (that's not even accounting for stuttering on contention between multiple processes), so even with NVMe capable of 3-6 GB/s of linear read you may get only 1-2 GB/s with ideal settings and 50-150/100-400 MB/s of un/buffered random read (what apps actually use in real life) is the best you can hope for.

All writes are heavily buffered on 3 layers (OS' RAM cache, device's RAM cache, device's SLC-like on-NAND cache), so it's difficult to get real or stable numbers but writes are largelly irrelevant for system's responsiveness, so they may be sacrificed for better random reads.

The performance can be checked by:

  • `fio --name=read --readonly --rw={read/randread} --ioengine=libaio --iodepth={jobs_per_each_worker's_command} --bs={4k/2M} --direct={0/1} --num
@fricklerhandwerk
fricklerhandwerk / README.md
Last active January 30, 2024 21:08
Home Manager without `home-manager`

Here's how to use Home Manager without home-manager. @proofconstruction is my witness.

Getting the right version of Home Manager

First of all we have to make sure that the version of Home Manager matches the Nixpkgs release we want to use for our user environment configuration. Otherwise we will almost certainly get into trouble with mismatching interfaces.

We start out with a function that takes Nixpkgs as pkgs and fetch the appropriate Home Manager release. We get the given Nixpkgs version string from pkgs.lib.version and split it into the . format with lib.versions.majorMinor.

@Pablo1107
Pablo1107 / README.md
Created June 3, 2023 20:24
Setup gvfs to work with Nautilus in Non-NixOS using Home Manager

Installing Nautilus directly from Nixpkgs in Non-NixOS systems have no support for mounting sftps and other features that needs gvfs.

The solution for this is to install gnome3.gvfs in your packages list and then setup the env variable like this:

home.packages = with pkgs; [
  gnome3.gvfs
  gnome3.nautilus
];

Setting up qemu VM using nix flakes

Did you know that it is rather easy to setup a VM to test your NixOs configuration?

Create simple flake:

# flake.nix
{
  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
@alekseysidorov
alekseysidorov / shell.nix
Last active May 27, 2023 04:26
Docker images builder powered by the nixpkgs-cross-overlay
{ localSystem ? builtins.currentSystem
, crossSystem ? { config = "x86_64-unknown-linux-musl"; isStatic = true; useLLVM = true; }
}:
let
# Fetch the nixpkgs-cross-overlay sources.
src = builtins.fetchTarball "https://github.com/alekseysidorov/nixpkgs-cross-overlay/tarball/main";
# Use the nixpkgs revision provided by the overlay.
# This is the best way, as they are the most proven and compatible.
nixpkgs = "${src}/utils/nixpkgs.nix";
# Make cross system packages.
@joshenders
joshenders / openwrt_lxd_multiwan.md
Last active June 4, 2025 15:07
OpenWrt 23.05.x Setup Under LXD 5.x on Debian 12 with PCI Passthrough

OpenWrt 23.05.x Setup Under LXD 5.x on Debian 12 with PCI Passthrough

In case you missed it, Canonical relicensed LXD under AGPLv3 in December 2023 with a mandatory CLA. The LXD project was hard forked as Incus and licensed under an Apache 2.0 License.

Incus is maintained by the same team of developers that first created LXD and is recommended for new users going forward.

If you continue with this guide using Incus, substitute incus for lxc in each command.

Install lxd via snap and configure

💡 If using Debian 12 (Bookworm) or newer, you can just apt install lxd but keep in mind this pacakge is EOL and new users are encouraged to move to Incus.

@subrezon
subrezon / openwrt-on-proxmox.md
Last active July 3, 2025 01:13
How to set up an OpenWRT VM in Proxmox
  1. Go to OpenWRT release page, select the latest release stable release, then targets -> x86 -> 64. Right-click generic-ext4-combined.img.gz (not the "efi"!) and copy the link.

  2. On the Proxmox host, download the archive and unpack it:

wget *paste link here*
gunzip openwrt-*.img.gz
  1. Resize the image to be the size you want your VM's disk to be (example with 8 GiB):