Skip to content

Instantly share code, notes, and snippets.

View maxiberta's full-sized avatar

Maximiliano Bertacchini maxiberta

View GitHub Profile
@maxiberta
maxiberta / snapd-staging.sh
Last active October 4, 2019 14:22 — forked from glower/snapd-staging.sh
Build snapd for staging in a lxd container
#!/bin/bash
# use this script in a fresh lxd container
set -ex
tmp=$(mktemp -d)
cd "$tmp"
sudo apt update
sudo apt install golang-go
#!/bin/bash
# https://gist.github.com/bloodearnest/ebf044476e70c4baee59c5000a10f4c8
set -eu
_UID=$(id -u)
GID=$(id -g)
# give lxd permission to map your user/group id through
grep root:$_UID:1 /etc/subuid -qs || sudo usermod --add-subuids ${_UID}-${_UID} --add-subgids ${GID}-${GID} root
# set up a separate key to make sure we can log in automatically via ssh
@maxiberta
maxiberta / staging-image.sh
Last active October 4, 2019 14:10 — forked from fgimenez/staging-image.sh
Ubuntu Core image for the staging Snap Store
# Create an Ubuntu core image with a custom snapd that talks to the staging Snap Store.
#
# LXD-based alternative:
# https://gist.github.com/maxiberta/5fb47645b0d32137e13f5046ff330eb6
set -ex
tmp=$(mktemp -d)
cd "$tmp"
@maxiberta
maxiberta / writebench.py
Created February 24, 2017 21:50
How long does it take Python to write lots of data to file on disk?
"""
$ python3 writebench.py
Wrote 4768.42 MB in 2.30 secs
"""
import os
import tempfile
import time
t0 = time.time()