Skip to content

Instantly share code, notes, and snippets.

View ozbillwang's full-sized avatar
:octocat:

Bill Wang ozbillwang

:octocat:
View GitHub Profile
@ozbillwang
ozbillwang / github_repo.py
Created December 11, 2016 03:36 — forked from toast38coza/github_repo.py
An Ansible module for managing github repos
#!/usr/bin/python
DOCUMENTATION = '''
---
module: github_repo
short_description: Manage your repos on Github
'''
EXAMPLES = '''
- name: Create a github Repo
@ozbillwang
ozbillwang / merge_locales.rb
Created October 18, 2016 03:15 — forked from branch14/merge_locales.rb
Interactively merge several YAML files into one
#!/usr/bin/env ruby
#
# synopsis
#
# ruby merge_locales.rb config/locales translations.yml
require 'yaml'
require 'rubygems'
require 'highline/import'
@ozbillwang
ozbillwang / screen-stuff.md
Created July 14, 2016 23:50 — forked from gesellix/screen-stuff.md
screen and Docker for Mac
screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty



screen -AmdS docker ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
screen -r docker
# enter, then disconnect with Ctrl-a d
screen -S docker -p 0 -X stuff $(printf root\\r\\n)
screen -r docker
@ozbillwang
ozbillwang / example.yaml
Created May 19, 2016 05:23 — forked from mrbanzai/example.yaml
Hiera lookup module for Ansible
---
- name: Load NRPE variables from Hiera
connection: local
hiera: path=lib/hiera/bin/hiera key="{{ item.value }}" fact="{{ item.key }}" source=hiera.yaml
args:
context:
environment: "{{ environment }}"
sitecode_lc: "{{ sitecode_lc }}"
with_dictionary:
nrpe_server_port: "nrpe_server_port"
@ozbillwang
ozbillwang / setup openvpn on centos 6.md
Last active June 7, 2020 13:39
setup openvpn on centos 6 - Where is easy-rsa 2.0?
@ozbillwang
ozbillwang / ask.sh
Created March 14, 2016 03:34
Bash: General-purpose Yes/No prompt function ("ask")
# This is a general-purpose function to ask Yes/No questions in Bash, either
# with or without a default answer. It keeps repeating the question until it
# gets a valid answer.
ask() {
# http://djm.me/ask
while true; do
if [ "${2:-}" = "Y" ]; then
prompt="Y/n"
@ozbillwang
ozbillwang / gist:1533bba1dcd66747d3f9
Created March 8, 2016 00:47 — forked from ahonor/gist:1006584
job run example via curl
#!/bin/bash
#!/bin/bash
#Utility to log into the RunDeck server and store cookie file for later use
errorMsg() {
echo "$*" 1>&2
}
@ozbillwang
ozbillwang / filebeat.md
Last active February 2, 2016 07:06
filebeat
Installing nokogiri 1.6.7.2 with native extensions
libxml2 version 2.6.21 or later is required!

Solution:

brew install libxml2
bundle config build.nokogiri "--use-system-libraries --with-xml2-include=/usr/local/opt/libxml2/include/libxml2"
bundle install
@ozbillwang
ozbillwang / connect_ec2.md
Last active December 8, 2015 23:21
Easy way to connect to ec2 instance in office behind proxy and at home

AWS ec2 instances normally have both public DNS name and public IP address. We can wisely use them for office environment which may behind proxy and directly connect from home.

Set below code in .ssh/config and enjoy convenience.

Suppose the instance has name as

ec2-54-252-146-85.ap-southeast-2.compute.amazonaws.com
54.252.146.85

So you can set as below

@ozbillwang
ozbillwang / How to run use "cloudformation-ruby-dsl" to generate cloudformation template.md
Last active October 21, 2015 00:37
How to run use "bazaarvoice/cloudformation-ruby-dsl" to generate cloudformation template

I was recommended to use github repository bazaarvoice/cloudformation-ruby-dsl to generate cloudformation template. But its README is not good enough.

Here are the steps on how to use it on my mac with bundler

$ git clonehttps://github.com/bazaarvoice/cloudformation-ruby-dsl.git
$ cd cloudformation-ruby-dsl
$ bundle install
$ bundle exec rake -T
rake build          # Build cloudformation-ruby-dsl-1.0.4.gem into the pkg directory
rake install        # Build and install cloudformation-ruby-dsl-1.0.4.gem into system gems