Skip to content

Instantly share code, notes, and snippets.

View tankhuu's full-sized avatar

Tan Khuu tankhuu

  • Ho Chi Minh, Viet Nam
View GitHub Profile
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install carthage
cd MacPass
carthage bootstrap --platform macOS
xcodebuild -scheme MacPass -target MacPass -configuration Release CODE_SIGNING_REQUIRED=NO NO_SPARKLE=NO_SPARKLE
# 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
// 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') {
# 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
@tankhuu
tankhuu / amazon_linux_extend_ebs_volume.sh
Last active July 19, 2019 09:59
Amazon Linux Utilities
# Take snapshot of current volume
# Modify volume and Increase Size
# Access into Server that is using this EBS
df -h
sudo growpart /dev/xvdh 1
sudo resize2fs /dev/xvdh1
## Using Dnsmasq for local development on OS X ##
## DNS & DHCP ##
# Installation
# Update your homebrew installation
brew up
# Install dnsmasq
brew install dnsmasq
# Configuration
@tankhuu
tankhuu / boto3
Created October 17, 2017 08:24
Mac Installation Tricks
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)
@tankhuu
tankhuu / create-s3-snapshot-repository.json
Last active September 22, 2017 07:38
Elasticsearch - Tips
PUT _snapshot/s3_repo
{
"type": "s3",
"settings": {
"bucket": "bucket_name",
"base_path": "elasticsearch/snapshots"
}
}
GET /_snapshot/s3_repo
@tankhuu
tankhuu / add-swap.sh
Last active October 4, 2017 11:27
Ubuntu 16.04 - Utilities
# VARIABLES #
swapSize=4G
# EXECUTE #
# Check swap
sudo swapon -s
# Create swapfile
sudo fallocate -l $swapSize /swapfile
sudo chmod 600 /swapfile
ls -lh /swapfile
@tankhuu
tankhuu / setup-aws-scripts-mon.sh
Last active November 22, 2017 12:12
AWS Utilities - Ubuntu 16.04
#!/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 #