This file contains hidden or 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 | |
# There are several options how to provide config to a Docker container during runtime. | |
# The idea is to allow flexibility in environment settings without knowing the application structure and without changing it. | |
# This gist shows how to configure database hostname. | |
# a) Pass as environment variables. | |
# Your script can read it too. |
This file contains hidden or 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
suite 'Constructor binding', -> | |
ConstructorFn = null | |
boundFn = null | |
spy = null | |
teardown -> | |
# cleanup global state after any failed tests | |
delete global.instanceProperty |
This file contains hidden or 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 | |
CONF_FILE=~/.aws/credentials | |
function usage { | |
echo "Export AWS API keys" | |
echo "Will read $CONF_FILE and export the api keys as environment variables" | |
echo "Usage: $0 --profile <profile>" | |
} |
This file contains hidden or 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 | |
TMP_FILE=/tmp/cpuload | |
PNAME="node" | |
tries=0 | |
while [ $tries -lt 100 ] | |
do | |
ps ax -o comm -o %cpu | grep $PNAME | awk '{s+=$2}END{print s}' | tee -a $TMP_FILE | |
sleep 1 |
This file contains hidden or 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
###* | |
@param {String} input | |
@param {number=} length | |
### | |
trimWithWordsPreserve = (input, length = 15) -> | |
if input.length <= length | |
input | |
else | |
regexp = new RegExp '^(.{' + length + '}[^\\s]*).*' | |
shorter = input.replace regexp, '$1' |