Skip to content

Instantly share code, notes, and snippets.

Avatar

Tran Minh Phuong phuongtailtranminh

  • Hanoi
View GitHub Profile
View gist:a6ea6811362cdc0b4b2b74b8edb98581
const https = require('https');
const axios = require('axios');
const options = {
rejectUnauthorized: true,
checkServerIdentity: function(host, cert) {
// // Make sure the certificate is issued to the host we are connected to
// const err = tls.checkServerIdentity(host, cert);
// if (err) {
// return err;
@phuongtailtranminh
phuongtailtranminh / gist:ad0862bdddcc208bef7e030f4e62d36f
Created Aug 16, 2021
Batch Request Assign Manager for User - Microsoft Graph API Java
View gist:ad0862bdddcc208bef7e030f4e62d36f
package com.example.demo;
import com.azure.identity.ClientSecretCredential;
import com.azure.identity.ClientSecretCredentialBuilder;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import com.microsoft.graph.authentication.TokenCredentialAuthProvider;
import com.microsoft.graph.content.BatchRequestContent;
import com.microsoft.graph.content.BatchResponseContent;
import com.microsoft.graph.http.HttpMethod;
View Powerline in Putty
Because of 'Meslo for Powerline' font doens't work with Putty.
So we need another patched font to display powerline correctly.
Here are the list:
- DejaVu Sans Mono for Powerline (https://github.com/powerline/fonts/tree/master/DejaVuSansMono)
- Droid Sans Mono for Powerline (https://github.com/powerline/fonts/tree/master/DroidSansMono)
To change font: On main window (Putty Configuration) -> Window -> Apearance -> Font settings -> Change
To test, enter this in the terminal screen: echo "\ue0b0 \u00b1 \ue0a0 \u27a6 \u2718 \u26a1 \u2699"
View gist:a8517e3fb11da81e5d9aeeb0c2ff19ba
import 'package:flutter/material.dart';
void main() => runApp(new MaterialApp(
home: new HomePage('Dismissible Example'),
));
class HomePage extends StatelessWidget {
String title;
final items = new List<String>.generate(10000, (i) => "Item $i");
View Linux Network Commands
Network Interface Configurator.
- View network settings of an ethernet adapter:
ifconfig eth0
- Display details of all interfaces, including disabled interfaces:
ifconfig -a
- Disable eth0 interface:
ifconfig eth0 down
@phuongtailtranminh
phuongtailtranminh / Backup and Restore Linux Server
Last active Aug 5, 2019
Backup and Restore Ubuntu Server
View Backup and Restore Linux Server
Backup: sudo tar -cvpzf backup.tar.gz --exclude=/backup.tar.gz --exclude=/boot --one-file-system /
Restore: sudo tar -xvpzf /path/to/tar/file -C / --numeric-owner
View pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
View logback-spring.xml
<!DOCTYPE configuration>
<configuration>
<contextName>test</contextName>
<jmxConfigurator/>
<appender name="gelf" class="biz.paluch.logging.gelf.logback.GelfLogbackAppender">
<host>udp:localhost</host>
<port>12201</port>
<version>1.1</version>
View gist:b7a8be59680c13823943643ec3c56351
package com.viettel.integration.hub.echoserver.controller;
import java.io.IOException;
import java.util.Base64;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
@phuongtailtranminh
phuongtailtranminh / Che Build
Last active Jan 15, 2019
Useful Eclipse Che build command
View Che Build
First time build: 40m
Second time build: 6m
[BUILD FROM SOURCE USING DOCKER]
cd YOUR_CHE_REPOSITORY
docker run -it --rm --name build-che \
-v "$HOME/.m2:/home/user/.m2" \
-v "$PWD":/home/user/che-build \
-w /home/user/che-build \
eclipse/che-dev \