Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
set -ex
mkdir -p ~/.local/share/lunarvim
git clone --branch release-1.2/neovim-0.8 https://github.com/lunarvim/lunarvim.git ~/.local/share/lunarvim/lvim
mkdir -p ~/.local/bin
cat << 'EOF' > ~/.local/bin/lvim
#!/usr/bin/env bash
#!/bin/bash
set -ex
VERSION=${1:-equuleus}
ARCH=${2:-amd64}
d=$(pwd)
t=$(mktemp -d)
cd $t

Arch Linux Installation Guide (UEFI + Secure Boot + Full Disk Encryption)

Download Arch Linux ISO

  1. Download *.iso and *.iso.sig from https://archlinux.org/download/
  2. Verify sha256
  3. Verify signature: gpg --keyserver-options auto-key-retrieve --verify *.iso.sig

Create Virtual Machine in virt-manager (optional)

  • Firmware: OVMF_CODE.secboot.fd
  • Add TPM v2
#!/bin/bash
# install via ./pre-commit.sh install
SELF=$(realpath $0)
SRC=$(realpath pre-commit.sh)
_HOOK=$(git rev-parse --git-path hooks)/pre-commit
HOOK=$(realpath $_HOOK)
install() {
[W:=10,H:=10,find:=lambda x:x if x==uf[x]else(uf.__setitem__(x,x:=find(uf[x]))or x),union:=lambda a,b:uf.__setitem__(find(a),find(b)),c2i:=lambda x,y:y*W+x,i2c:=lambda i:(i%W,i//W),uf:=[*range(W*H)],E:=[(c2i(x,y),c2i(x+1-z,y+z))for x in range(W-1)for y in range(H-1)for z in range(2)]+[(c2i(x,H-1),c2i(x+1,H-1))for x in range(W-1)]+[(c2i(W-1,y),c2i(W-1,y+1))for y in range(H-1)],__import__("random").shuffle(E),PE:=[],N:=[[[]for _ in'*'*W]for _ in'*'*H],[[union(a,b),c1:=i2c(a),c2:=i2c(b),N[c1[1]][c1[0]].append(c2),N[c2[1]][c2[0]].append(c1),PE.extend([((2*c1[0]+1,2*c1[1]),(2*c1[0]+2,2*c1[1])),((2*c1[0]+1,2*c1[1]+1),(2*c1[0]+2,2*c1[1]+1))]if c1[1]==c2[1]else[((2*c1[0],2*c1[1]+1),(2*c1[0],2*c1[1]+2)),((2*c1[0]+1,2*c1[1]+1),(2*c1[0]+1,2*c1[1]+2))])]for a,b in E if find(a)!=find(b)],[[[0 if(x-1,y)in N[y][x]else PE.append(((2*x,2*y),(2*x,2*y+1))),0 if(x+1,y)in N[y][x]else PE.append(((2*x+1,2*y),(2*x+1,2*y+1))),0 if(x,y-1)in N[y][x]else PE.append(((2*x,2*y),(2*x+1,2*y))),0 if(x,y+1)in N[y][x]else PE.append(((2*x,2*y+1)
@Defelo
Defelo / custom_html_head_content.html
Created January 31, 2021 21:33
KaTeX Support for Bookstack
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css" integrity="sha384-AfEj0r4/OFrOo5t7NnNe46zW/tFgW6x/bCJG8FqQCEo3+Aro6EYUG4+cU+KJWu/X" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.js" integrity="sha384-g7c+Jr9ZivxKLnZTDUhnkOnsh30B4H0rpLUpJ4jAIKs4fnJI+sEnkvrMWph2EDg4" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/contrib/auto-render.min.js" integrity="sha384-mll67QQFJfxn0IYznZYonOWZ644AWYC+Pt2cHqMaRhXVrursRwvLnLaebdGIlYNa" crossorigin="anonymous"></script>
<script>
function _katex_render(elem) {
renderMathInElement(
elem,
{
delimiters: [
@Defelo
Defelo / heap.ipynb
Created December 23, 2020 14:20
Heap Implementation in Python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Defelo
Defelo / clipsync.sh
Created April 4, 2020 08:57
X11 Clipboard Sync
#!/bin/bash
[[ $# -lt 2 ]] && echo "usage: $0 <first display> <second display>" && exit 1
clipread() {
xclip -selection clip -r -o -display $1 2> /dev/null
}
clipwrite() {
xclip -selection clip -r -i -display $1
@Defelo
Defelo / docker-compose.yml
Last active February 3, 2020 15:34
Docker MySQL Server
version: '3.7'
services:
db:
container_name: mysql_server
image: mariadb
restart: always
environment:
MYSQL_USER: "user"
MYSQL_PASSWORD: "password"
MYSQL_DATABASE: "db"
import math
#term = input(">> ").split()
stack = []
running = True
while running:
for t in input(">> ").split():
if t == "exit":
running = False
break