Skip to content

Instantly share code, notes, and snippets.

View zhouqt's full-sized avatar

Tom Zhou zhouqt

  • Canonical, Ltd.
  • Beijing, China
  • 15:52 (UTC +08:00)
View GitHub Profile
#!/usr/bin/env python3
"""
This is a tool for recovering lost machine units in current model
Usage:
{0} model-name dest-dir
"""
# changes summary:
# added logic to prevent overwrite /var/lib/juju to avoid removing non-machine units
@zhouqt
zhouqt / user-data.yaml
Created January 27, 2021 18:47
ubuntu subiquity autoinstall user-data example
#cloud-config
autoinstall:
version: 1
early-commands:
- snap set system proxy.http="http://192.168.122.1:12345"
- snap set system proxy.https="http://192.168.122.1:12345"
locale: en_US
keyboard:
layout: en
variant: us
// ==UserScript==
// @name SFComment
// @namespace http://tampermonkey.net/
// @version 0.11
// @description Workaround negative timecard caused by time drift
// @description Some SF comment window hacks
// @author roylez
// @include https://canonical*.visual.force.com/servlet/servlet.Integration*
// @license MIT
// @require https://code.jquery.com/jquery-2.2.4.min.js
// ==UserScript==
// @name SFreadability-modified
// @namespace http://tampermonkey.net/
// @version 0.751
// @history 0.751 Merge from roylez's version
// @history 0.75 adjust comments section max-width
// @history 0.74 Hightlight last update date fields in case listings
// @history 0.73 Color code last updated time in case listing
// @history 0.721 Add functions to handle console page
// @history 0.72 Add call history tab 2020-03-06 (zhouqt)
@zhouqt
zhouqt / gfw_whitelist.txt
Created May 26, 2016 05:26
gfw_whitelist.txt
!-- wget https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/accelerated-domains.china.conf
!-- for l in `cat accelerated-domains.china.conf`; do echo "||`echo $l|cut -d'/' -f2`" >> gfw_whitelist.txt; done
||0-6.com
||0-gold.net
||00.net
||0000738.com
||0001688.com
||000219.com
||0007.net
||000dn.com
@zhouqt
zhouqt / set_gre_tunnel.sh
Last active January 18, 2023 17:33
Script for create gre tunnel between 2 linux hosts.
#!/bin/sh
# Run this script on inside/outside host:
# * (outside, do NAT job) set_gre_tunnel.sh out inside_host_ip 192.168.123.1
# * (inside) set_gre_tunnel.sh in outside_host_ip 192.168.123.2
function verify_variant() {
var=$1
msg=$2
if [ x$var != x"" ]; then