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_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 / filter-geo-location.conf
Last active June 8, 2023 15:41
Logstash sample configuration files
filter {
mutate {
rename => { "lon" => "location" }
merge => { "location" => "lat" }
}
mutate {
convert => { "location" => "float" }
remove_field => ["lat"]
}
date {
@tankhuu
tankhuu / jupyterlab_shortcuts.md
Created June 4, 2023 02:35 — forked from discdiver/jupyterlab_shortcuts.md
Common Jupyter Lab Keyboard Shortcuts

If you are on a Mac, substitute command for control. Don't type the + (it means press both keys at once).

Shortcuts when in either command mode (outside the cells) or edit mode (inside a cell):

  • Shift + Enter run selected cell or cells - if no cells below, insert a code cell below

  • Ctrl + B toggle hide/show left sidebar

  • Ctrl + S save and checkpoint

  • Ctrl + Shift + S save as

@tankhuu
tankhuu / install.md
Created November 3, 2022 08:38 — forked from Ryanb58/install.md
How to install telnet into a alpine docker container. This is useful when using the celery remote debugger in a dev environment.
>>> docker exec -it CONTAINERID /bin/sh
/app # telnet
/bin/sh: telnet: not found

/app # apk update
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
v3.7.0-243-gf26e75a186 [http://dl-cdn.alpinelinux.org/alpine/v3.7/main]
v3.7.0-229-g087f28e29d [http://dl-cdn.alpinelinux.org/alpine/v3.7/community]
@tankhuu
tankhuu / Install Font MesloLGS NF.md
Last active September 8, 2022 16:32
ZSH + Oh my ZSH + Power10k

The most common thing of using ZSH + Power10k is the pretty icons

But in most of case, we can't see them because of font

For VSCode or Unbutu Terminal in Windows

Good way is to install FMesloLGS NF font & change it to that

Follow guide from here:

@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
@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 / 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
# Source From: https://www.jeremydaly.com/access-aws-vpc-based-elasticsearch-cluster-locally/
# You need to have an EC2 instance running in the same VPC as your Elasticsearch cluster.
# If you don’t, fire up a micro Linux instance with a secure key pair.
# NOTE: Make sure your instance’s security group has access to the Elasticsearch cluster and
# that your Elasticsearch cluster’s access policy uses the “Do not require signing request with IAM credential” template.
# At local Client
## Create SSH Tunnel
cat << EOF > ~/.ssh/config
# Elasticsearch Tunnel
# 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