Skip to content

Instantly share code, notes, and snippets.

@tabrez
tabrez / install_roles.sh
Created August 1, 2023 13:27
Bash script that allows picking what roles to install on a machine using ansible
#!/bin/bash
# Define an array of roles
roles=(
"ansible",
"copy-private-ssh-key",
"copy-public-ssh-key",
"password-less-sudo",
"ssh-config",
"config-local",
@tabrez
tabrez / playbook.yml
Created August 1, 2023 13:25
Playbook to setup a headless Ubuntu VM
---
- name: setup command line utilities in ubuntu vm(tested 22.04 & 22.10)
hosts: all
become: true
gather_facts: false
vars:
user: tabrez
home: "/home/{{ user }}"
vars_files:
@tabrez
tabrez / Dockerfile
Last active July 29, 2023 09:17
Dockerfile to build Jupyter Lab container with fastai support
ARG OWNER=tabrez
ARG BASE_CONTAINER=jupyter/base-notebook
FROM $BASE_CONTAINER
LABEL maintainer="Tabrez Iqbal <tabrez@mailbox.org>"
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
USER root
@tabrez
tabrez / git_google_colab.txt
Last active July 27, 2023 10:53
work with Github repositories in Google Colab
# first cell: mount google drive folder on currect virtual machine of google colab
from google.colab import drive
drive.mount('/content/gdrive', force_remount=True)
%cd /content/gdrive/MyDrive/Colab Notebooks
!pwd && ls
# upload your private ssh key as id_ed25519 from left sidebar to 'Colab Notebooks' folder
# or modify below code to provide it in another way
# second cell: need to run on every new Google Colab session before interacting with Github
!mkdir -p /root/.ssh

minimal linux box on windows

Install multipass on windows

Help

setup using cloudinit.yaml:

#cloud-config
@tabrez
tabrez / id_rsa.pub
Created November 28, 2022 13:18
tabrez public key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTR8xPD+LB3PajsMmKcJFH/1m7byXOdH1skB8EmgnlaHdh9kyg6/XnsB/JzCzn1LtwKfzxHIz7kIKlB4IaHQHP/OYq76ZesSyyUlRgBw94//7Oq/Xmjun2+HWorMbIxzlswsrlnp/JumERqJqrhWz5rxG4Ex20gqbIJn87dy/gBpK12QiVyZkKToB694K8reL+vLDyhayw5Wgpdl/gjmtD9vT8K+gzSkbSEyL+IFFD/gb2MZqR43/uRDPi6JQyCuLuJtfIuHsC4B9kY7+B2MsSl+tzOqmADBYsOS+V1sJNTqPKrioM5OFwj0lphAwtXtgdsZdU05MK4bZlBp/l/oR3 tabrez.iqbal@gmail.com
# https://www.ivankrizsan.se/2021/05/16/ansible-and-multipass-virtual-machines/
all:
hosts:
multipassvm1:
ansible_connection: ssh
ansible_user: ubuntu
ansible_host: <ip of multipass vm>
ansible_ssh_common_args: "-o StrictHostKeyChecking=no -o ControlMaster=no -o ControlPath=none"
ansible_private_key: /var/snap/multipass/common/data/multipassd/ssh-keys/id_rsa
# or copy your public ssh key to vm and use:
version: 1
users:
- default
- name: tabrez
sudo: ALL=(ALL) NOPASSWD:ALL
shell: /bin/bash
ssh_import_id:
- gh:tabrez
write_files:
- content: |