Skip to content

Instantly share code, notes, and snippets.

View lpenz's full-sized avatar
🐧
🦀 🐊

Leandro Lisboa Penz lpenz

🐧
🦀 🐊
View GitHub Profile
@lpenz
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:
# - https://github.com/RPi-Distro/raspberrypi-sys-mods/blob/master/usr/lib/raspberrypi-sys-mods/firstboot
@lpenz
lpenz / ansible-apt-repos
Last active November 4, 2021 02:47
Install apt repositories with ansible
#!/bin/bash
set -x -e -o pipefail
: for deb-multimedia keyring, browse http://www.deb-multimedia.org/pool/main/d/deb-multimedia-keyring/deb-multimedia-keyring
ansible -i localhost, -c local localhost -m apt_repository -a 'repo="deb http://www.deb-multimedia.org stable main non-free"'
ansible -i localhost, -c local localhost -m apt_repository -a 'repo="deb http://www.deb-multimedia.org testing main non-free"'
ansible -i localhost, -c local localhost -m apt_repository -a 'repo="deb http://www.deb-multimedia.org unstable main non-free"'
: for dropbox
@lpenz
lpenz / brewer.tex
Created April 25, 2015 22:02
colorbrewer colors for latex
% Colors from www.ColorBrewer.org 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
%
% http://www.apache.org/licenses/LICENSE-2.0
@lpenz
lpenz / ansible-install-aptrepo.sh
Created December 23, 2020 16:34
Shell one-liner that installs an apt repository using ansible
#!/bin/bash
ansible -c local localhost -m apt_repository -a "repo='deb https://packagecloud.io/lpenz/debian/debian/ buster main' update_cache=no"
@lpenz
lpenz / main.rs
Created December 1, 2020 18:37
Rust executable template
// Copyright (C) 2020 Leandro Lisboa Penz <lpenz@lpenz.org>
// 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<()> {
Ok(())
}
@lpenz
lpenz / chroot-with-mounts
Created January 26, 2020 16:14
chroot script that mounts /dev, /proc, etc. in a private mount namespace
#!/bin/bash
TARGET=${1-PWD}
shift
TMP=$(mktemp)
trap 'rm -f $TMP' EXIT
chmod u+x "$TMP"
set -e
@lpenz
lpenz / livedeb
Last active June 25, 2019 14:02
Creates a live debian on the provided (already partitioned) device
#!/bin/bash
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"
fi
done
@lpenz
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
#!/bin/bash
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
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!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "debian/stretch64"
# config.vm.box = "debian/buster64"
config.vm.provider "libvirt" do |v|
@lpenz
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|
config.vm.box = 'dummy'
config.ssh.forward_agent = 'true'
config.vm.synced_folder '.', '/vagrant', type: 'sshfs' # only works with ubuntu
config.vm.provider :aws do |aws, override|