Skip to content

Instantly share code, notes, and snippets.

View tai271828's full-sized avatar

Taihsiang Ho tai271828

View GitHub Profile
#!/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 / 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
@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
#!/bin/bash
#
# A simple script tool to change the deb of kernel images.
#
#
function usage() {
local usage="Usage: `basename $0` [-t target_kernel_version] [-i increment] [-d decrement] [--dry --dryrun]"
echo $usage
exit
}
@tai271828
tai271828 / rtc.c
Last active January 31, 2018 13:43
Simplified MC146818 RTC Linux driver
/*
* RTC class driver for "CMOS RTC": PCs, ACPI, etc
*
* Copyright (C) 1996 Paul Gortmaker (drivers/char/rtc.c)
* Copyright (C) 2006 David Brownell (convert to new framework)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
@tai271828
tai271828 / virsh-batch-start-vm.py
Created November 24, 2017 06:48
Batch start vm by virsh
#!/usr/bin/env python
#
# Batch start vm by virsh
#
# usage:
# ./virsh-batch-start-vm.py <domain1> [<domain2> ... <domainN>]
#
#
import sys
@tai271828
tai271828 / txt2sql.py
Created November 3, 2017 12:04
Convert my libreoffice dumped csv to another csv ready to be imported by mysql
#!/usr/bin/python3
import csv
import pprint
import sys
def fill_null_value(input, filler="\\N"):
"""
Replace empty elements of input by a filler.
@tai271828
tai271828 / .gitignore
Last active October 12, 2018 18:25
Create Curtin development environment in a quick way
serial.log
@tai271828
tai271828 / campsaver.py
Last active October 9, 2018 08:33
A campsaver crawler to watch the price of the commodity you want to have
#!/usr/bin/env python3
#
# Copyright 2017, Taihsiang Ho <[email protected]>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
@tai271828
tai271828 / dump-module-dep.py
Last active August 15, 2017 09:35
Dump dot file by using modulegraph. It trims unwanted modules in the graph.
#!/usr/bin/env python3
#
# Author: Taihsiang Ho (tai271828)
# License: BSD 3-clause
#
# This script uses modulegraph to prepare a Graphviz dot file.
#
# The first positional argument is the target python script to be scanned. The
# result of the optional arguments could refer to the --help.
#