Skip to content

Instantly share code, notes, and snippets.

@zellio
zellio / gentrusty.sh
Created October 22, 2015 20:32
Generate Ubuntu Trusty container that will boot under systemd-nspawn
#!/usr/bin/env bash
function __main
{
local -r path="$(realpath "${1:-.}")"
debootstrap --variant=buildd trusty "$1" http://archive.ubuntu.com/ubuntu/
patch --unified "$path/etc/init/console.conf" <<'EOF'
@@ -3,7 +3,8 @@
# This service maintains a getty on console from the point the system is
# started until it is shut down again.
#!/usr/bin/env bash
docker ps --all | awk '{print $1}' | xargs docker rm
docker images | awk '{print $3}' | xargs docker rmi
@zellio
zellio / rebuild_appscript_files.rb
Created July 9, 2020 21:53
Rebuild AppScript files from JSON export blob
#!/usr/bin/env ruby
# Download the json blob from here: https://script.google.com/feeds/download/export?format=json&id=[fileId]
require 'json'
path = ARGV[1]
str = File.open(path) { |fh| fh.read }
data = JSON.parse(str, symbolize_names: true)