Skip to content

Instantly share code, notes, and snippets.

@tiejunhu
tiejunhu / docker.py
Last active August 12, 2019 09:02
用于在墙内下载docker.io和k8s.gcr.io的镜像,镜像服务由 http://mirror.azure.cn/ 提供。脚本会自动将输入的镜像名称转换为正确的镜像下载地址,下载后再tag为正确的镜像名称。支持的镜像名称规范可以看下面28行开始的usage()函数。
#!/usr/bin/python
# coding=utf8
import os
import sys
DEFAULT_DOCKER_HUB_URL = "docker.io"
GCR_URL = "k8s.gcr.io"
mirror_map = {
@tiejunhu
tiejunhu / generate_dnsmasq_chinalist.sh
Created March 8, 2017 02:17
A sript which auto-downloads newest dnsmasq-china-list and add ipset rules to the config file.
#!/bin/ash
# Name: generate_dnsmasq_chinalist.sh
# Desription: A script which auto-download newest dnsmasq-china-list and add ipset rules to the config file.
# Version: 2017-01-30
# Author: Cokebar Chi
# Website: https://gist.github.com/cokebar
usage() {
cat <<-EOF
@tiejunhu
tiejunhu / whitelist.pac
Last active November 29, 2015 15:56 — forked from janlay/whitelist.pac
A white-list based PAC.
/*
* A white-list based PAC without regexp, by @janlay
* It's just simple and fast.
* Last update: Oct 20, 2015
* Special thanks to @Paveo
*/
function FindProxyForURL(url, host) {
// REPLACE PROXY WITH YOUR OWN'S
var PROXY = "SOCKS 127.0.0.1:1080;SOCKS5 127.0.0.1:1080;PROXY 127.0.0.1:8888";
var BLACKHOLE = "127.0.0.2";
@tiejunhu
tiejunhu / gist:3423848
Created August 22, 2012 08:49
git mirror test
# init a repo
mkdir repo
cd repo
git init --bare .
# make init commit
cd ..
git clone repo work
cd work
echo "test" > readme.txt
@tiejunhu
tiejunhu / split_bootimg.pl
Created February 15, 2012 02:10
updated split_bootimg.pl that outputs base address of boot.img
#!/usr/bin/perl
######################################################################
#
# File : split_bootimg.pl
# Author(s) : William Enck <enck@cse.psu.edu>
# Description : Split appart an Android boot image created
# with mkbootimg. The format can be found in
# android-src/system/core/mkbootimg/bootimg.h
#
# Thanks to alansj on xda-developers.com for