Skip to content

Instantly share code, notes, and snippets.

ledangtuanbk

Block or report user

Report or block ledangtuanbk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ledangtuanbk
ledangtuanbk / ssh_tunnel
Created Aug 16, 2019
How to use ssh_tunnel
View 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:245:localhost:22 user@example.com
remember to run on reboot
View LongestPath.java
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[][]{
View huong dan tao ssh key
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
View .dockerignore
# Ignore everything
**
# Allow files and directories
!build/**
View Dockerfile React App
FROM mhart/alpine-node
RUN yarn global add serve
WORKDIR /app
COPY build .
CMD ["serve", "-p", "80", "-s", "."]
@ledangtuanbk
ledangtuanbk / install-docker.sh
Last active Mar 26, 2019
install docker and docker compose
View install-docker.sh
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:
View bhyt.java
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";
View elasticJava.java
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();
View text.txt
result = [];
function load(url, level)
{
console.log("level: "+level+","+url);
$.get(url, function(data, status){
var x;
if($(data).length>2)
{
x=$($(data)[2]);
You can’t perform that action at this time.