Skip to content

Instantly share code, notes, and snippets.

View dochang's full-sized avatar

Wade Zhang dochang

View GitHub Profile
@dochang
dochang / android-sdk-plugin.gitignore
Last active December 31, 2015 03:49
gitignore for pfn/android-sdk-plugin
# files generated by pfn/android-sdk-plugin
#
# From http://www.scala-sbt.org/release/docs/Getting-Started/Directories.html#configuring-version-control
target/
[Unit]
After=docker.service
[Service]
WorkingDirectory=/var/lib/drone
Environment="DRONED_OPTS=--port=:80"
EnvironmentFile=/etc/default/drone
ExecStart=/bin/sh -c "exec droned $DRONED_OPTS"
ExecStop=/bin/kill $MAINPID
Restart=on-failure
# https://github.com/dotcloud/docker/blob/master/contrib/init/systemd/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=http://docs.docker.com
After=network.target
[Service]
ExecStart=/bin/sh -c 'exec docker -d'
ExecStop=/bin/kill $MAINPID
@dochang
dochang / backup-packages.sh
Last active August 29, 2015 14:05
backup-packages.sh
#!/bin/sh
ARCH=$(dpkg --print-architecture)
for pkg_spec; do
pkg_name=${pkg_spec%%:*}
pkg_arch=${pkg_spec##*:}
if [ "$pkg_name" = "$pkg_arch" ]; then
# no pkg_arch
if dpkg -l ${pkg_name}:all >/dev/null 2>&1; then
@dochang
dochang / gist:60d181c023c0208cbd41
Last active September 18, 2015 15:44
DigitalOcean-Speed-Test
# https://github.com/ZacharyDuBois/DigitalOcean-Speed-Test-CLI
curl -sSL https://i.destroy.tokyo/dostcli | env -u http_proxy -u https_proxy bash -s - 10mb
@dochang
dochang / env.conf
Created November 4, 2015 10:17
/etc/systemd/system/docker.service.d/env.conf
[Service]
EnvironmentFile=-/etc/default/docker
# To modify the ExecStart configuration, specify an empty configuration followed by a new configuration
#
# See:
# - systemd.service(5)
# - http://docs.docker.com/engine/articles/systemd/#custom-docker-daemon-options
ExecStart=
ExecStart=/usr/bin/docker daemon -H fd:// $DOCKER_OPTS
#!/bin/sh
prefix="$(dirname $0)/.."
sharedir="$prefix/share/sshproxy"
key="$sharedir/sshproxy-key"
exec env AUTOSSH_GATETIME=0 autossh -D 9898 -N -i "$key" -l sshproxy "$@"
# (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
#!/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.
#
#!/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