Skip to content

Instantly share code, notes, and snippets.

View lpenz's full-sized avatar
🦀 🐊

Leandro Lisboa Penz lpenz

🦀 🐊
View GitHub Profile
lpenz / custom.toml
Created August 27, 2023 13:09
custom.toml example for Raspberry Pi OS
# Raspberry PI OS config.toml
# This file is used for the initial setup of the system on the first boot, if
# it's s present in the boot partition of the installation.
# This file is loaded by firstboot, parsed by init_config and ends up
# as several calls to imager_custom.
# The example below has all current fields.
# References:
# -
lpenz /
Created December 23, 2020 16:34
Shell one-liner that installs an apt repository using ansible
ansible -c local localhost -m apt_repository -a "repo='deb buster main' update_cache=no"
lpenz /
Created December 1, 2020 18:37
Rust executable template
// Copyright (C) 2020 Leandro Lisboa Penz <>
// This file is subject to the terms and conditions defined in
// file 'LICENSE', which is part of this source code package.
use anyhow::Result;
fn main() -> Result<()> {
lpenz / chroot-with-mounts
Created January 26, 2020 16:14
chroot script that mounts /dev, /proc, etc. in a private mount namespace
trap 'rm -f $TMP' EXIT
chmod u+x "$TMP"
set -e
lpenz / Vagrantfile-minikube
Created March 25, 2019 16:00
Vagrantfile that installs minkube in a VM and runs it there with vm-driver=none
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| = "debian/stretch64"
# = "debian/buster64"
config.vm.provider "libvirt" do |v|
lpenz /
Last active January 24, 2019 21:57
Start steam in a nested X server running icewm
set -e -x
Xephyr "$DISPLAY_SESSION" -screen 1800x1000 &
trap 'kill "$PID_X"; wait "$PID_X"' EXIT
sleep 1
lpenz / SConstruct
Created January 20, 2019 21:54
SConstruct template with an action that renders jinja2 templates using data from an yaml file, while providing a markdown filter
# SConstruct template with an action that renders jinja2 templates
# using data from an yaml file, while providing a markdown filter.
import yaml
import jinja2
import markdown
if False:
Environment = None
lpenz / Dockerfile
Created October 27, 2018 20:28
Dockerfile that creates a container that installs fluorite + electron locally
# You can use this Dockerfile to avoid having to install npm to
# get fluorine + electron installed locally.
# You still need node.js to run it, however.
# To use:
# docker build -t fluorine .
# docker run -it --rm -v $PWD:/home/user/work -e MY_UID=$UID fluorine
# The container will exit after fluorine + electron are set up; you can then
# remove the container with:
# docker rmi fluorine
# To run fluorine:
lpenz / minesweeper.hs
Created November 20, 2017 23:00
minesweeper kata in haskell, no output
import qualified Data.Map as Map
import Control.Monad
main :: IO ()
main = processOneField
processOneField :: IO ()
lpenz / nix-enter
Last active March 26, 2017 18:53
Enter a shell with ~/nix privately mounted in /nix, using mount namespaces. sudo required
set -e -x
trap 'rm -f $TMP' EXIT
chmod u+x "$TMP"
cat > "$TMP" <<END
sudo mkdir /nix