Skip to content

Instantly share code, notes, and snippets.

View dochang's full-sized avatar

Wade Zhang dochang

View GitHub Profile
@dochang
dochang / Dockerfile
Last active June 3, 2016 19:08
Build golang in alpine:3.4 Docker container
FROM alpine:3.4
ENV GOLANG_VERSION 1.6.2
ENV GOLANG_SRC_URL https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz
ENV GOLANG_SRC_SHA256 787b0b750d037016a30c6ed05a8a70a91b2e9db4bd9b1a2453aa502a63f1bccc
ENV GOLANG_BOOTSTRAP_VERSION 1.4.3
ENV GOLANG_BOOTSTRAP_URL https://golang.org/dl/go$GOLANG_BOOTSTRAP_VERSION.src.tar.gz
ENV GOLANG_BOOTSTRAP_SHA1 486db10dc571a55c8d795365070f66d343458c48
@dochang
dochang / regex_escape.py
Created May 17, 2016 09:02
A backported filter plugin for Ansible 1.9.x. Put it into `filter_plugins`.
import re
def regex_escape(string):
'''Escape all regular expressions special characters from STRING.'''
return re.escape(string)
class FilterModule(object):
'''Backported Ansible 2 filters for Ansible 1.9.x'''
def filters(self):
@dochang
dochang / # lnav - 2016-04-12_02-25-41.txt
Created April 11, 2016 18:26
lnav on x86_64-linux-gnu - Homebrew build logs
Homebrew build logs for lnav on x86_64-linux-gnu
Build date: 2016-04-12 02:25:41
@dochang
dochang / # lnav - 2016-04-12_01-22-42.txt
Created April 11, 2016 17:23
lnav on x86_64-linux-gnu - Homebrew build logs
Homebrew build logs for lnav on x86_64-linux-gnu
Build date: 2016-04-12 01:22:42
@dochang
dochang / # lnav - 2016-04-11_15-01-26.txt
Created April 11, 2016 07:02
lnav on x86_64-linux-gnu - Homebrew build logs
Homebrew build logs for lnav on x86_64-linux-gnu
Build date: 2016-04-11 15:01:26
@dochang
dochang / # lnav - 2016-04-07_16-39-08.txt
Created April 7, 2016 09:15
lnav on x86_64-linux-gnu - Homebrew build logs
Homebrew build logs for lnav on x86_64-linux-gnu
Build date: 2016-04-07 16:39:08
StoreDir: /nix/store
WantMassQuery: 0
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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 3 of the License, or
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, ZHANG Weiyi <dochang@gmail.com>
#
# This module 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 3 of the License, or
# (at your option) any later version.
#
# (c) 2016, ZHANG Weiyi <dochang@gmail.com>
#
# This file is NOT part of Ansible
from __future__ import (absolute_import, division, print_function)
__metaclass_ = type
import subprocess
from ansible.errors import AnsibleError
from ansible.plugins.lookup import LookupBase