Skip to content

Instantly share code, notes, and snippets.

qemu-system-x86_64 \
-hda your_image_file.img \
-enable-kvm \
-m 2048 \
-net nic \
-net user,hostfwd=tcp::2222-:22 \
-virtfs local,path=/path/to/shared/folder,mount_tag=hostshare,security_model=mapped-xattr,id=hostshare \
-device virtio-9p-pci,fsdev=hostshare,mount_tag=hostshare
@zzsnzmn
zzsnzmn / code.py
Last active July 5, 2020 18:56
ddr
# CircuitPython demo - Keyboard emulator
import time
import board
import digitalio
import usb_hid
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
from adafruit_hid.keycode import Keycode
@zzsnzmn
zzsnzmn / NOTES.md
Created July 31, 2018 01:09
istio stuff

Request routing This task will first direct all incoming traffic for the Bookinfo application to the v1 version of the reviews service. It will then send traffic only from a specific test user to version v2, leaving all other users unaffected.

Fault injection We will now use Istio to test the resiliency of the Bookinfo application by injecting an artificial delay in requests between the reviews:v2 and ratings services. Observing the resulting behavior as the test user, we will notice that the v2 version of the reviews service has a bug. Note that all other users are unaware of this testing against the live system.

Traffic Shifting Finally, we will use Istio to gradually migrate traffic for all users from to a v3 version of the reviews service, one which includes the fix for the bug discovered in v2.

@zzsnzmn
zzsnzmn / prepare_pxetools
Last active March 14, 2018 21:23
Set up PXE Booting on a Raspberry Pi
#!/bin/bash
set -e
sudo apt-get install -y python3 python3-pip ipcalc
sudo pip3 install tabulate
# Get network info
NAMESERVER=$(cat /etc/resolv.conf | grep nameserver | head -n 1 | cut -d " " -f2)
GATEWAY=$(ip -4 route | grep default | head -n 1 | cut -d " " -f3)
/* issues
- preset save blip with internal timer vs ext trig
*/
#include <stdio.h>
// asf
#include "delay.h"
@zzsnzmn
zzsnzmn / main.py
Last active January 2, 2018 23:42
Decrypt a KMS Encrypted SES Email in Python3
from base64 import b64decode
import json
import boto3
from Crypto.Cipher import AES
s3 = boto3.resource('s3')
kms = boto3.client('kms')
def get_email(bucket, key):
obj = s3.Object(bucket, key).get()
Run flash.sh to load up the whitewhale firmware
---
- hosts: localhost
tasks:
- shell: bash -lc "ansible-playbook yo_dog.yml"

uses second file

ansible-playbook playbook.yml

uses cli var

ansible-playbook playbook.yml -e foo=cli_variable

ansible-playbook playbook.yml -e 'first_run=True'