Skip to content

Instantly share code, notes, and snippets.

View tai271828's full-sized avatar

Taihsiang Ho tai271828

View GitHub Profile
@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 / 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 / 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 / maas-access-metadata-api.py
Last active September 21, 2018 15:38
Access MaaS metadata API by querying credential first
#!/usr/bin/env python3
#
# cat /proc/cmdline
#
# to know the content of the option cloud-config-url to get preseed by curl
# and then fill in the following variables
#
# Finally, use the output in the following command:
# curl -H '<output>' <endpoint>
#
@tai271828
tai271828 / README.md
Created September 20, 2018 15:38 — forked from smoser/README.md
MAAS and curtin debug

Debugging curtin from within MAAS

Deploying a node with MAAS cli

You can deploy a node with the maas cli which is often preferable to clicking a button on a web UI.

$ SYSTEM_ID=node-787b19d8-d25c-11e4-9f9e-00163eca91de
$ NAME="random-nodename"
$ MAASNAME="maaslocal"

$ maas $MAASNAME machine allocate "name=$NAME"

@tai271828
tai271828 / README.md
Last active October 2, 2020 13:24
Prepare SOLVCON development environment

solvcon-sdk - SOLVCON Development Kits

@tai271828
tai271828 / diff_image.py
Last active August 28, 2018 10:28
Diff two images to tell if they are the same
#!/usr/bin/env python3
# Copyright 2018 Canonical Ltd.
# Written by:
# Taihsiang Ho <[email protected]>
#
# Original source written by Sylvain Pineau <[email protected]>:
# https://git.launchpad.net/plainbox-provider-sru/tree/bin/screenshot_validation
#
# opencv-python >= 3.4.2.17
#
@tai271828
tai271828 / duration.py
Last active August 28, 2018 07:38
Dump duration information from a submission.json
#!/usr/bin/env python3
#
# Usage:
# ./this-script <your-submission-json> [your-output-csv]
#
#
import csv
import sys
import json
import datetime
@tai271828
tai271828 / list-fonts.py
Last active August 7, 2018 11:17
List available system and matplotlib fonts to see which font is available to matplotlib
#!/usr/bin/env python3
from matplotlib.font_manager import FontManager
import subprocess
fm = FontManager()
mat_fonts = set(f.name for f in fm.ttflist)
output = subprocess.check_output(
'fc-list :lang=zh -f "%{family}\n"', shell=True)
output = output.decode('utf-8')
zh_fonts = set(f.split(',', 1)[0] for f in output.split('\n'))
available = mat_fonts & zh_fonts
@tai271828
tai271828 / split_ttc_font_to_ttf.py
Created August 4, 2018 08:06 — forked from yrcjaya/split_ttc_font_to_ttf.py
Convert font TTC to TTF
"""Convert TTC font to TTF using fontforge with python extension.
**Warning** The scripts saves splitted fonts in the current working directory.
Usage:
split_ttc_font_to_ttf.py Droid.ttc
Preinstallation: apt-get install python-fontforge
"""
import sys