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
# Issue 1 - lua script variable convention | |
2017/09/16 03:37:40 [error] 28233#28233: *3524 failed to load external Lua file "/usr/local/openresty/nginx/conf/elasticsearch/authorize.lua": /usr/local/openresty/nginx/conf/elasticsearch/authorize.lua:78: '}' expected (to close '{' at line 54) near 'tankhuu', client: 123.21.100.186, server: , request: "GET / HTTP/1.1", host: "secure.elasticsearch.com" | |
--> Solution: | |
In lua script, if a variable contain the special characters such as tankhuu@gmail.com, we have to cover it with ["tankhuu@gmail.com"] | |
# Issue 2 - missing library | |
2017/09/16 04:34:32 [error] 28996#28996: *6 lua entry thread aborted: runtime error: /usr/local/openresty/nginx/conf/elasticsearch/access.lua:5: module 'resty.http' not found: | |
no field package.preload['resty.http'] | |
no file '/usr/local/openresty/site/lualib/resty/http.ljbc' | |
no file '/usr/local/openresty/site/lualib/resty/http/init.ljbc' |
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
PUT _snapshot/s3_repo | |
{ | |
"type": "s3", | |
"settings": { | |
"bucket": "bucket_name", | |
"base_path": "elasticsearch/snapshots" | |
} | |
} | |
GET /_snapshot/s3_repo |
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
# VARIABLES # | |
swapSize=4G | |
# EXECUTE # | |
# Check swap | |
sudo swapon -s | |
# Create swapfile | |
sudo fallocate -l $swapSize /swapfile | |
sudo chmod 600 /swapfile | |
ls -lh /swapfile |
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
Problem: | |
``` | |
sudo pip install boto3 | |
The directory '/Users/tankhuu/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. | |
The directory '/Users/tankhuu/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. | |
Collecting boto3 | |
Downloading boto3-1.4.7-py2.py3-none-any.whl (128kB) | |
100% |████████████████████████████████| 133kB 837kB/s | |
Collecting s3transfer<0.2.0,>=0.1.10 (from boto3) | |
Downloading s3transfer-0.1.11-py2.py3-none-any.whl (54kB) |
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 bash | |
cat << EOF > ~/setup-aws-scripts-mon.sh | |
#!/usr/bin/env bash | |
# VARIABLES # | |
AWSAccessKeyId=\$1 | |
AWSSecretKey=\$2 | |
CRON_DIR=/var/spool/cron/crontabs | |
# EXECUTE # |
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
## Using Dnsmasq for local development on OS X ## | |
## DNS & DHCP ## | |
# Installation | |
# Update your homebrew installation | |
brew up | |
# Install dnsmasq | |
brew install dnsmasq | |
# Configuration |
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 bash | |
java_base_version="8" | |
java_sub_version="161" | |
java_base_build="12" | |
java_version="${java_base_version}u${java_sub_version}" | |
java_build="b${java_base_build}" | |
java_version_with_build="${java_version}-${java_build}" | |
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=xxx; oraclelicense=accept-securebackup-cookie;" "http://download.oracle.com/otn-pub/java/jdk/${java_version_with_build}/2f38c3b165be4555a1fa6e98c45e0808/jdk-${java_version}-linux-x64.rpm" |
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
# Clone new Project | |
mkdir -p project_folder | |
cd project_folder | |
git init | |
git clone https://user@passwordInUrlEncode@codeCommitGitHttpsURL | |
git fetch | |
# Edit current project | |
cd project_folder |
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
// Function creation && Process Array in Sequence | |
const stopRDSMySQL = async ({DBInstanceIdentifier}) => { | |
try { | |
const rds = new AWS.RDS(); | |
const {DBInstances} = await rds.describeDBInstances({DBInstanceIdentifier}).promise(); | |
const listOfStoppedDBInstances = []; | |
if(!_.isEmpty(DBInstances)) { | |
for(const DBInstance of DBInstances) { | |
const {DBInstanceStatus, DBInstanceIdentifier} = DBInstance; | |
if(DBInstanceStatus === 'available') { |
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
# Referrence: https://gist.github.com/paladini/972d987cc5be189740737a5973eea4a3 | |
# Setup redis-cli without the whole Redis Server on AWS EC2 | |
sudo yum install gcc -y | |
wget http://download.redis.io/redis-stable.tar.gz && tar xvzf redis-stable.tar.gz && cd redis-stable && make && sudo cp src/redis-cli /usr/local/bin/ && sudo chmod 755 /usr/local/bin/redis-cli | |
redis-cli -h 192.268.34.32 |
OlderNewer