Skip to content

Instantly share code, notes, and snippets.

View binhqd's full-sized avatar

Binh Quan binhqd

  • Green Global IT Solutions
View GitHub Profile
@binhqd
binhqd / install-elasticsearch-doc-manager.sh
Last active January 19, 2018 06:46
Setup mongo to elasticsearch connector
yum install java-1.8.0-openjdk
@binhqd
binhqd / Install Tomcat 9 & Maven
Last active January 26, 2018 02:03
Setup Tomcat 9
# Verify Java 8
# Get Tomcat 9.0.4 source
wget http://mirror.downloadvn.com/apache/tomcat/tomcat-9/v9.0.4/bin/apache-tomcat-9.0.4.tar.gz
tar -xvf apache-tomcat-9.0.4.tar.gz
mv apache-tomcat-9.0.4 tomcat9
# Configure Environment Variables
echo "export CATALINA_HOME="/opt/tomcat9"" >> /etc/environment
echo "export JAVA_HOME="/usr/lib/jvm/java-8-oracle"" >> /etc/environment
@binhqd
binhqd / webpack.config.js
Created February 28, 2018 02:13
Add error-tracker.js to your webpack config
var path = require('path');
var webpack = require('webpack');
var WebpackStrip = require('webpack-strip');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
const ENV = process.env.NODE_ENV || 'development';
var config = {
context: path.join(__dirname),
let airbrakeJs = require('airbrake-js');
let StackTrace = require('stacktrace-js');
import {
TRACKER_URL,
ENV
} from 'constants/config';
// handling all window errors
let airbrake = new airbrakeJs({
@binhqd
binhqd / get-api-response-time.py
Last active February 28, 2018 08:56
Script for getting API response time in second
#!/usr/bin/python
import requests
import sys
import uuid
SCHEMA=sys.argv[1]
ORIGIN=sys.argv[2]
API_HOST=sys.argv[3]
URI=sys.argv[4]
* What went wrong:
A problem occurred configuring project ':app'.
> The SDK directory '$HOME/Android/Sdk' does not exist.

Fix with:

export ANDROID_HOME=$HOME/Android/Sdk/
@binhqd
binhqd / image-fit-container.js
Created March 27, 2018 04:28
React Native image fit to container
<Image style={styles.bgContainer} resizeMode='cover' source={require('./img/bg.png')} />
const styles = StyleSheet.create({ bgContainer: { flex:1, width: null, height: null } });
@binhqd
binhqd / firebase rules
Created April 16, 2018 04:22
Setup Firebase on React Native
service cloud.firestore {
match /databases/{database}/documents {
match /todos/{document=**} {
allow read, write: if true;
}
}
}
@binhqd
binhqd / remove-java-ubuntu.sh
Last active April 17, 2018 04:04
Completely remove Java
# Remove all the Java related packages (Sun, Oracle, OpenJDK, IcedTea plugins, GIJ):
dpkg-query -W -f='${binary:Package}\n' | grep -E -e '^(ia32-)?(sun|oracle)-java' -e '^openjdk-' -e '^icedtea' -e '^(default|gcj)-j(re|dk)' -e '^gcj-(.*)-j(re|dk)' -e '^java-common' | xargs sudo apt-get -y remove
sudo apt-get -y autoremove
# Purge config files (careful. This command removed libsgutils2-2 and virtualbox config files too):
dpkg -l | grep ^rc | awk '{print($2)}' | xargs sudo apt-get -y purge
# Remove Java config and cache directory:
sudo bash -c 'ls -d /home/*/.java' | xargs sudo rm -rf
keytool -genkey -alias quangnam -keyalg RSA -keysize 2048 -keystore quangnam.jks -dname "CN=localhost,OU=Home,O=Home,L=SL,S=WS,C=LK" -storepass quangnam -keypass quangnam