This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias vagrant-destroy='vagrant halt ; vagrant destroy --force' | |
_ansible_as_sudo_internal() { | |
local user="$1" | |
local host_pattern="$2" | |
shift | |
shift | |
ANSIBLE_HOST_KEY_CHECKING=false ansible "$host_pattern" \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* load all Node.js (including Express) route definitions. | |
* in most cases you should only need to modify the app_routes[] array. | |
* | |
* inspired by the article: | |
* - http://stackoverflow.com/questions/5778245/expressjs-how-to-structure-an-application | |
* | |
* @author William Yeh <william.pjyeh@gmail.com> | |
* @date 2014-04-09 | |
* @license MIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
MONGODB_NAME=$1 | |
MONGODB_PASS=$2 | |
MONGODB_HOST=$3 | |
MONGODB_PORT=${4:-27017} | |
if [ $# -lt 3 ]; then | |
echo "Simple tool to enable MongoDB balancer." | |
echo "Usage: enable-mongodb-balancer.sh username password host [port]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
MONGODB_NAME=$1 | |
MONGODB_PASS=$2 | |
MONGODB_HOST=$3 | |
MONGODB_PORT=${4:-27017} | |
if [ $# -lt 3 ]; then | |
echo "Simple tool to disable MongoDB balancer." | |
echo "Usage: disable-mongodb-balancer.sh username password host [port]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
MONGODB_NAME=$1 | |
MONGODB_PASS=$2 | |
MONGODB_HOST=$3 | |
MONGODB_PORT=${4:-27017} | |
if [ $# -lt 3 ]; then | |
echo "Simple tool to db.fsyncLock() on MongoDB." | |
echo "Usage: lock-mongodb.sh username password host [port]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
MONGODB_NAME=$1 | |
MONGODB_PASS=$2 | |
MONGODB_HOST=$3 | |
MONGODB_PORT=${4:-27017} | |
if [ $# -lt 3 ]; then | |
echo "Simple tool to db.fsyncUnlock() on MongoDB." | |
echo "Usage: unlock-mongodb.sh username password host [port]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
=pod | |
SUMMARY: A simple tool to query the IP ranges for GCE zones. | |
REFERENCE: http://stackoverflow.com/a/19434481 | |
LICENSE: released to public domain. | |
AUTHOR: William Yeh <william.pjyeh@gmail.com> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
VAGRANTFILE_API_VERSION = "2" | |
# | |
# provision script; pull Docker image | |
# | |
docker_image = "busybox" | |
$script = <<SCRIPT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# fix some errors of 'units.dic' file in common mmseg packages | |
# | |
# URL: https://gist.github.com/William-Yeh/95f7dd1a60242f7d5b62 | |
# | |
# @ref https://github.com/kuan-ming/concise-core/blob/master/src/org/sustudio/concise/core/mmseg/dictionary/units.dic | |
# @ref https://github.com/medcl/elasticsearch-rtf/blob/master/config/mmseg/units.dic | |
# | |
#---------- | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Extract a range of lines from stdin and print to stdout. | |
# | |
# Usage: | |
# | |
# head2tail.sh starting-line [number-of-lines] | |
# | |
# Example: | |
# |
OlderNewer