Skip to content

Instantly share code, notes, and snippets.

View tai271828's full-sized avatar

Tai Ho tai271828

View GitHub Profile
@tai271828
tai271828 / README.md
Last active November 17, 2020 14:36
cookbook-virt-inst - for example creating a KVM domain to boot from PXE by default via virt-inst

Cookbook of virt-install

cookbook-virt-inst

@tai271828
tai271828 / README.md
Created October 13, 2018 02:25 — forked from smoser/README.md
Curtin install in a vm with tools/launch

curtin install with launch

Curtin has a test suite named vmtest. It has loads of configs for installation that put curtin through a battery. As of this writing it runs 192 installations on amd64 covering all supported ubuntu releases. It runs nightly under jenkins. See example results in the curtin-vmtest-devel-amd64 job.

If you're interested just a general use of curtin without starting a VM, see another article 'Curtin Development on uvt-kvm'.

@tai271828
tai271828 / de-re-compress-cosmic-initrd.sh
Created November 21, 2018 01:21
decompress and recompress the initrd image of Ubuntu Cosmic
#!/bin/bash
#sudo apt-get install binwalk
# $ binwalk initrd
#
#DECIMAL HEXADECIMAL DESCRIPTION
#--------------------------------------------------------------------------------
#0 0x0 ASCII cpio archive (SVR4 with no CRC), file name: ".", file name length: "0x00000002", file size: "0x00000000"
#112 0x70 ASCII cpio archive (SVR4 with no CRC), file name: "kernel", file name length: "0x00000007", file size: "0x00000000"
@tai271828
tai271828 / Vagrantfile
Created December 19, 2018 06:46
A Vagrantfile to build images in a Ubuntu Xenial box
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@tai271828
tai271828 / bootstrap.sh
Last active February 7, 2019 14:40
Bootstrap charm-tools development environment with SGE-cluster charms as an example
#!/bin/bash
#
# Author: Taihsiang Ho (tai271828) <tai271828@gmail.com>
#
# You could build the development env for charm-tools
# Usage example:
# $ lxc launch ubuntu:16.04 charm-tool-dev-16-04
# $ lxc exec charm-tool-dev-16-04 bash
# $ ./bootstrap.sh
# # in charm-tools folder
@tai271828
tai271828 / reactor.py
Created March 30, 2019 03:12 — forked from jpanganiban/reactor.py
A Very Simple Reactor Pattern Implementation in Python (with Gevent)
#!/usr/bin/env python
from gevent import monkey
monkey.patch_all() # Patch everything
import gevent
import time
class Hub(object):
"""A simple reactor hub... In async!"""
@tai271828
tai271828 / min_avg_subarray_v1.py
Last active July 9, 2019 13:51
Demo code to find the min average value from the subset of a positive integer set.
#!/usr/bin/env python3
#
# Author: Taihsiang Ho (tai271828) tai271828@gmail.com
#
# Given an positive integer set Xi. The length of the set is n.
# Given arbitrary a and b, and 1 <= a < b <= n.
# Find the minimum average number, which is
# sigma(i=a to b) Xi / (b - a + 1)
#
#
@tai271828
tai271828 / syscall.c
Created January 29, 2020 16:48
System calls
/*
* Description: output/input strings from stdout/stdin over Lunux system call
*
* Author: Taihsiang Ho (tai271828)
*
* Usage: gcc -g --static syscall.c
*
* Original source: shiwulo's os hw 3
*
* Also refer to the system call summary of Linux:
@tai271828
tai271828 / grub.cfg
Created April 9, 2020 18:52
A grub menu to boot Ubuntu Focal arm server version beta image via netboot
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
if background_color 44,0,30,0; then
clear
fi
insmod gzio
set timeout=5
menuentry "Install Ubuntu Server (Focal Beta) (Pull the iso from web)" {
@tai271828
tai271828 / 00-run-all.sh
Last active July 6, 2020 07:14
Re-deploy the whole openstack model with juju tool chain (openstack-base-testing-toolbox)
#!/bin/bash
# remember to activate your python openstack venv first
echo "============= START: Begin to deploy the whole stack... ==============="
time ./01-re-deploy.sh
echo "============= DONE: Deployed the whole stack. ========================="
echo "============= START: Begin to test the whole stack... ================="
time ./02-basic-test-just-deployed.sh
echo "============= DONE: Tested the whole stack. ========================="