Skip to content

Instantly share code, notes, and snippets.

@micahyoung
micahyoung / Vagrantfile
Created October 28, 2015 00:33
bosh-lite-swapfob
load './bosh-lite/Vagrantfile'
USB_NAME = 'SanDisk Cruzer Blade [0100]'
USB_VENDOR_ID = '0x0781'
USB_PRODUCT_ID = '0x5567'
SWAP_LABEL = 'SWAP-FOB'
Vagrant.configure('2') do |config|
config.vm.provision "shell", inline: "echo LABEL=#{SWAP_LABEL} swap swap sw 0 0 >> /etc/fstab; swapon -a"
@micahyoung
micahyoung / caps-ctrl.reg
Last active August 28, 2016 00:23
Windows boilerplate
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,1d,00,3a,00,00,00,00,00
select disk 1
clean
convert gpt
create partition efi size=256
format quick fs=fat32 label="System"
create partition primary
format quick fs=ntfs label="Windows"
  1. Create ubuntu 16.04 VM in Fusion
  2. Shutdown VM and take snapshot
  3. Go to Settings on Local VM -> Compatibility -> Advanced Settings -> Use Hardware Version 11
  4. Connect to haas environment in Fusion (File -> Connect to Server)
  5. Right click on VM -> Upload to Server
  6. Go to Settings on Server VM -> Processors & Memory -> Advanced Settings -> Enable hypervisor...
  7. (Optional) In Settings, increase RAM and CPUs
  8. Start VM and log in
  9. Install dependencies: apt install git xz-utils uvtool-libvirt
@micahyoung
micahyoung / Installing ESXi on Supermicro SYS‐E200‐8D.md
Last active August 14, 2022 10:58
Installing ESXi on Supermicro SYS‐E200‐8D
  1. Download ESX 6.5.0 from https://my.vmware.com/group/vmware/info?slug=datacenter_cloud_infrastructure/vmware_vsphere_hypervisor_esxi/6_0
  2. Download unetbootin https://unetbootin.github.io/
  3. Use unetbootin to Write ESXi image to USB
  4. Connect your USB, power and a Ethernet network with DHCP
  • Bottom left port of 4 is vnic0
  • Management port above the USB is optional
  1. Boot your machine and press DEL repeatedly after SUPERMICRO screen
  2. On the setup screen, go to the Save & Exit page
    • At the bottom under Boot Override, select UEFI to boot from your USB drive
  3. ESXi installer should start. Complete the installation to an internal drive, remove your USB
  1. Install Raspbian Jessie Lite

    umount /dev/rdisk<DISK ID>*
    sudo dd if=~/Downloads/2017-04-10-raspbian-jessie-lite.img of=/dev/rdisk<DISK ID> bs=1g
  2. Add empty file name ssh to FAT32 boot partition

touch /Volumes/boot/ssh

@micahyoung
micahyoung / export_vcap_services.sh
Last active March 7, 2019 11:22
export all VCAP_SERVICES user-provided credentials as individual environment variables for start command shell script (jq 1.3 or newer)
#!/bin/bash
while read ENV_PAIR; do export "${ENV_PAIR}"; done \
< <(echo $VCAP_SERVICES | jq -r '.["user-provided"] | .[].credentials | to_entries[] | "\(.key)=\(.value)"')
# assuming `cf create-user-provider-service foo-service -p '{"MY_VAR":"foo"}'` and bound
echo $MY_VAR # => foo

RaspberryPi Router

Useful for a devstack vm

brctl addbr br0
brctl addif br0 eth1 eth2

cat <<EOF > /etc/network/interfaces
source-directory /etc/network/interfaces.d
Verifying that "micahyo.id" is my Blockstack ID. https://onename.com/micahyo
@micahyoung
micahyoung / cf-one-liner.sh
Last active December 12, 2018 18:44
Twitter-length CF one-line webserver
cf push 1L -c 'while :; do echo -e "HTTP/1.1 200 OK\n\n42" | nc -l $PORT; done' -b binary_buildpack -p $(dirname $(mktemp $(mktemp -d)/XXX))
# * Cross platform (run from MacOS + Linux)
# * Container needs only 5M RAM