Skip to content

Instantly share code, notes, and snippets.

@p7cq
p7cq / kvm-add-disk.json
Created December 22, 2015 16:29
SmartOS - Add a disk to an existing VM
{
"add_disks": [
{
"media": "disk",
"model": "virtio",
"nocreate": true,
"boot": false,
"path": "/dev/zvol/rdsk/tank0/s1node1",
"size": 20480
}
@p7cq
p7cq / kvm-linux.json
Created December 22, 2015 16:48
Smart OS - Create a KVM-based VM
{
"brand": "kvm",
"vcpus": 2,
"alias": "s1node1.paulluaq.lan",
"hostname": "s1node1.paulluaq.lan",
"autoboot": false,
"ram": 4096,
"resolvers": ["192.168.1.102", "192.168.1.102"],
"disks": [
{
@p7cq
p7cq / Fedora_Root_On_ZFS.md
Last active August 2, 2023 05:04
Fedora with Root on ZFS - installation notes
@p7cq
p7cq / Install_Arch_Linux_Dell_XPS_9570.md
Last active April 26, 2020 19:13
Install Arch Linux on Dell XPS 9570

Install Arch Linux on Dell XPS 9570

This is my first attempt to install Arch Linux - either on bare metal or in a virtual environment. I spent a couple of hours trying to boot the image and get to the system for the actual installation. - Pressing enter on the boot entry Arch Linux archiso x86_64 UEFI CD always resulted in a black screen. After trying several boot parameters I decided to rewrite the USB key. After that I was able to boot, with no startup parameters needed.

Run all commands as the root user.

  • As the default Linux console font is very small on HiDPI displays I will use the largest font present in kbd package:
setfont latarcyrheb-sun32
@p7cq
p7cq / dwm-logout.md
Last active April 26, 2020 19:30
A logout script for dwm

A logout script for dwm

Configuration

Add lrfs in PATH and make it executable.

Modify config.h:

  • define a new function:
    static const char *lrfs[] = { "lrfs", NULL };
    
@p7cq
p7cq / UTF-8-demo.txt
Created April 26, 2020 19:52
UTF-8 demo text file
UTF-8 encoded sample plain-text file
‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
Markus Kuhn [ˈmaʳkʊs kuːn] <http://www.cl.cam.ac.uk/~mgk25/> — 2002-07-25 CC BY
The ASCII compatible UTF-8 encoding used in this plain-text file
is defined in Unicode, ISO 10646-1, and RFC 2279.
Using Unicode/UTF-8, you can write in emails and source code things such as
@p7cq
p7cq / slss
Created April 26, 2020 21:03
Steam locomotive screensaver
#!/bin/bash
echo
echo "to exit, press Ctrl-C and wait for the locomotive to pass"
echo
sleep 3
clear
trap "exit" INT
declare -a ca=( "-a" "-l" "-F" "-c" "-al" "-aF" "-ac" "-lF" "-lc" "-alF" "-alc" "-lFc" "-alFc")
@p7cq
p7cq / Arch_Linux_Root_on_LVM.md
Last active June 4, 2023 20:09
Install Arch Linux with Root on LVM

Arch Linux with Root on LVM

Arch Linux with root on LVM and systemd boot.

  • Set a bigger font (if using a 4K laptop display)
setfont latarcyrheb-sun32
  • To connect to the internet add the ESSID and passphrase
@p7cq
p7cq / vm1-start.sh
Last active January 19, 2024 14:27
Dynamic CPU isolation in QEMU/KVM
#!/usr/bin/env bash
#
# CPU isolation in QEMU/KVM
#
# As the cset scripts no longer work (systemd switched to cgroups v2), this is my
# attempt at emulating its functionality. It may be incorrect and/or it may break
# stuff. Blind copy-pasting with some reasoning follows.
#
# Host:
@p7cq
p7cq / Arch_Linux_Root_on_Btrfs.md
Last active October 10, 2020 22:40
Install Arch Linux with Root on Btrfs

Arch Linux Root on Btrfs

Prepare disks

Keeping about 15% unallocated space on both disks.

sgdisk --zap-all /dev/disk/by-id/ata-CT240BX500SSD1_A
sgdisk -n1:0:+550M -t1:ef00 /dev/disk/by-id/ata-CT240BX500SSD1_A
sgdisk -n2:0:+190G -t2:8300 /dev/disk/by-id/ata-CT240BX500SSD1_A