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
@tankhuu
tankhuu / amazon_linux_install_varnish4.1.10.sh
Created December 12, 2018 10:13
Amazon Linux Install Varnish 4.1.10
sudo yum -y install autoconf automake jemalloc-devel libedit-devel libtool ncurses-devel pcre-devel pkgconfig python-docutils python-sphinx graphviz
curl -s https://packagecloud.io/install/repositories/varnishcache/varnish41/script.rpm.sh | sudo bash
wget --content-disposition https://packagecloud.io/varnishcache/varnish41/packages/el/6/varnish-4.1.10-1.el6.x86_64.rpm/download.rpm
sudo rpm -Uvh varnish-4.1.10-1.el6.x86_64.rpm
/usr/sbin/varnishd -V
@tankhuu
tankhuu / rfm_analysis.js
Created December 17, 2018 04:01
RFM Analysis in NodeJS
import {Meteor} from 'meteor/meteor';
import {check, Match} from 'meteor/check';
import moment from 'moment';
import bodybuilder from 'bodybuilder';
import {Promise} from 'meteor/promise';
import RequestPromise from 'request-promise';
import _ from 'lodash';
/* Collections */
import {RFMScoreBoard, RFMTopTen} from '/imports/api/collections/rfm';
@tankhuu
tankhuu / react_app_initiation.md
Last active December 18, 2018 15:56
React Application Initiation
@tankhuu
tankhuu / amazon_linux_install_goaccess.sh
Created January 15, 2019 11:57
Install GoAccess - real-time web log analyzer in Amazon Linux
sudo yum install ncurses-devel geoip-devel libmaxminddb-devel tokyocabinet-devel openssl-devel
wget https://tar.goaccess.io/goaccess-1.3.tar.gz
tar -xzvf goaccess-1.3.tar.gz
cd goaccess-1.3/
./configure --enable-utf8 --enable-geoip=legacy
make
sudo make install
# Run
# goaccess /var/log/nginx/access.log -c
@tankhuu
tankhuu / kill_long_run_query_on_rds_by_percona_toolkit.sh
Created July 2, 2019 04:22
Kill Long Run Query on AWS RDS by Percona-Tookit
sudo yum install https://repo.percona.com/yum/percona-release-latest.noarch.rpm
sudo yum -y install percona-toolkit
@tankhuu
tankhuu / amz2-install-apache-airflow.sh
Last active July 29, 2019 15:16
MorphL Installation
sudo yum install -y python3 python3-devel python3-pip gcc gcc-c++ git
python3 -V
sudo pip3 install apache-airflow[jdbc,s3,slack,oracle,postgres,ssh]
sudo pip3 install flask
airflow initdb
mkdir github
cd github/
git clone https://github.com/apache/airflow.git
sudo cp -p airflow/scripts/systemd/airflow-*.service /usr/lib/systemd/system
sudo cp -p airflow/scripts/systemd/airflow.conf /usr/lib/tmpfiles.d/
# Install JDK 8
wget https://s3-ap-southeast-1.amazonaws.com/software/jdk-8u212-linux-x64.rpm
sudo rpm -Uvh jdk-8u221-linux-x64.rpm
java -version
# Setup Apache Druid
## Download druid
wget http://mirror.downloadvn.com/apache/incubator/druid/0.15.0-incubating/apache-druid-0.15.0-incubating-bin.tar.gz
tar -xzf apache-druid-0.15.0-incubating-bin.tar.gz
## Download Zookeeper
environment {
FULL_PATH_BRANCH = "${sh(script:'git name-rev --name-only HEAD', returnStdout: true)}"
GIT_BRANCH = FULL_PATH_BRANCH.substring(FULL_PATH_BRANCH.lastIndexOf('/') + 1, FULL_PATH_BRANCH.length())
}
# Situation
aws s3 cp --recursive . s3://bucket_name/
# Command run success but the exit code is 1
# Reason is because there are some upload failed, most of them failed cause the file is empty
`seek() takes 2 positional arguments but 3 were given`
==> This is because we are trying to upload an empty file and the awscli we are using is installed from ubuntu repository by
apt install awscli (https://github.com/aws/aws-cli/issues/2583)
# Solution
# Uninstall current awscli
@tankhuu
tankhuu / InstallPlugins
Last active August 31, 2022 15:38
Jenkins Utilities
# Install Plugins from file
jenkins-plugin-cli --plugin-file /usr/share/jenkins/ref/plugins.txt