Skip to content

Instantly share code, notes, and snippets.

@tiejunhu
tiejunhu / docker.py
Last active Aug 12, 2019
用于在墙内下载docker.io和k8s.gcr.io的镜像,镜像服务由 http://mirror.azure.cn/ 提供。脚本会自动将输入的镜像名称转换为正确的镜像下载地址,下载后再tag为正确的镜像名称。支持的镜像名称规范可以看下面28行开始的usage()函数。
View docker.py
#!/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 Mar 8, 2017
A sript which auto-downloads newest dnsmasq-china-list and add ipset rules to the config file.
View generate_dnsmasq_chinalist.sh
#!/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 Nov 29, 2015 — forked from janlay/whitelist.pac
A white-list based PAC.
View whitelist.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";
View gist:3423848
# 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 Feb 15, 2012
updated split_bootimg.pl that outputs base address of boot.img
View split_bootimg.pl
#!/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