Skip to content

Instantly share code, notes, and snippets.

View akastrin's full-sized avatar
🎯
Focusing

Andrej Kastrin akastrin

🎯
Focusing
View GitHub Profile
@akastrin
akastrin / archlinux-qemu-kvm.md
Created August 10, 2024 18:07 — forked from tatumroaquin/archlinux-qemu-kvm.md
QEMU-KVM Installation for Arch Linux

QEMU-KVM in Arch Linux

Check Virtualization Support

Check CPU has VM capabilities

lscpu | grep -i Virtualization
  • VT-x for Intel
  • AMD-Vi for AMD
@akastrin
akastrin / relocatelibvirtimages.md
Created August 10, 2024 14:31 — forked from plembo/relocatelibvirtimages.md
Relocate kvm images directory

Relocate an existing libvirtd (KVM) images directory

By default, KVM (libvirtd) images on Ubuntu and most other Linux distributions are found in /var/lib/libvirt/images. This can be inconvenient if you don't have a separate /var partition that can grow over time to accommodate multiple large images.

You can simply rename the images folder to something else and then symlink to a larger space with it (e.g. ln -s /data1/libvirt/images /var/lib/libvirt/images). That's what I used to do.

But that can lead to all sorts of unanticipated trouble. The right way to have your images on a bigger disk is to change the path for libvirt's default storage pool to a partition on that big disk, which is logically where KVM is going to create them.

First check to make sure a default pool exists:

@akastrin
akastrin / createkvmstoragepool.md
Created August 10, 2024 14:31 — forked from plembo/createkvmstoragepool.md
Create the default KVM storage pool for images

Create the default KVM storage pool for images

Some distributions create the defaut KVM (libvirtd) storage pool for images when they install KVM, others do this upon the creation of the first KVM guest. Creating the default pool from scratch is pretty straightforward. Here's how to do it with virsh.

First verify there is no existing default pool:

$ virsh pool-list --all
 Name      State    Autostart
-----------------------------
@akastrin
akastrin / doom.txt
Created April 28, 2024 18:22 — forked from hjertnes/doom.txt
Doom Emacs Cheatsheet
SPC
SPC: find file
, switch buffer
. browse files
: MX
; EX
< switch buffer
` eval
u universal arg
x pop up scratch
@akastrin
akastrin / org-mobile-sync.el
Created January 20, 2024 10:15 — forked from tgdnt/org-mobile-sync.el
org-mobile-sync
;; org-mobile-sync
(defun org-mobile-clean-pre-push()
(with-temp-buffer
(shell-command "rm ~/mobileorg/*" t)))
(defun org-mobile-rclone-sync-post-push()
(with-temp-buffer
(shell-command "rclone sync ~/mobileorg Dropbox:Apps/MobileOrg --exclude \.DS_Store" t)))
(defun org-mobile-rclone-sync-pre-pull()
(with-temp-buffer
(shell-command "rm ~/mobileorg/*" t)
@akastrin
akastrin / gpg-ssh-setup.md
Created December 24, 2023 19:02 — forked from mcattarinussi/gpg-ssh-setup.md
A setup guide to use a personal gpg key for ssh authentication

GPG - SSH setup

Generating the master key

Here we create the master key. We want only Certify capability: we use the master key only to create the subkeys, Sign - Encrypt - Authenticate capabilities will be assigned to the subkeys.

Run the following command to start the master key generation process. Select the set your own capabilities creation process (type 8)

  ▶ gpg --full-generate-key --expert

gpg (GnuPG) 2.2.9; Copyright (C) 2018 Free Software Foundation, Inc.

@akastrin
akastrin / Readme.md
Created November 21, 2023 04:41 — forked from py7hon/Readme.md
How to disable the annoying speaker beep in Arch Linux

How to disable the annoying speaker beep in Arch Linux

This has been driving me crazy for a while, but I never did anything about it: Whenever I use the keyboard to delete a file in the file manager using the DEL key, or go back a directory using BACKSPACE, or some everyday task like that, the computer beeps really loud, and almost makes me jump out of my chair. Disabling the speaker in ALSA Mixer does not work, and setting the volume to zero also does not help. So here is how to get rid of that beep:

In a terminal, write:

$ xset -b
@akastrin
akastrin / titleUrlMarkdownClip.js
Created August 8, 2023 20:56 — forked from idelem/titleUrlMarkdownClip.js
Bookmarklet to copy current page title and url in Markdown format to clipboard, like [title](url) - Usual for posting links to resources in README.md files
javascript:(function() {
function copyToClipboard(text) {
if (window.clipboardData && window.clipboardData.setData) {
/*IE specific code path to prevent textarea being shown while dialog is visible.*/
return clipboardData.setData("Text", text);
} else if (document.queryCommandSupported && document.queryCommandSupported("copy")) {
var textarea = document.createElement("textarea");
textarea.textContent = text;

Text Encoding

How are text files encoded, and what are the pros and cons of different encodings? This document introduces the ASCII and Unicode encodings to answer these questions. Some short pieces of Go code are provided which you can run yourself to see how strings are being encoded. Go is used because it has built-in support for Unicode, but you should be able to follow without any knowledge of Go.

ASCII

@akastrin
akastrin / renew-gpgkey.md
Created April 1, 2023 12:03 — forked from krisleech/renew-gpgkey.md
Renew Expired GPG key

Renew GPG key

Given that your key has expired.

$ gpg --list-keys
$ gpg --edit-key KEYID

Use the expire command to set a new expire date: