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
| 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
| #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
| 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
| 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
| 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
| 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://') |
NewerOlder