This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| GET_USERS_URL="https://reqres.in/api/users?page=2" | |
| # Store the status code and the response | |
| HTTP_RESPONSE=$(curl --silent --write-out "HTTPSTATUS:%{http_code}" -X POST $GET_USERS_URL) | |
| # Extract the response body | |
| HTTP_BODY=$(echo $HTTP_RESPONSE | sed -e 's/HTTPSTATUS\:.*//g') | |
| # Extract the status code | |
| HTTP_STATUS=$(echo $HTTP_RESPONSE | tr -d '\n' | sed -e 's/.*HTTPSTATUS://') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static int getDay(){ | |
| return getLocalDate().getDayOfMonth(); | |
| } | |
| public static int getMonth(){ | |
| return getLocalDate().getMonthValue(); | |
| } | |
| public static int getYear(){ | |
| return getLocalDate().getYear(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.apache.commons.lang3.RandomStringUtils; | |
| public static String get(int length, boolean useLetters, boolean useNumbers) { | |
| return RandomStringUtils.random(length, useLetters, useNumbers); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1. Download Oracle Linux instant client | |
| oracle-instantclient11.2-basic-11.2.0.2.0.x86_64.rpm | |
| oracle-instantclient11.2-sqlplus-11.2.0.2.0.x86_64.rpm | |
| 2. Install | |
| rpm -ivh oracle-instantclient11.2-basic-11.2.0.2.0.x86_64.rpm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Create a MYSQL container | |
| # default user is root | |
| docker run -p <host_machine_port>:3306 --name <container_name> -e MYSQL_ROOT_PASSWORD=<root_password> -e MYSQL_DATABASE=<db_name> -d mysql:<version> | |
| <host_machine_port> — The port on your local machine that you want the container connected to. | |
| <container_name> — The name of the container that will be created | |
| <root_password> — The password of the root user for the mysql instance | |
| <db_name> — The name of the database that will be created | |
| <version> — The version of MySQL that you want to run | |
| # Example |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Installing Telnet | |
| Some hosts may come with Telnet pre-installed. To test this, run this command on your server: | |
| telnet ? | |
| You should see something like this: | |
| usage: telnet [-l user] [-a] [-s src_addr] host-name [port] | |
| If you get a “command not found” error, you will need to install Telnet. | |
| On Ubuntu: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Question: How to Search for Files Recursively into Subdirectories | |
| Solution: find . -print | grep -i '.*[.]xml' | |
| Use sudo if required | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #To find the latest dependecies update of the project | |
| mvn versions:display-dependency-updates | |
| #To check the plugin updates | |
| mvn versions:display-plugin-updates | |
| #To use latest versions | |
| mvn versions:use-latest-versions | |
| https://www.baeldung.com/maven-force-update |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Error: Java: invalid target release: 11 - IntelliJ IDEA | |
| Resolution: | |
| File->Project Structure->Modules ->> Language level to 8 ( my maven project was set to 1.8 java) | |
| File -> Settings -> Build, Execution, Deployment -> Compiler -> Java Compiler -> 8 also there |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ########################################################################################################################### | |
| # How to set or change the default Java (JDK) version on macOS? | |
| Run the command /usr/libexec/java_home -V to output the installed versions | |
| Example output | |
| Matching Java Virtual Machines (3): | |
| 1.8.0_05, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home | |
| 1.6.0_65-b14-462, x86_64: "Java SE 6" /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home | |
| 1.6.0_65-b14-462, i386: "Java SE 6" /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home | |
| Pick the version you want to be the default from the above list |
OlderNewer