Skip to content

Instantly share code, notes, and snippets.

View alexxlabs's full-sized avatar

alexxlabs alexxlabs

View GitHub Profile
# remove any existing dynamic module
if ($null -ne (Get-Module -Name "alexxlabs-core")) {
Remove-Module -Name "alexxlabs-core" -Force
}
# Helper functions which need to be defined before the module is loaded
# See https://github.com/JanDeDobbeleer/oh-my-posh/discussions/2300
function global:test {
Write-Host "! test !"
return 0
{
"brand": "bhyve",
"alias": "centomdano",
"hostname": "centodano",
"dns_domain": "example.com",
"vcpus": 2,
"ram": 4096,
"resolvers": ["8.8.8.8", "8.8.4.4"],
"disks": [
{
@alexxlabs
alexxlabs / gist:1cb1ce9b2e28ba3109e8f94b2a2b431e
Created November 27, 2019 06:28 — forked from danmack/gist:6d69a6d2ab08e6dbf8a1727e9c2267a0
SmartOS add disk to bhyve linux container
Adding a new disk to a bhyve vm takes a few steps.
1. increase the quota on the zfs dataset to accomodate the additional
space.
2. create a zvol inside the zone
3. stop the vm and update its configuration to reflect the change
4. start the vm, login and use the disk
# update quota
@alexxlabs
alexxlabs / README.md
Created November 26, 2019 20:38 — forked from mgerdts/README.md
SmartLogin work-alike for bhyve, kvm, and lx

SmartLogin only works with SmartOS zones. Control of key-based access to bhyve, kvm, and lx isntances can be accomplished using OpenSSH's authorized keys command to fetch authorized keys from the metadata service.

Guest Setup

The guest OS needs to have the following added to {{/etc/ssh/sshd_config}}.

AuthorizedKeysCommand /usr/sbin/mdata-get "%u_authorized_keys"
AuthorizedKeysCommandUser mdataget
@alexxlabs
alexxlabs / readme.txt
Created February 15, 2019 19:46 — forked from bahamas10/readme.txt
Home Assistant on SmartOS LX Zone
{
"alias": "hass",
"brand": "lx",
"autoboot": true,
"quota": 20,
"delegate_dataset": true,
"kernel_version": "4.3.0",
"image_uuid": "7b5981c4-1889-11e7-b4c5-3f3bdfc9b88b",
"max_physical_memory": 1024,
"nics": [
@alexxlabs
alexxlabs / socket_file.sh
Created February 8, 2019 15:30 — forked from jadell/socket_file.sh
Read and write to a socket using only Bash
#!/bin/bash
#
# Bash must have been compiled with this ability: --enable-net-redirections
# The device files below do not actually exist.
# Use /dev/udp for UDP sockets
exec 3<>/dev/tcp/host/port
# Write to the socket as with any file descriptor
echo "Write this to the socket" >&3
@alexxlabs
alexxlabs / unix_server.c
Created February 8, 2019 13:34 — forked from tscho/unix_server.c
An example of a unix socket echo server that can run as a daemon
#include <signal.h>
#include <stdio.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <string.h>
#include <stdlib.h>
#include <sys/un.h>
#include <errno.h>
#include <sys/signal.h>
#include <wait.h>
@alexxlabs
alexxlabs / zfs_health.sh
Created January 31, 2019 12:56 — forked from petervanderdoes/zfs_health.sh
ZFS Health Check Script
#! /usr/local/bin/bash
#
# Calomel.org
# https://calomel.org/zfs_health_check_script.html
# FreeBSD 9.1 ZFS Health Check script
# zfs_health.sh @ Version 0.15
# Check health of ZFS volumes and drives. On any faults send email. In FreeBSD
# 10 there is supposed to be a ZFSd daemon to monitor the health of the ZFS
# pools. For now, in FreeBSD 9, we will make our own checks and run this script
@alexxlabs
alexxlabs / README.md
Created January 22, 2019 19:34 — forked from mgerdts/README.md
bhyve on SmartOS

Introduction

The following options that aren't in the kvm brand should work:

  • com1, com2
    • Can be set to tty-like devices or socket,/some/path.
    • If both are unset, com1 defaults to /dev/zconsole and com2 defaults to /tmp/vm.ttyb.
  • bootrom
    • Should be set to /usr/share/bhyve/BHYVE_UEFI.fd or /usr/share/bhyve/BHYVE_UEFI_CSM.fd
  • Defaults to /usr/share/bhyve/BHYVE_UEFI_CSM.fd
@alexxlabs
alexxlabs / README-Template.md
Created November 17, 2017 18:20 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites