Skip to content

Instantly share code, notes, and snippets.

@aur3l14no
aur3l14no / README
Last active July 10, 2024 09:05
virtiofs_hook
Both files should be put under `/var/lib/pve/local-btrfs/snippets/`.
Based on https://gist.github.com/Drallas/7e4a6f6f36610eeb0bbb5d011c8ca0be#file-set-hook-script-sh
Modification:
1. add direct kernel boot support for NixOS (add -kernel, -initrd, -append)
2. always override "args", so use with care if you have extra "args" that you want to keep
@aur3l14no
aur3l14no / bootstrap_ed25519.pub
Last active January 3, 2024 13:02
bootstrap_ed25519.pub
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJD0tFTtxd6RS5V0g7/eZ577gnKQOZAkFwgbV3+x2NTg bootstrap
@aur3l14no
aur3l14no / init.sh
Last active June 6, 2023 10:07
Initialize fly.io volume with local data · GitHub
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
YOUR_APP="" # eg. my-app
YOUR_VOL="" # eg. app-data
YOUR_REGION="" # eg. hkg
LOCAL_PATH="" # eg. /tmp/data/*
REMOTE_PATH="" # eg. /data/
@aur3l14no
aur3l14no / algebra.ml
Created June 28, 2022 12:27
OCaml Modular Programming
module type BrokenRing = sig
type t
val zero : t
val one : t
val ( + ) : t -> t -> t
val ( ~- ) : t -> t
val ( * ) : t -> t -> t
val to_string : t -> string
end
@aur3l14no
aur3l14no / setup_container_ssh.sh
Last active October 10, 2021 11:22
Setup SSH in containers
#!/bin/bash
container=$1
port=$2
pubkey=$3
if [ $# -lt 3 ]; then
echo "Usage: ./setup_container_ssh.sh [container_name] [port] [pubkey]"
else
docker exec ${container} /bin/sh -c "
@aur3l14no
aur3l14no / my_combination.py
Created May 29, 2019 04:08
python组合数
def my_combination(arr, ns):
'''从arr中取若干组大小分别为ns[0], ns[1], ...的数据
'''
if sum(ns) != len(arr):
return
def rec(arr, ns, result):
if ns:
for subset in combinations(arr, ns[0]):
another_result = result.copy()
another_result.append(subset)