-
- define a custom datatype using Struct with your favorite name. Which contains 3 fields, and 1 should be String Type.
-
- In main function:
- A. Create an instance of the above defined struct
- B. Print complete instance
- C. Print instance by calling its fields.
- D. create another instance by using fields of first instance
-
- define user defined function, User defined function should receive some arguments and return an instance of your above defined struct.
-
- in main function call user defined function, Print instance returned by the user defined function.
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
| <?php | |
| require_once __DIR__ . '/vendor/autoload.php'; | |
| ini_set('display_errors', 1); | |
| define('SCOPES', "https://www.googleapis.com/auth/calendar"); | |
| ################################################################################ | |
| ##### For google-api-php-client Version v2.0.0-RC2 and pem key file format ##### | |
| ################################################################################ | |
| define('KEY_FILE',dirname(__FILE__).'service-account.p12'); |
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
| <?php | |
| require_once __DIR__ . '/vendor/autoload.php'; | |
| ini_set('display_errors', 1); | |
| ###### | |
| define('CALENDAR_ID', '[email protected]'); | |
| define('CREDENTIALS_PATH', __DIR__ . '/app/config/private/service-account.json'); | |
| define('SCOPES', Google_Service_Calendar::CALENDAR); | |
| $googleClient = new Google_Client(); |
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
| #![allow(dead_code)] | |
| #![allow(unused_variables)] | |
| fn main() { | |
| check_positive_negative_zero(55); | |
| print_arguments(25, 5.4, false); | |
| println!("{:#?}", square_the_number(4)); | |
| } | |
| // Q # 1. Write a rust program, define a function that receives one argument of any suitable data |
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
| #![allow(dead_code)] | |
| #![allow(unused_variables)] | |
| fn main() { | |
| let mut name = String::new(); | |
| let mut subject_one = String::new(); | |
| let mut subject_two = String::new(); | |
| println!("enter your name"); | |
| std::io::stdin().read_line(&mut name).ok().expect("Couldn't read line!"); |
If you are using NGINX:
sudo apt-get updatesudo apt-get install software-properties-commonsudo add-apt-repository universesudo add-apt-repository ppa:certbot/certbot- Execute
sudo apt-get updateagain sudo apt-get install certbot python-certbot-nginxsudo certbot --nginx
Magic words:
psql -U postgresSome interesting flags (to see all, use -h or --help depending on your psql version):
-E: will describe the underlaying queries of the\commands (cool for learning!)-l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.
- Follow standard conventions.
- Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
- Boy scout rule. Leave the campground cleaner than you found it.
- Always find root cause. Always look for the root cause of a problem.
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
| #!/bin/bash | |
| cd /tmp || exit | |
| echo "Downloading sonar-scanner....." | |
| if [ -d "/tmp/sonar-scanner-cli-3.2.0.1227-linux.zip" ];then | |
| sudo rm /tmp/sonar-scanner-cli-3.2.0.1227-linux.zip | |
| fi | |
| wget -q https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.5.0.2216-linux.zip | |
| echo "Download completed." |