Skip to content

Instantly share code, notes, and snippets.

@ToanPV90
ToanPV90 / log
Created July 31, 2019 17:54
git log oneline
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commi
@ToanPV90
ToanPV90 / SAMLServlet.java
Created April 30, 2019 14:27 — forked from jimhe/SAMLServlet.java
Servlet to handle SAML Auth request and response. on GET /saml, it will redirect to the ID Provider with the proper SAMLRequest parameter. on POST /saml, it will parse the POST parameter for a properly signed and successful response before allowing the user in.
package com.comprehend.servlet;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.opensaml.Configuration;
import org.opensaml.common.binding.BasicSAMLMessageContext;
import org.opensaml.common.xml.SAMLConstants;
import org.opensaml.saml2.binding.decoding.HTTPPostDecoder;
import org.opensaml.saml2.binding.encoding.HTTPRedirectDeflateEncoder;
import org.opensaml.saml2.core.*;
So we decide to remove the mysql server and reinstall again, below are the step that we were done.
sudo apt-get remove --purge mysql*
sudo apt-get purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\033[1m\u@\h \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\]\033[0m $ "
Step 1 – Add Node.js PPA
Node.js package is available in LTS release and the current release. It’s your choice to select which version you want to install on the system as per your requirements. Let’s add the PPA to your system to install Nodejs on Ubuntu.
Use Current Release: At te last update of this tutorial, Node.js 11.4.0 is the current Node.js release available.
sudo apt-get install curl python-software-properties
curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -
Use LTS Release : At the last update of this tutorial, Node.js 10.14.1 is the LTS release available.
@ToanPV90
ToanPV90 / gist:52e151c6916a3d4ec175b6b81c9d2ee0
Created February 23, 2019 04:07
unstage files with git
# new file: to-be-added
# modified: to-be-modified
# deleted: to-be-removed
#
me$ git reset -q HEAD to-be-added
# ok
me$ git reset -q HEAD to-be-modified
1. Create file /home/{username}/.local/share/applications/eclipse.desktop
2. Next, copy and paste the content below into the file and save
[Desktop Entry]
Name=Eclipse JEE Oxygen
Type=Application
Exec=/home/{username}/eclipse/jee-oxygen/eclipse/eclipse
Terminal=false
Icon=/home/{username}/eclipse/jee-oxygen/eclipse/icon.xpm
Comment=Integrated Development Environment
mvn eclipse:eclipse -DdownloadSources -DdownloadJavadocs
1. Run command sudo apt-get install maven, to install the latest Apache Maven.
2. Run command mvn -version to verify your installation.
3. Where is Maven installed?
The command apt-get install the Maven in /usr/share/maven.
$ls -ls /usr/share/maven
total 16
4 drwxr-xr-x 2 root root 4096 Dec 7 01:28 bin
4 drwxr-xr-x 2 root root 4096 Dec 7 01:28 boot
0 lrwxrwxrwx 1 root root 10 May 28 2012 conf -> /etc/maven
@ToanPV90
ToanPV90 / Java8DateTimeExamples.java
Created August 22, 2017 03:54 — forked from mscharhag/Java8DateTimeExamples.java
Examples for using the Java 8 Date and Time API (JSR 310)
import java.time.*;
import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAdjusters;
import java.util.*;
import static java.time.temporal.TemporalAdjusters.*;
public class Java8DateTimeExamples {