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 / homepage-spec.js
Last active June 20, 2016 08:47
Sample BDD test preparation
//var screenshot = require('./../screenshot');
describe('Test Login page', function() {
beforeEach(function() {
// doing something here
});
var width = 1600;
var height = 2400;
browser.driver.manage().window().setSize(width, height);
const InvitationHelper = require('../InvitationHelpers');
self.customCreate = (data, fn) => {
return findUser()
.then(InvitationHelpers.checkParams)
.then(InvitationHelpers.checkIsInSP)
.then(InvitationHelpers.checkIsInvited)
.then(InvitationHelpers.createInvitation)
.then(InvitationHelpers.queueEmail)
8.2.3. HTTP log format
----------------------
The HTTP format is the most complete and the best suited for HTTP proxies. It
is enabled by when "option httplog" is specified in the frontend. It provides
the same level of information as the TCP format with additional features which
are specific to the HTTP protocol. Just like the TCP format, the log is usually
emitted at the end of the session, unless "option logasap" is specified, which
generally only makes sense for download sites. A session which matches the
"monitor" rules will never logged. It is also possible not to log sessions for
sudo apt-get install -y build-essential zlib1g-dev libpcre3 libpcre3-dev unzip
NPS_VERSION=1.12.34.2-stable
cd
wget https://github.com/pagespeed/ngx_pagespeed/archive/v${NPS_VERSION}.zip
unzip v${NPS_VERSION}.zip
cd ngx_pagespeed-${NPS_VERSION}/
NPS_RELEASE_NUMBER=${NPS_VERSION/beta/}
NPS_RELEASE_NUMBER=${NPS_VERSION/stable/}
psol_url=https://dl.google.com/dl/page-speed/psol/${NPS_RELEASE_NUMBER}.tar.gz
@binhqd
binhqd / gist:03d4473ca2d5f164ed57586db6dff9d8
Created November 1, 2017 07:23
Install Certbot and SSL
sudo apt-get update
sudo apt-get install -y software-properties-common
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install -y python-certbot-nginx
# centos
@binhqd
binhqd / ubuntu.sh
Last active November 1, 2017 08:39
Enable OS max connections and ports
# Check number of CPUs
grep ^processor /proc/cpuinfo | wc -l
# set maximum number of open files (current session)
ulimit -u 10000
ulimit -n 10000
# Modify number open files
vi /etc/security/limits.conf
# * soft nofile 64000
@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
@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 / 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 / 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"