Skip to content

Instantly share code, notes, and snippets.

View binhqd's full-sized avatar

Binh Quan binhqd

  • MyNavi Techtus Vietnam
  • 08:43 (UTC +07:00)
View GitHub Profile
* 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 / 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]
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 / 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),
@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 / 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 / gist:80b36e659405b48dbfdb2d778ef6be06
Last active January 5, 2018 04:14
PDF processing with GhostScript
# Export pages with range of a PDF file
s -dNOPAUSE -dBATCH -sDEVICE=png16m -r150 -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -dPDFFitPage -dFirstPage=1 -dLastPage=10 -sOutputFile="Pic-%d.png" ESB-WSO2-Introduction.pdf
# Get total pages of a PDF file
gs -q -dNODISPLAY -c "(abc.pdf) (r) file runpdfbegin pdfpagecount = quit"
@binhqd
binhqd / setup-openresty-1.13.6.sh
Last active January 4, 2018 01:23
Setup OpenResty
# switch to root user
sudo su
# Download openresty 1.13.6
cd /tmp
wget https://openresty.org/download/openresty-1.13.6.1.tar.gz
tar -xvf openresty-1.13.6.1.tar.gz
#install necessary libs
apt-get install build-essential libxslt1-dev libxml2-dev libgd2-xpm-dev libgeoip-dev libgoogle-perftools-dev libperl-dev libpng-dev zlib1g-dev
@binhqd
binhqd / verify-jwt.lua
Created January 3, 2018 02:34
Nginx jwt verification by lua
local cjson = require "cjson"
local jwt = require "resty.jwt"
local args = ngx.req.get_uri_args()
local token = args.BearerToken
if (args.bearerToken ~= nil) then
token = args.bearerToken
end
@binhqd
binhqd / tail_jenkins.py
Created December 28, 2017 04:56 — forked from carsongee/tail_jenkins.py
Tail Jenkins Jobs
#!/usr/bin/env python
"""
Tail a Jenkins build in a terminal
"""
import os
import requests
import sys
import time