Skip to content

Instantly share code, notes, and snippets.

View Binjian's full-sized avatar

Binjian Binjian

View GitHub Profile
@Binjian
Binjian / relocatelibvirtimages.md
Created April 18, 2025 07:59 — 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:

@Binjian
Binjian / configure_multiple_clang.sh
Created April 17, 2025 03:06 — forked from TomSmartBishop/configure_multiple_clang.sh
Configure multiple clang versions on ubuntu
#!/usr/bin/env bash
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt update
sudo update-alternatives --remove-all clang
sudo apt-get install -y clang-3.9 clang-4.0 clang-5.0 clang-6.0
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.9 10
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-4.0 20
@Binjian
Binjian / build-emacs.sh
Created April 10, 2025 02:08 — forked from abidanBrito/build-emacs.sh
Build GNU Emacs from source.
#!/usr/bin/env bash
## Author: Abidán Brito
## This script builds GNU Emacs 29.1 with support for native elisp compilation,
## tree-sitter, libjansson (C JSON library), pure GTK and mailutils.
# Exit on error and print out commands before executing them.
set -euxo pipefail
# Let's set the number of jobs to something reasonable; keep 2 cores
@Binjian
Binjian / build.org
Created December 19, 2024 08:47 — forked from LdBeth/build.org
Build Emacs 31 for Windows

Build Emacs with MSYS2

This document is an up-to-date guide on compile Emacs 31 on windows with MSYS2, and make a installation with native compile that can work without MSYS2.

The idea is after get a working Emacs, you may delete MSYS2 environment to free some disk space, and forget about rebuilding Emacs

@Binjian
Binjian / README.md
Created June 27, 2024 02:14 — forked from satomacoto/README.md
Install pyenv and conda

Install pyenv

$ brew update
$ brew install pyenv

Check available versions and install

Oh my zsh.

Oh My Zsh

Install ZSH.

sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh

Install Oh my ZSH.

@Binjian
Binjian / academic.el
Last active May 14, 2024 07:57 — forked from rka97/academic.el
Configuration I use in Doom Emacs as part of my academic reading/notetaking workflow
;; The following packages are needed:
;; 1. elfeed and elfeed-score (available from the rss doom module)
;; 2. citar
;; 3. org-ref
;; 4. org-roam and org-roam-bibtex
(defconst x/bib-libraries (list "~/.org.d/bib/x-lib.bib" "~/.org.d/bib/x-temp-lib.bib")) ; All of my bib databases.
(defconst x/main-bib-library (nth 0 x/bib-libraries)) ; The main db is always the first
(defconst x/main-pdfs-library-paths `("~/.org.d/bib/pdfs/" "/home/x/.org.d/bib/temp-pdfs/")) ; PDFs directories in a list