Skip to content

Instantly share code, notes, and snippets.

🐧
🦀

Leandro Lisboa Penz lpenz

🐧
🦀
Block or report user

Report or block lpenz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@lpenz
lpenz / livedeb
Last active Jun 25, 2019
Creates a live debian on the provided (already partitioned) device
View livedeb
#!/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 Apr 22, 2019
Script that creates a bootable qcow2 img with a directory's contents - installs mbr and extlinux
View dir2img
#!/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 Mar 25, 2019
Vagrantfile that installs minkube in a VM and runs it there with vm-driver=none
View Vagrantfile-minikube
# -*- 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 Mar 4, 2019
Vagrantfile for AWS with sshfs
View Vagrantfile-aws
# -*- 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|
@lpenz
lpenz / steam-session.sh
Last active Jan 24, 2019
Start steam in a nested X server running icewm
View steam-session.sh
#!/bin/bash
set -e -x
DISPLAY_SESSION=:1
Xephyr "$DISPLAY_SESSION" -screen 1800x1000 &
PID_X=$!
trap 'kill "$PID_X"; wait "$PID_X"' EXIT
sleep 1
@lpenz
lpenz / SConstruct
Created Jan 20, 2019
SConstruct template with an action that renders jinja2 templates using data from an yaml file, while providing a markdown filter
View SConstruct
# 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
lpenz / Dockerfile
Created Oct 27, 2018
Dockerfile that creates a container that installs fluorite + electron locally
View Dockerfile
# 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
lpenz / docker-create-debian-image.sh
Last active Mar 1, 2018
debootstrap a bare debian docker image
View docker-create-debian-image.sh
#!/bin/bash
DIST=${1?no distribution specified}
ARCH=${2:amd64}
set -e -x
NAME=debian-${DIST}-${ARCH}
debootstrap --no-check-gpg "--arch=$ARCH" "$DIST" "$NAME" http://archive.debian.org/debian
tar -C "$NAME" -c . | docker import - "$USER/$NAME"
@lpenz
lpenz / minesweeper.hs
Created Nov 20, 2017
minesweeper kata in haskell, no output
View minesweeper.hs
import qualified Data.Map as Map
import Control.Monad
main :: IO ()
main = processOneField
processOneField :: IO ()
@lpenz
lpenz / ansible-apt-repos
Last active Jun 23, 2017
Install apt repositories with ansible
View ansible-apt-repos
#!/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
You can’t perform that action at this time.