Skip to content

Instantly share code, notes, and snippets.

@heppu
heppu / ARCH_INSTALL.MD
Last active February 27, 2022 17:01
Installing Arch with GPT, dm-crypt, LUKS, LVM and systemd-boot

Create bootable USB

dd bs=4M if=/path/to/archlinux.iso of=/dev/sdx status=progress oflag=sync

Boot from USB and set prepare system

loadkeys <your-keymap>
@heppu
heppu / arch_gpu_passthrough.MD
Last active October 8, 2021 20:46
Arch GPU passthrough

Install rpmextract

sudo pacman -Suy rpmextract

Get lates edk2.git-ovmf-x64

wget https://www.kraxel.org/repos/jenkins/edk2/edk2.git-ovmf-x64-XXXXXX.noarch.rpm
@heppu
heppu / arch_virtualization.MD
Created March 11, 2016 07:33
Arch virtualization and CoreOS

Arch virtualization

Check virtualization support

lscpu

Check KVM modules

zgrep CONFIG_KVM /proc/config.gz
package main
import (
"encoding/csv"
"flag"
"log"
"math/rand"
"os"
"strconv"
"time"
type FailingStorage struct{}
func (f *FailingStorage) Add(k, v string) {
throw exception.New("now we fail")
}
var s = NewSafeStorage(&FailingStorage{})
func handleAdd(w http.ResponseWriter, r *http.Request) {
key := r.Host
value := r.Method
type FailingStorage struct{}
func (f *FailingStorage) Add(k, v string) (err error) {
return errors.New("now we fail")
}
var s = NewSafeStorage(&FailingStorage{})
@heppu
heppu / original.go
Last active January 26, 2019 11:16
type storage struct{}
func (s *storage) Add(k, v string) {}
var s = NewSafeStorage(&storage{})
func handleAdd(w http.ResponseWriter, r *http.Request) {
key := r.Host
value := r.Method
s.Add(key, value)
}
type FailingStorage struct{}
func (f *FailingStorage) Add(k, v string) (err error) {
return errors.New("now we fail")
}
var s = NewSafeStorage(&FailingStorage{})
func handleAdd(w http.ResponseWriter, r *http.Request) {
key := r.Host
value := r.Method
type Storage interface {
Add(key, val string) error
}
func (s *SafeStorage) Add(key, val string) error {
s.storageMu.Lock()
defer s.storageMu.Unlock()
return s.storage.Add(key, val)
}
type Storage interface {
Add(key, val string)
}
type SafeStorage struct {
storageMu *sync.Mutex
storage Storage
}
func NewSafeStorage(storage Storage) *SafeStorage {