Skip to content

Instantly share code, notes, and snippets.

View tai271828's full-sized avatar

Taihsiang Ho tai271828

View GitHub Profile
@tai271828
tai271828 / cmd
Created April 21, 2018 23:35 — forked from eldondev/cmd
Because everyone needs a good preseed
wget -nc http://ftp.debian.org/debian/dists/jessie/main/installer-amd64/current/images/netboot/debian-installer/amd64/linux
wget -nc http://ftp.debian.org/debian/dists/jessie/main/installer-amd64/current/images/netboot/debian-installer/amd64/initrd.gz
cp -nv ~/.ssh/id_rsa.pub .
qemu-system-x86_64 -machine accel=kvm -kernel linux -initrd initrd.gz -m 1G -smp 2 -append "blacklist=vga16fb fb=false video=false vga=normal auto=true url=http://10.0.2.10:8080/debian-preseed.txt hostname=otto domain=" -net user,guestfwd=:10.0.2.10:8080-cmd:"/bin/busybox httpd -i" -hda /dev/shm/deb.img -net nic -display none
@tai271828
tai271828 / isolinux.cfg
Last active April 23, 2018 07:00
d-i preseed, a lot of them ; )
# D-I config version 2.0
# search path for the c32 support libraries (libcom32, libutil etc.)
path
include menu.cfg
default vesamenu.c32
prompt 0
timeout 1
ui gfxboot bootlogo
#!/bin/bash
#
# Use the existing testflinger-agent production folder
# to duplicate one more testflinger-agent for desktop SRU
#
set +x
# target CID
target_cid=$1
# remove dash from the CID
# juju does not accept dash as a agent name
@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
@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 / 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 / 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 / README.md
Last active October 2, 2020 13:24
Prepare SOLVCON development environment

solvcon-sdk - SOLVCON Development Kits

@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 / 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>
#