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 / ansible-apt-repos
Last active November 4, 2021 02:47
Install apt repositories with ansible
set -x -e -o pipefail
: for deb-multimedia keyring, browse
ansible -i localhost, -c local localhost -m apt_repository -a 'repo="deb stable main non-free"'
ansible -i localhost, -c local localhost -m apt_repository -a 'repo="deb testing main non-free"'
ansible -i localhost, -c local localhost -m apt_repository -a 'repo="deb unstable main non-free"'
: for dropbox
lpenz / brewer.tex
Created April 25, 2015 22:02
colorbrewer colors for latex
% Colors from by Cynthia A. Brewer, Geography, Pennsylvania State University.
% Apache-Style Software License for ColorBrewer software and ColorBrewer Color Schemes
% Copyright (c) 2002 Cynthia Brewer, Mark Harrower, and The Pennsylvania State University.
% Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
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 / livedeb
Last active June 25, 2019 14:02
Creates a live debian on the provided (already partitioned) device
DEV=${1?must specify a device}
function finish {
for d in boot dev/pts dev proc sys; do
if test -d "$PWD/usbroot/$d" && mount | grep -q "$PWD/usbroot/$d"; then
umount "$PWD/usbroot/$d"
lpenz / dir2img
Last active April 22, 2019 16:24
Script that creates a bootable qcow2 img with a directory's contents - installs mbr and extlinux
DIR=${1?usage: $0 <dir> <img>}
OUT=${2?usage: $0 <dir> <img>}
set -e -x
rm -f "$OUT"
trap 'rm -f $OUT' EXIT INT
virt-make-fs --partition=mbr --type=ext3 --format=raw --size=+300M "$DIR" "$OUT"
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 / Vagrantfile-aws
Last active March 4, 2019 15:26
Vagrantfile for AWS with sshfs
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure('2') do |config| = 'dummy'
config.ssh.forward_agent = 'true'
config.vm.synced_folder '.', '/vagrant', type: 'sshfs' # only works with ubuntu
config.vm.provider :aws do |aws, override|