Skip to content

Instantly share code, notes, and snippets.

View b-fg's full-sized avatar
🌀

Bernat Font b-fg

🌀
View GitHub Profile
@b-fg
b-fg / ad_torch.py
Last active March 1, 2024 13:57
Example of automatic differentiation (AD) using PyTorch
"""
Testing PyTorch automatic differentiation (AD) tools for an analytical multivariate polynomial function:
u_i(x_i) = u_i(x,y,...) = (u(x,y,...), v(x,y,...))
In particular we test the function u_i(x,y):=(
u(x,y) := x^5 + 4x^2y + 6y^2 + 2,
v(x,y) := xy^4 + 4xy^2 + 6x^2 - y
)
"""
import torch
@b-fg
b-fg / install-arch.md
Created February 5, 2024 12:51 — forked from mjnaderi/install-arch.md
Installing Arch Linux with Full Disk Encryption (LVM on LUKS)

Installing Arch Linux with Full Disk Encryption

If you're aiming for a seamless Arch Linux installation in UEFI mode, follow along as this guide will walk you through the process step by step. We'll be using LUKS (Linux Unified Key Setup) and LVM (Logical Volume Manager) partitions on LUKS to achieve full disk encryption.

Note: I have updated this doc for UEFI mode. For those with BIOS/MBR systems, you can refer to the previous version, but keep in mind that it might be outdated and no longer accurate.

If you're only interested in installing Linux and not setting up dual boot with Windows, feel free to skip the Windows-related sections.

macro out(exs...)
blk = Expr(:block)
for ex in exs
push!(blk.args, :(print($(sprint(Base.show_unquoted, ex) * " = "))))
push!(blk.args, :(show(stdout, "text/plain", begin value=$(esc(ex)) end)))
push!(blk.args, :(println()))
end
isempty(exs) || push!(blk.args, :value)
return blk
end