Skip to content

Instantly share code, notes, and snippets.

@lbogdan
lbogdan / README.md
Last active February 6, 2022 17:28
Thoughts on the VirtualBox Networking Model

So, I've been taking a better look at VirtualBox's networking model. Turns out that the Vagrant's networking model was a direct consequence of VirtualBox's: if you take a look at VirtualBox's Networking Modes documentation, you'll see the only mode that provides full Host <-> VM, VM1 <-> VM2 and VM <-> Internet connectivity by using a single network interface is "Bridged".

That's probably the reason why Vagrant chose to use "NAT" mode for the default network interface, which provides VM <-> Internet connectivity, and only limited Host <-> VM connectivity, by using port forwarding to be able to SSH from the Host to the VM. So if you need additional full Host <-> VM and VM1 <-> VM2 connectivity, you'll need to add another network interface in "Host-only" mode.

So it looks like for fluff we're only left with being able to use "Bridged" mode, which comes with a few drawbacks:

  • when you configure the VM network interface, you
@lbogdan
lbogdan / createvm.sh
Last active February 3, 2022 14:54
createvm.sh
#!/bin/bash
set -euo pipefail
IMAGE_QCOW2="AlmaLinux-8-GenericCloud-8.5-20211119.x86_64.qcow2"
IMAGE_URL="https://repo.almalinux.org/almalinux/8/cloud/x86_64/images/$IMAGE_QCOW2"
IMAGE_VMDK="AlmaLinux-8-GenericCloud-8.5-20211119.x86_64.vmdk"
VMS_PATH="/Users/lbogdan/Virtual Machines.localized"
VM_NAME="control"
USERNAME="lbogdan"

Keybase proof

I hereby claim:

  • I am lbogdan on github.
  • I am lbogdan (https://keybase.io/lbogdan) on keybase.
  • I have a public key ASAgdD06ulF9Q3S3sOgaWoFSS6rZ6jgp_Fc1COXa4WUWyQo

To claim this, I am signing this object:

@lbogdan
lbogdan / build.sh
Created May 25, 2020 20:41
cri-o 1.18.1 .deb build script for ubuntu 18.04
#!/bin/sh
# run this inside an Ubuntu 18.04 container
set -e
set -u
set -x
DH_GOLANG_DEB=dh-golang_1.48_all.deb
BUILD_DIR=cri-o
@lbogdan
lbogdan / prerequisites.md
Last active January 22, 2019 20:25
[WIP] Intro to Vue.js Workshop

At the beginning of the workshop you should have all of the following installed:

@lbogdan
lbogdan / sync.md
Created October 24, 2018 09:15
Feature: synchronize externally modified sandbox files with the API

Feature: synchronize externally modified sandbox files with the API

Steps:

  1. the agent detects the change, sends it to the manager
  2. the manager sends the change to an authenticated API endpoint
  3. the API process the change (uploads the file if binary, updates the DB)
  4. the manager sends an external change notification to all connected clients
  5. the client refetches the sandbox contents (lazy fetching?)

Detecting the change - agent

@lbogdan
lbogdan / sol.sh
Last active September 1, 2018 11:15
shutdown on lan
#!/bin/bash
INTERFACE=ens33 # interface we're listening on
NUM_PACKETS=3 # number of packets sent at once
TIME_THRESHOLD=3 # max seconds between packets
PACKET_THRESHOLD=3 # packets needed to run command
COMMAND="echo DONE!" # command to run
packet_count=0
last_timestamp=0
const Koa = require('koa');
const Router = require('koa-router');
const AWS = require('aws-sdk');
const app = new Koa();
const router = new Router();
const thumbnails = {};
AWS.config.loadFromPath('./aws_lambda.json');
const path = require('path');
const puppeteer = require('puppeteer');
const AWS = require('aws-sdk');
const s3Config = {
apiVersion: '2006-03-01',
region: 'eu-central-1',
bucket: 'codesandbox-thumbnails',
};
const puppeteerConfig = {
@lbogdan
lbogdan / theme.js
Last active December 10, 2017 00:38
TinyMCE theme
(function () {
var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)}
// Used when there is no 'main' module.
// The name is probably (hopefully) unique so minification removes for releases.
var register_3795 = function (id) {
var module = dem(id);
var fragments = id.split('.');
var target = Function('return this;')();