Skip to content

Instantly share code, notes, and snippets.

result = [];
function load(url, level)
{
console.log("level: "+level+","+url);
$.get(url, function(data, status){
var x;
if($(data).length>2)
{
x=$($(data)[2]);
public static void main(String[] args) {
try {
TransportClient client = new PreBuiltTransportClient(Settings.EMPTY)
.addTransportAddress(new TransportAddress(InetAddress.getByName("localhost"), 9300));
String jsonObject = "{\"age\":14,\"dateOfBirth\":1471466076564,"
+"\"fullName\":\"John Doe\"}";
IndexResponse response = client.prepareIndex("people", "Doe")
.setSource(jsonObject, XContentType.JSON).get();
import com.squareup.okhttp.*;
import org.json.JSONObject;
import java.io.*;
import java.math.BigDecimal;
public class TestMainBHYT {
// private static final String LOGIN = "http://localhost:47503/api/token/take";
// private static final String SEND_FILE = "http://localhost:47503/api/egw/guiHoSoGiamDinh4210";
@ledangtuanbk
ledangtuanbk / install-docker.sh
Last active March 26, 2019 03:52
install docker and docker compose
Install Docker & Docker Compose - Centos 7
Step 1 — Install Docker
Install needed packages:
$ sudo yum install -y yum-utils device-mapper-persistent-data lvm2
Configure the docker-ce repo:
$ sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Install docker-ce:
version: '3'
services:
kong-migrations:
image: "${KONG_DOCKER_TAG:-kong:latest}"
command: kong migrations bootstrap
environment:
KONG_DATABASE: postgres
KONG_PG_DATABASE: ${KONG_PG_DATABASE:-kong}
KONG_PG_HOST: 10.148.0.27
KONG_PG_PASSWORD: ${KONG_PG_PASSWORD:-kong}
FROM mhart/alpine-node
RUN yarn global add serve
WORKDIR /app
COPY build .
CMD ["serve", "-p", "80", "-s", "."]
# Ignore everything
**
# Allow files and directories
!build/**
B1. Cai dat git bash https://git-scm.com/downloads
B2. Bat Git Bash. chay lenh
ssh-keygen -t rsa
enter
enter
enter cho den khi xong
B3. chay lenh "cat ~/.ssh/id_rsa.pub"
B4. Copy nhung thu tren man hinh gui cho a Tuan
package com.ldt.test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class TestMain2 {
public static void main(String[] args) {
int[][] datas = new int[][]{
@ledangtuanbk
ledangtuanbk / ssh_tunnel
Last active November 14, 2019 03:08
How to use ssh_tunnel
1. Connecting to a database behind a firewall
ssh -L 9000:localhost:5432 user@example.com database postgres run port 5432 only access from localhost
2. Remote port forwarding
ssh -R 9000:localhost:3000 user@example.com
Localhost running port 3000 and want to acess from internet port 9000
- set GatewayPorts yes in /etc/ssh/sshd_config
- this can be done by autossh
autossh -M 0 -f -q -N -o "ServerAliveInterval 5" -o "ServerAliveCountMax 1" -o "ExitOnForwardFailure yes" -R 0.0.0.0:[SERVER]:localhost:[CLIENT_IP] [SERVER_USER]@[SEVER_IP]
- remember to run on reboot