Skip to content

Instantly share code, notes, and snippets.

View anhtranbk's full-sized avatar

Anh Tran Nhat anhtranbk

View GitHub Profile
@anhtranbk
anhtranbk / firewall-config.sh
Last active December 9, 2016 07:55
Setup flask application with uwsgi and nginx, mysql as database, run on Centos 6.5
#!/bin/sh
# Open port iptables only for CentOS 6
iptables -F
iptables -A INPUT -p tcp --tcp-flags ALL NONE -j DROP
iptables -A INPUT -p tcp ! --syn -m state --state NEW -j DROP
iptables -A INPUT -p tcp --tcp-flags ALL ALL -j DROP
@anhtranbk
anhtranbk / genymotionwithplay.txt
Created December 9, 2016 07:57 — forked from wbroek/genymotionwithplay.txt
Genymotion with Google Play Services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
Google Apps for Android 4.4.4 (https://www.androidfilehost.com/?fid=23501681358544845 - gapps-kk-20140606-signed.zip)
Google Apps for Android 4.3 (https://www.androidfilehost.com/?fid=23060877490000124 - gapps-jb-20130813-signed.zip)
#create a test index with shingle mapping
curl -XPUT localhost:9200/test -d '{
"settings":{
"index":{
"analysis":{
"analyzer":{
"analyzer_shingle":{
"tokenizer":"standard",
"filter":["standard", "lowercase", "filter_stop", "filter_shingle"]
}
@anhtranbk
anhtranbk / fix-genymotion.txt
Created December 9, 2016 08:30
Fix Genymotion 2.8.1 in Ubuntu 14.04 with error `CXXABI_1.3.8' not found
LD_LIBRARY_PATH=/usr/local/lib64/:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.9 g++-4.9
# Upgrading all packages with pip
pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U
@anhtranbk
anhtranbk / config.txt
Last active January 2, 2018 08:31
Setup Elastic Search on server, sample for cluster with 3 nodes
# heap size
ES_HEAP_SIZE=30G
# max file descriptos
# https://www.elastic.co/guide/en/elasticsearch/reference/current/file-descriptors.html
# virtual memory
# https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html
sysctl -w vm.max_map_count=262144
@anhtranbk
anhtranbk / kafka-cli.sh
Last active April 24, 2018 22:38
Using Kafka Command-line Tools
# list topics
kafka-topics.sh --list --zookeeper 192.168.23.64:2181
# describe topic
kafka-topics.sh --describe --zookeeper 192.168.23.64:2181 --topic test
# create, alter topic
kafka-topics.sh --create --zookeeper 192.168.23.64:2181 --topic test --replication-factor 2 --partitions 3
# Read data from a Kafka topic and write it to standard output
@anhtranbk
anhtranbk / cassandra.yaml
Last active September 29, 2017 04:43
My production configuration for Cassandra, Kafka, Presto
cluster_name: 'DataCollection Cluster'
listen_address: 192.168.23.64
rpc_address: 192.168.23.64
native_transport_port: 9042
storage_port: 7000
seed_provider:
- class_name: org.apache.cassandra.locator.SimpleSeedProvider
parameters:
# seeds is actually a comma-delimited list of addresses.
@anhtranbk
anhtranbk / build.gradle
Created July 28, 2017 07:54
Gradle fatJar simple
apply plugin: 'java'
repositories {
mavenCentral()
}
dependencies {
compile 'org.mindrot:jbcrypt:0.3m'
}
@anhtranbk
anhtranbk / hbase-shell.sh
Last active April 9, 2018 10:56
HBase configuration
create 'g3:edges', {NAME => 'cf', COMPRESSION => 'SNAPPY', BLOCKCACHE => 'true', IN_MEMORY => 'true'}, {SPLITS => ['012', '024', '036', '048', '060', '072', '084', '096', '108', '120', '132', '144', '156', '168', '180', '192', '204', '216', '228', '240', '252'], DURABILITY => 'ASYNC_WAL'}