Skip to content

Instantly share code, notes, and snippets.

mlgrm's run ubuntu in crostini

this gist is out of date and remains here only for reference

This is just a modification of this reddit to minimize copying and pasting, make it less interactive, and to allow creation of a username of your choice instead of the default google email address.

# #How to run Ubuntu with full Chrome OS Integration
# Here's a post that shows in detail how to make the default penguin container run Ubuntu instead of Debian:
# [Introduction to Crostini - Part 3: Using Ubuntu by default](https://linuxiumcomau.blogspot.com/2018/08/introduction-to-crostini-part-3-using.html)
#!/bin/bash
exec 3>&1 4>&2
trap 'exec 2>&4 1>&3' 0 1 2 3
exec 1>/var/log/first-boot.log 2>&1
set -x
set -e
# set up data disk as DATA_DIR
# export data="/dev/disk/by-id/google-data
# try to mount data partition
#!/bin/bash
# usage: curl -sL bit.ly/mlgrm-traefiker-rstudio | [USER=user] [PASSWD=passwd] bash
if [[ -z $PASSWD ]]; then PASSWD=$(apg -n 1) && >&2 echo "password: $PASSWD"; fi
USER=${USER:-$USER}
#if [[ -n $(docker network list --filter name=postgres -q) ]]; then PG_NETWORK="--network postgres"; fi
curl -sL bit.ly/mlgrm-traefiker |
HOSTNAME=rstudio:shiny PORT=8787:3838 SERVICE=rstudio:shiny \
#!/bin/bash
# usage: curl -sL bit.ly/mlgrm-postgres | EMAIL=mail@example.com [PASSWORD=xxxxxxx] bash
set -e
[[ -z $PASSWD ]] && PASSWD=$(apg -n 1) && >&2 echo "password: $PASSWD"
[[ -z $EMAIL ]] && >&2 echo "need to set EMAIL" && exit
[[ -z $DOCKER_HOST ]] || ! docker ps 2>&1 > /dev/null && >&2 echo "need DOCKER_HOST defined and running docker"
#if [[ -z $(docker ps --filter name=traefik -q) ]]; then curl -sL bit.ly/mlgrm-traefik-setup | bash; fi
@mlgrm
mlgrm / traefiker.sh
Last active April 10, 2019 10:49
add the labels to a docker call so that traefik serves it
#!/bin/bash
# run a docker image behind the traefik container created by http://bit.ly/2FpLCNB
#
# usage:
# curl -sL bit.ly/mlgrm-traefiker | \
# HOSTNAME=host DOMAIN=example.com [SERVICE=svc] [PORT=port] [PROTOCOL=prtcl] bash -s -- <cmd> <args> <image>
# or
# curl -sl bit.ly/mlgrm-traefiker > traefiker && chmod +x traefiker
# HOSTNAME=host [...] ./traefiker <args> <image>
#
#!/bin/bash
# usage curl -sL bit.ly/mlgrm-traefik-setup | DOMAIN=traefik.example.com HOST=gcp_hostname EMAIL=mail@example.com bash
set -e
ACME_EMAIL=${ACME_EMAIL:-$EMAIL}
DATA=${DATA:-/mnt/disks/data}
[[ -z $DOMAIN || -z $HOST || -z $ACME_EMAIL ]] && echo 'all of DOMAIN, HOST, and ACME_EMAIL must be defined' && exit 1
#set -e
################################################################
# Global configuration
################################################################
# Enable debug mode
#
# Optional
# Default: false
#
# debug = true
# usage: curl -sL bit.ly/mlgrm-docker-remote | tail -n +3 >> $HOME/.bashrc && . $HOME/.bashrc
# --------- begin mlgrm docker_host function -------- #
# set environment variables to execute docker commands using gcp compute engine HOST
# leave out host to unset the variables
# usage docker_host HOST
docker_host () {
if [[ -n $1 ]]; then
export DOCKER_HOST="tcp://$(gcloud compute instances describe $1 \
--format 'value(networkInterfaces[0].accessConfigs[0].natIP)'):2376" DOCKER_TLS_VERIFY=1
@mlgrm
mlgrm / preseed.cfg
Last active October 21, 2023 01:21
preseed file for automating the install of ubuntu 18.04 desktop
# preseed.cfg
# adapted from http://bit.ly/2JjXqVF
# Newer ubiquity command
ubiquity partman-auto/disk string /dev/sda
ubiquity partman-auto/method string regular
ubiquity partman-lvm/device_remove_lvm boolean true
ubiquity partman-md/device_remove_md boolean true
ubiquity partman-auto/choose_recipe select atomic
@mlgrm
mlgrm / install-rstudio.sh
Last active June 12, 2019 12:24
install the most recent version of R, rstudio and the tidyverse on ubuntu 18.04
#!/bin/bash
# usage: sudo true && curl -sL bit.ly/mlgrm-install-rstudio | bash
set -e
sudo apt install software-properties-common
sudo apt-key adv --keyserver keyserver.ubuntu.com \
--recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9