Skip to content

Instantly share code, notes, and snippets.

View arifulhb's full-sized avatar

Ariful Haque arifulhb

View GitHub Profile
@arifulhb
arifulhb / fibonacci.js
Created October 9, 2020 13:11
Print Fibonacci series using recursive function
function fib(num) {
let sequence = [0, 1]
function helper(sequence, num) {
const length = sequence.length
// get sum of last two numbers
let sum = sequence[length - 1] + sequence[length - 2]
@arifulhb
arifulhb / amazon-pa-api5-getItemById
Created October 27, 2019 08:12
Amazon-PA-API50-getItemById
let resourceList = resources.getItemInfo
resourceList = resourceList
.concat(resources.getImagesPrimary)
api.getItemById(['B079JD7F7G'], {
parameters: resourceList,
condition: condition.Any
}).then((response) => {
console.log(' ===== find by Item ids =====')
console.log('data', response.data)
@arifulhb
arifulhb / Amazon-PA-API50-Credentials
Last active October 27, 2019 08:11
Amazon-PA-API50: Credentials
myConfig.accessKey = '<ACCESS_KEY>'
myConfig.secretKey = '<SECRET_KEY>'
myConfig.partnerTag = '<PARTNER_TAG>'
const api = new Api(myConfig)
@arifulhb
arifulhb / amazon-pa-api50-config
Created October 27, 2019 08:08
Amazon-pa-api50: Create Config instance
// By Default all resources and will connect to United States
let myConfig = new Config();
// if you want other country then united states.
let myConfig = new Config(undefined, country.UnitedKingdom);
// if you want custom resources.
// this custom `resources.Offers` will be set default to all of your search. You can customize the resources in your search specific function also.
let myConfig = new Config(resources.Offers);
// if you want custom resources with different country
let myConfig = new Config(resources.ItemInfo, country.Canada);
@arifulhb
arifulhb / amazon-pa-api50-optional-loading
Created October 27, 2019 08:07
Optional loading of modules
const resources = require('amazon-pa-api50/lib/options').Resources // Optional for different resources
const condition = require('amazon-pa-api50/lib/options').Condition // for product condition
const country = require('amazon-pa-api50/lib/options').Country // Optional for different country
const searchIndex = require('amazon-pa-api50/lib/options').SearchIndex // for Search Index
@arifulhb
arifulhb / amazon-pa-api50-connect
Created October 27, 2019 08:05
Connect with Amazon Product Affiliate API
const Api = require('amazon-pa-api50')
const Config = require('amazon-pa-api50/lib/config')
@arifulhb
arifulhb / install.sh
Last active May 21, 2019 08:26
Nginx and PHP-7.2 insall in AWS EC2 Ubuntu 18.04 instance via User Data
#!/bin/bash
sudo apt-get update
sudo apt-get install nginx -y
sudo apt-get install memcached -y
sudo apt install php7.2 php7.2-fpm php7.2-mysql php-common php7.2-cli php7.2-common php7.2-json php7.2-opcache php7.2-readline php7.2-mbstring php7.2-xml php7.2-gd php7.2-curl php-redis php-apcu php-memcached php-memcache -y
sudo apt-get install mysql-client -y
@arifulhb
arifulhb / blog.conf
Created March 30, 2019 17:53
Nginx Default blog config file
server {
listen 80;
// @todo Change from localhost to blog.local
server_name localhost;
// @todo Change root from /var/www/html to /var/www/blog
root /var/www/html/;
index index.php index.html index.htm;
@arifulhb
arifulhb / docker-composer.yml
Created March 30, 2019 16:31
Nginx image and volume for Docker
nginx:
build:
context: ./images/nginx
dockerfile: Dockerfile
container_name: lempdock_nginx_1
ports:
- "80:80"
- "443:443"
volumes:
- ./www:/var/www
@arifulhb
arifulhb / docker-composer.yml
Created March 30, 2019 16:17
Volumes in docker-composer.yml
mysql:
volumes:
- ./data/mysql:/var/lib/mysql
redis:
volumes:
- ./data/redis:/data/redis