Skip to content

Instantly share code, notes, and snippets.

@anhdiepmmk
anhdiepmmk / dantri.com.js
Last active June 14, 2021 16:05
Sử dụng puppeteer, cheerio của js để crawler trang web có ajax
const puppeteer = require('puppeteer');
const cheerio = require('cheerio');
(async () => {
const browser = await puppeteer.launch({headless: false, devtools: true})
const page = await browser.newPage()
await page.goto('https://dantri.com.vn/')
//https://github.com/cheeriojs/cheerio
let content = await page.content();
@anhdiepmmk
anhdiepmmk / default.conf
Last active January 10, 2020 07:35
The simplest configuration for load balancing with nginx
http {
upstream myapp1 {
server srv1.example.com;
server srv2.example.com;
server srv3.example.com;
}
server {
listen 80;
symfony/var-dumper suggests installing ext-intl (To show region name in time zone dump)
symfony/routing suggests installing symfony/config (For using the all-in-one router or any loader)
symfony/routing suggests installing symfony/yaml (For using the YAML loader)
symfony/routing suggests installing symfony/expression-language (For using expression matching)
symfony/routing suggests installing doctrine/annotations (For using the annotation loader)
symfony/polyfill-intl-idn suggests installing ext-intl (For best performance)
symfony/event-dispatcher-contracts suggests installing psr/event-dispatcher
symfony/event-dispatcher suggests installing symfony/dependency-injection
symfony/http-kernel suggests installing symfony/browser-kit
symfony/http-kernel suggests installing symfony/config
@anhdiepmmk
anhdiepmmk / cassandra.yml
Last active January 10, 2020 14:23
docker cassandra, cql script
# This compose file will start up Netflix OSS Tracker and load it with a days worth of data
#
# You need to export a variable before running it with your github key
# export github_oauth=YOUR_KEY_HERE
# export github_org=YOUR_ORG_HERE
#
version: '3'
services:
cassandra:
container_name: osstracker-cassandra
import React from "react";
export default function App() {
const nested = [
{
name: "EWAY",
deparments : [
{
name : "IHR"
},
@anhdiepmmk
anhdiepmmk / kong.yml
Last active January 21, 2020 09:05
docker compose for kong
version: "3"
volumes:
kong_data: {}
networks:
kong-net:
driver: bridge
services:
@anhdiepmmk
anhdiepmmk / create-generic.sh
Last active January 30, 2020 04:46
Thực hành docker swarm với công cụ docker machine
#Tạo machine type là generic
docker-machine create -d generic \
--generic-ip-address xxx.xxx.xxx.xxx \
--generic-ssh-key /path/to/id_rsa \
--generic-ssh-user user-name \
--generic-ssh-port 22 \
dev-db
@anhdiepmmk
anhdiepmmk / mongodb.replica-set.v2.yml
Last active January 30, 2020 12:43
Thực hành tạo replica set trên mongo db sử dụng công cụ docker, docker compose
version: "3"
services:
mongoarbiter:
hostname: mongoarbiter
container_name: localmongoarbiter
image: mongo:4
expose:
- 27017
ports:
- 17016:27017
@anhdiepmmk
anhdiepmmk / easyswoole
Created February 7, 2020 04:53
Docker file cho easyswoole
FROM centos:latest
#version defined
ENV SWOOLE_VERSION 4.4.3
ENV EASYSWOOLE_VERSION 3.x-dev
#update core
RUN yum update -y
#install libs
@anhdiepmmk
anhdiepmmk / mongodb.backup
Last active February 8, 2020 12:15
Câu lệnh backup và restore mongodb
mongodump --db database_name --username=user --password="password" --authenticationDatabase=admin --gzip --archive > /opt/database_name.gz