Snippets Collections
#include <stdio.h>

int main (){
    
    int index;
    int mark1;
    int mark2;
    
    printf("Enter index number :");
    scanf("%d",&index);
    
    printf("Enter mark1 :");
    scanf("%d",&mark1);
    
    printf("Enter mark2 :");
    scanf("%d",&mark2);
    
    int avg = (mark1+mark2)/2;
    printf("Average of marks :%d\n",avg);
    
    if(avg>=35){
        printf("Grade = c");
    }else{
        printf("fail");
    }

    return 0;
}
#include<stdio.h>

int main(){
    
    int index;
    int mark1;
    int mark2;
    
    printf("Enter index number:");
    scanf("%d",&index);
    
    printf("Enter mark1:");
    scanf("%d",&mark1);
    
    printf("Enter mark2:");
    scanf("%d",&mark2);
    
    int avg = (mark1+mark2)/2;
    printf("Average of marks:%d\n",avg);
    
    if(avg>=35){
        printf("Grade : C-");
    }else{
        printf("\nYou are fail idiot.!");
    }

    
    
    
    
    return 0;
}
// Online C compiler to run C program online
#include<stdio.h>
int main(){
     int a;
     int b;
     
     
     printf("Enter number for a:");
     scanf("%d",&a);
     
     printf("Enter number for b:");
     scanf("%d",&b);
     
     int value = a+b;
     printf("The value is: %d\n",value);
    
    
    
    return 0;
}
def start():
    print()
    print('********************************')
    print("Student Name  - Aniket")
    print("Title         - Micro Project")
    print("Project Name  - Password Hashing")
    print("Language      - Python")
    print('********************************')
    print()

class Hash:
    def __init__(self, secret_key):
        self.secret_key = secret_key
       
    def hash(self, password):
        hashed_password = ""
        for char in password:
            hashed_password += chr(ord(char) + self.secret_key)
        return hashed_password

    def decrypt(self, hashed_password):
        decrypted_password = ""
        for char in hashed_password:
            decrypted_password += chr(ord(char) - self.secret_key)
        return decrypted_password

start()

while True:
    obj = Hash(1)
    print("----------------------------------")
    password = input("Enter Your Password : ")
    print("----------------------------------")
    print("Your entered Password : ", password)
    print("----------------------------------")
    
    hashed_password = obj.hash(password)
    print("Your Hashed password:", hashed_password)
    print("----------------------------------")
    
    decrypted_password = obj.decrypt(hashed_password)
    print("Your Decrypted password:", decrypted_password)
    print("----------------------------------")
    
    ans = input("Do You want to Continue (Y/N) :")
    if ans.lower() != 'y':
        print('.....Thank You.....')
        break
git clone https://github.com/Rajkumrdusad/Tool-X.git
if ( is_single() ) {
  $current_post_id = get_queried_object_id();
  $current_category_id = get_the_category( $current_post_id )[0]->cat_ID;

  $args = array(
    'category' => $current_category_id,
    'post__not_in' => array( $current_post_id ),
    'posts_per_page' => 3,
  );

  $related_posts = new WP_Query( $args );

  if ( $related_posts->have_posts() ) {
    echo '<h2>Related Posts:</h2>';
    while ( $related_posts->have_posts() ) {
      $related_posts->the_post();
      echo '<a href="' . get_the_permalink() . '">' . get_the_title() . '</a><br>';
    }
    wp_reset_postdata();
  }
}
{
  "kind": "EntityRecognition",
  "parameters": {
    "modelVersion": "latest"
  },
  "analysisInput": {
    "documents": [
      {
        "id": "1",
        "language": "en",
        "text": "Joe went to London on Saturday"
      }
    ]
  }
}


{
    "kind": "EntityRecognitionResults",
     "results": {
          "documents":[
              {
                  "entities":[
                  {
                    "text":"Joe",
                    "category":"Person",
                    "offset":0,
                    "length":3,
                    "confidenceScore":0.62
                  },
                  {
                    "text":"London",
                    "category":"Location",
                    "subcategory":"GPE",
                    "offset":12,
                    "length":6,
                    "confidenceScore":0.88
                  },
                  {
                    "text":"Saturday",
                    "category":"DateTime",
                    "subcategory":"Date",
                    "offset":22,
                    "length":8,
                    "confidenceScore":0.8
                  }
                ],
                "id":"1",
                "warnings":[]
              }
          ],
          "errors":[],
          "modelVersion":"2021-01-15"
    }
}
document.onreadystatechange = function () {
  if (document.readyState === "complete") {
    // Here fire whatever you want when all rendered
  }
}
dir "C:\path\to\files" -include *.txt -rec | gc | out-file "C:\path\to\output\file\joined.txt"
<?php

	class GPSSimulation {
		private $conn;
		private $hst = null;
		private $db = null;
		private $usr = null;
		private $pwd = null;
		private $gpsdata = [];
			
		//////////////////////// PRIVATE
		
		private function fillDataTable() {
			$this->initializeDatabase();
			
			$add = $this->conn->prepare("INSERT INTO gpsmsg(dom, wagon, x, y) 
										       VALUES(?, ?, ?, ?)");
			
			
			// voorkom dubbele entries in de database.
			// als satelliet, datum, x en y al voorkomen in de tabel
			// kun je vaststellen dat de huifkar tijdelijk stilstaat
			// voor pauze, lunch of restaurantbezoek
			// en is een nieuwe entry niet nodig.
			$doesRecordExist = $this->conn->prepare(
				"SELECT COUNT(*) FROM gpsmsg 
			     WHERE dom = ? AND wagon = ? AND x = ? AND y = ?"
			);
			
			foreach($this->gpsdata as $ins) {
				
				list($dom, $wagon, $x, $y) = $ins;

				$doesRecordExist->execute([$dom, $wagon, $x, $y]);

				if($doesRecordExist->fetchColumn() == 0) {
					$add->execute([$dom, $wagon, $x, $y]);
				} 
			}
    	}
		
		private function initializeDatabase() {
			$this->conn->query("TRUNCATE TABLE gpsmsg");
			
		    $this->gpsdata[] = ["2023-10-19", "Old Faithful",      100, 100];
		    $this->gpsdata[] = ["2023-10-19", "Old Faithful",      150, 150];
		    $this->gpsdata[] = ["2023-10-19", "Old Faithful",      230, 310];
		    $this->gpsdata[] = ["2023-10-19", "Old Faithful",       80, 245];		    
			
			// test dubbelen, worden niet opgenomen in de database
		    $this->gpsdata[] = ["2023-10-19", "Old Faithful",      100, 100];
		    $this->gpsdata[] = ["2023-10-19", "Old Faithful",      150, 150];
		    $this->gpsdata[] = ["2023-10-19", "Old Faithful",      230, 310];
		    $this->gpsdata[] = ["2023-10-19", "Old Faithful",       80, 245];		    
					
		    $this->gpsdata[] = ["2023-10-15", "Jade Princess",       10,  54];
		    $this->gpsdata[] = ["2023-10-15", "Jade Princess",       75, 194];
		    $this->gpsdata[] = ["2023-10-15", "Jade Princess",      175, 161];
		    $this->gpsdata[] = ["2023-10-15", "Jade Princess",      134, 280];
		    $this->gpsdata[] = ["2023-10-15", "Jade Princess",      300, 160];
		    $this->gpsdata[] = ["2023-10-15", "Jade Princess",      400, 290];
		    $this->gpsdata[] = ["2023-10-15", "Jade Princess",      544, 222];
		    $this->gpsdata[] = ["2023-10-15", "Jade Princess",      444, 122];
		    $this->gpsdata[] = ["2023-10-15", "Jade Princess",      321,  60];
		    $this->gpsdata[] = ["2023-10-15", "Jade Princess",      200,  88];
		    $this->gpsdata[] = ["2023-10-15", "Jade Princess",       25,  25];

		    $this->gpsdata[] = ["2023-10-10", "Skyblue Wonder",       50,  50];
		    $this->gpsdata[] = ["2023-10-10", "Skyblue Wonder",      300, 188];
		    $this->gpsdata[] = ["2023-10-10", "Skyblue Wonder",      225,  90];			    
			
			// test dubbelen, worden niet opgenomen in de database
			$this->gpsdata[] = ["2023-10-10", "Skyblue Wonder",       50,  50];
		    $this->gpsdata[] = ["2023-10-10", "Skyblue Wonder",      300, 188];
		    $this->gpsdata[] = ["2023-10-10", "Skyblue Wonder",      225,  90];		    
			
			$this->gpsdata[] = ["2023-10-05", "Red Lobster",          50,  50];
		    $this->gpsdata[] = ["2023-10-05", "Red Lobster",         190, 288];
		    $this->gpsdata[] = ["2023-10-05", "Red Lobster",         260, 122];
		    $this->gpsdata[] = ["2023-10-05", "Red Lobster",         340,  90];
		    $this->gpsdata[] = ["2023-10-05", "Red Lobster",         240,  45];
		}
		
		//////////////////////// PUBLIC

		public function __construct($phst, $pdb, $pusr, $ppwd, $refresh = false) {
			$this->hst = $phst;	// bewaar de verbindingsgegevens
			$this->db  = $pdb;
			$this->hst = $pusr;
			$this->pwd = $ppwd;
			
			$this->conn = new PDO("mysql:host=$phst;dbname=$pdb", $pusr, $ppwd);
			
			if($refresh) $this->fillDataTable();
		}
	
		public function getDataRaw($wagname = null) {
        
			$sql = "SELECT * FROM gpsmsg ";
		
			if($satnm != null) {
				$sql .= "WHERE wagon = :wag";
		
				$stmt = $this->conn->prepare($sql);
        		$stmt->execute([":wag" => $wagname]);
			} else {
				$stmt = $this->conn->query($sql);
			}

			$s = "<table border='1' cellspacing='5' cellpadding='5'>";
        	$s .= "\r<tr><td>Date</td><td>Wagon</td><td>X</td><td>Y</td><tr>";
        	while ($row = $stmt->fetch(PDO::FETCH_OBJ)) {
            	$s .= "\r<tr>"
					."<td>{$row->dom}</td>"
			  	 	."<td>{$row->wagon}</td>"
				 	."<td>{$row->x}</td>"
				 	."<td>{$row->y}</td>"
				 	."</tr>";
        	}
        	$s .= "\r</table><br>";

        	return $s;
    	}

		public function getTraject() {
	
			$stmt = $this->conn->query("SELECT * FROM gpsmsg ");

			$dta = [];
        	while($row = $stmt->fetch(PDO::FETCH_OBJ)) {
				$dta[] = [ 
					"dom"   => $row->dom, 
					"wagon" => $row->wagon, 
					"x"     => $row->x, 
					"y"     => $row->y 
				];
        	}

			return $dta;
    	}

		public function createSelectbox() {
		
			$stmt = $this->conn->query("SELECT DISTINCT wagon FROM gpsmsg");
			$s = "<div id='pleaseChooseWagon'><strong>Wagon</strong>";
			$s .= "<select name='selWagon' id='selWagon' "
			   ."onchange='getWagonSelected(this)'>";
			$s .= "<option value='0'>-- choose wagon --</option>";

			while($row = $stmt->fetch(PDO::FETCH_OBJ)) {
				$s .= "<option value='{$row->wagon}'>{$row->wagon}</option>";
			}
			$s .= "</select></div>";

			return $s;
		}

	}  // einde class GPSSimulation
const express = require('express');
const app = express();

// Our first foute
app.get('/home', (request, response, next) => {
  console.log(request);
  response.send('<h1>Welcome Ironhacker. :)</h1>');
});

// Start the server
app.listen(3000, () => console.log('My first app listening on port 3000! '));
// func that is going to set our title of our customer magically
function w2w_customers_set_title( $data , $postarr ) {

    // We only care if it's our customer
    if( $data[ 'post_type' ] === 'w2w-customers' ) {

        // get the customer name from _POST or from post_meta
        $customer_name = ( ! empty( $_POST[ 'customer_name' ] ) ) ? $_POST[ 'customer_name' ] : get_post_meta( $postarr[ 'ID' ], 'customer_name', true );

        // if the name is not empty, we want to set the title
        if( $customer_name !== '' ) {

            // sanitize name for title
            $data[ 'post_title' ] = $customer_name;
            // sanitize the name for the slug
            $data[ 'post_name' ]  = sanitize_title( sanitize_title_with_dashes( $customer_name, '', 'save' ) );
        }
    }
    return $data;
}
add_filter( 'wp_insert_post_data' , 'w2w_customers_set_title' , '99', 2 );
//To sort string 
Array.sort((a, b) => ("" + a).localeCompare(b, undefined, { numeric: true }));
//----------------------------------------------------
//To sort numbers
Array.sort((a,b) => a - b)

//----------------------------------------------------
//Convert epoch time to day - month - year
function convertEpochToDMY(epoch) {
    let date = new Date(epoch * 1000); 
    let day = date.getDate();
    let month = date.getMonth() + 1; 
    let year = date.getFullYear();
    day = day < 10 ? '0' + day : day;
    month = month < 10 ? '0' + month : month;

    return day + '-' + month + '-' + year;
}
//----------------------------------------------------
//this takes the start and end epoch val and gives out array of months 
function monthArray(start, end) {
  const arr = [];
  let dt = new Date(start);
  while (dt <= end) {
    arr.push(dt.toLocaleString("en-US", { month: "short" }));
    dt.setMonth(dt.getMonth() + 1);
  }
  return arr;
} // output [Dec, Jan]

//----------------------------------------------
const monthNames = [
  "Jan",
  "Feb",
  "Mar",
  "Apr",
  "May",
  "Jun",
  "Jul",
  "Aug",
  "Sep",
  "Oct",
  "Nov",
  "Dec",
];

//function getMonthNames(startMonth, endMonth) {
//  let result = [];
//  for (let i = startMonth; i <= endMonth; i++) {
//    result.push({ label: monthNames[i - 1], value: i });
//  }
//  return result;
// }
// this takes start and end month nos and gives list range of months
function getMonthNames(startMonth, endMonth) {
  let result = [];
  let month = startMonth;

  while (true) {
    result.push({ label: monthNames[month - 1], value: month });
    if (month === endMonth) {
      break;
    }
    month = (month % 12) + 1;
  }
  const sortedRes = result.sort((a, b) => (a.value - b.value) * -1);

  return sortedRes;
}
//---------------------------------------------------
<!-- This tells you if your device is dark mode enabled or not. -->
<meta name=”color-scheme” content=”light dark”>
<meta name=”supported-color-schemes” content=”light dark”>
<style type=”text/css”>
:root {
Color-scheme: light dark;
supported-color-schemes:light dark;
}
</style>

/* Here you can adjust the colors of your brand’s preferred dark mode theme. */
@media (prefers-color-scheme: dark ) {
.body {
      background-color: #CCCCCC !important;
}
h1, h2, h3, td {
      color: #9ea1f9 !important;
      padding: 0px 0px 0px 0px !important;
}
}
var HampLoanerAjaxUtils = Class.create();
HampLoanerAjaxUtils.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
	validateDates: function() {
		var MAX_MONTHS_START_DATE = 3; // Allow reservations with start date within 3 months
		var MAX_MONTHS_RETURN_DATE = 6; // Allow reservations with return date within 6 months from start date

		var startDateUserFormat = this.getParameter('sysparm_startdate');
		var startDate = HAMUtils.getDateInInternalFormat(startDateUserFormat);

		var returnDateUserFormat = this.getParameter('sysparm_returndate');
		var returnDate = HAMUtils.getDateInInternalFormat(returnDateUserFormat);

		var gDate = new GlideDateTime();
		var currentDate = gDate.getLocalDate();
		var res = {};
		var sdt;
		if (!gs.nil(startDate)) {
			sdt = new GlideDateTime(startDate);
			var cdt = new GlideDateTime(currentDate);
			var maxsdt = new GlideDateTime(currentDate);
			maxsdt.addMonthsUTC(MAX_MONTHS_START_DATE);
			if (sdt.before(cdt)) {
				res.isStartDateValid = false;
				res.startDateErrorMsg = gs.getMessage(
					'{0} is not valid. Select a start date on or after current date', [startDate]
				);
			} else if (sdt.after(maxsdt)) {
				res.isStartDateValid = false;
				res.startDateErrorMsg = gs.getMessage(
					'{0} is not valid. Select a start date within {1} months from current date',
					[startDate, String(MAX_MONTHS_START_DATE)]
				);
			} else {
				res.isStartDateValid = true;
			}
		}
		if (!gs.nil(returnDate)) {
			sdt = new GlideDateTime(startDate);
			var rdt = new GlideDateTime(returnDate);
			var maxrdt = new GlideDateTime(startDate);
			maxrdt.addMonthsUTC(MAX_MONTHS_RETURN_DATE);
			if (rdt.onOrBefore(sdt)) {
				res.isReturnDateValid = false;
				res.returnDateErrorMsg = gs.getMessage(
					'{0} is not valid. Select a return date after the selected start date', [returnDate]
				);
			} else if (rdt.after(maxrdt)) {
				res.isReturnDateValid = false;
				res.returnDateErrorMsg = gs.getMessage(
					'{0} is not valid. Select a return date within {1} months from the selected start date',
					[returnDate, String(MAX_MONTHS_RETURN_DATE)]
				);
			} else {
				res.isReturnDateValid = true;
			}
		}
		return JSON.stringify(res);
	},
	isLoanerModelsExist: function () {
		var location = this.getParameter('sysparm_location');
		if (!gs.nil(this.getParameter('sysparm_model'))) {
			var model = this.getParameter('sysparm_model');
			if (new sn_hamp.HampLoanerUtils().isLoanerAssetExist(location, model)) {
				return 'yes';
			}
		}
		if (new sn_hamp.HampLoanerUtils().isLoanerAssetExist(location)) {
			return 'modelNotPresent';
		}
		return 'noLoanerModels';
	},
	isLoanerAssetAvailable: function () {
		var model = this.getParameter('sysparm_model');
		var location = this.getParameter('sysparm_location');
		var startDateUserFormat = this.getParameter('sysparm_start_date');
		var returnDateUserFormat = this.getParameter('sysparm_return_date');
		var leadTimeInDays = this.getParameter('sysparm_lead_time');

		var startDate = HAMUtils.getDateInInternalFormat(startDateUserFormat);
		var returnDate = HAMUtils.getDateInInternalFormat(returnDateUserFormat);

		var isLoanerAssetAvailable = new sn_hamp.HAMAssetReservationUtils().isLoanerAssetAvailableBetweenDates(
			model,
			location,
			startDate,
			returnDate,
			leadTimeInDays
		);

		var message = '';
		if (!isLoanerAssetAvailable) {
			message = gs.getMessage(
				'There are no loaner assets available for this time period. If you choose to submit, your request will join a waitlist.' // eslint-disable-line
			);
		}

		return JSON.stringify({
			isAvailable: isLoanerAssetAvailable,
			message: message,
		});
	},
	getLoanerOrder: function() {
		var sysId = this.getParameter('sysparm_loaner');
		var loanerId;
		var tableName = this.getParameter('sysparm_table');
		if (tableName === sn_hamp.HampLoanerUtils.LOANER_TASK_TABLE) {
			loanerId = new global.GlideQuery(sn_hamp.HampLoanerUtils.LOANER_TASK_TABLE)
				.withAcls()
				.where('sys_id', sysId)
				.select('loaner_order')
				.toArray(1);
			loanerId = loanerId[0].loaner_order;
		} else {
			loanerId = sysId;
		}
		var response = new global.GlideQuery(sn_hamp.HampLoanerUtils.LOANER_ORDER_TABLE)
			.withAcls()
			.where('sys_id', loanerId)
			.selectOne('asset.sys_id', 'asset.display_name', 'asset_stockroom')
			.get();
		return JSON.stringify(response);
	},
	type: 'HampLoanerAjaxUtils',
});
/* General Styles */
body {
    margin: 0;
}

html {
    scroll-behavior: smooth;
}

/* Carousel */
#carousel-container {
    width: 100%;
    overflow-x: hidden;
    background-color: rgba(255, 255, 255, 0);
    z-index: 920;
}

#carousel {
    white-space: nowrap;
    animation: scroll 40s linear infinite;
    margin-bottom: 20px;
    z-index: 921;
}

#carousel img {
    max-width: 100%;
    height: auto;
    display: inline-block;
    margin-right: -5px;
}

/* Home Services */
.home-services {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    background-color: #515151;
    text-align: center;
    padding: 0;
}

.home-services a h2 {
    font-size: 15px;
    color: #ffffff;
    background-color: #515151;
    transition: color .5s ease, background-color .5s ease;
    padding: 20px 30px;
    border-radius: 200px;
    margin: 10px;
    border: 0;
}

.home-services a h2:hover {
    color: #ffffff;
    background-color: #4A1621;
}

/* Home Content */
.home-content {
    line-height: 25px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.home-item {
    display: flex;
    justify-content: space-between;
    background-color: #000000;
    align-items: center;
    transition: background-color 1s ease;
    border-radius: 200px;
    margin: 20px;
    cursor: pointer;
}

.home-item:hover {
    background-color: #515151;
}

.home-text {
    margin: 0 4vw 0 4vw;
    font-size: 16px;
}

.home-img img {
    width: 20vw;
    height: 100%;
}

.home-item ul {
    font-family: nunito;
    text-indent: 10px;
    color: white;
    line-height: 2vw;
    display: none;
}

.arrow img {
    width: 4vw;
    margin: 0 10vw;
    transform: translateX(0);
    transition: 2s ease;
}

.home-item:hover .arrow img {
    transform: translateX(30px);
}

.home-content h1,
.home-content h2 {
    color: white;
    white-space: nowrap;
}

/* Hero */
.hero-image img {
    width: 100%;
    height: auto;
    display: block;
    z-index: 2;
    opacity: .4;
    transition: opacity 1s ease-in-out;
}

/* Hero Mobile */
@media (max-width: 900px) {
    .home-title h1 {
        display: none;
    }

    .hero-buttons {
        display: flex;
        justify-content: center;
        flex-direction: column;
        align-items: center;
        width: 100%;
        margin: 10px 0;
    }

    .hero-image {
        position: relative;
        width: 100%;
        height: auto;
    }

    .hero-image img {
        width: 100%;
        height: 500px;
        display: block;
        object-fit: cover;
    }

    .hero-content {
        position: absolute;
        display: flex;
        flex-direction: column;
        top: 20vh;
        left: 50%;
        transform: translate(-50%, -50%);
        text-align: center;
        color: #fff;
        z-index: 1;
        width: 100%;
        justify-content: center;
    }

    .hero-content button {
        border-radius: 200px;
        border: none;
        padding: 15px;
        font-family: Montserrat;
        cursor: pointer;
        margin: 5px;
        background-color: #fff;
        transition: .5s ease;
        width: 60vw;
        font-size: 15px;
        line-height: 14px;
        align-items: center;
        display: flex;
        justify-content: center;
    }

    .hero-content button:hover {
        background-color: black;
        color: white;
    }
}
string JSONresult;
JSONresult = JsonConvert.SerializeObject(dt);  
Response.Write(JSONresult);
[4, 5, 6, 7].at(1)         // 5
[4, 5, 6, 7].push(8)       // [4, 5, 6, 7, 8]
[4, 5, 6, 7].pop()         //[4, 5, 6, ]
[4, 5, 6, 7].fil(1)        //[1, 1, 1, 1]
[4, 5, 6, 7].join(' ')     //'4 5 6 7 '(string)
[4, 5, 6, 7].shift()       //[ 5, 6, 7]
[4, 5, 6, 7].reverse()     //[7, 6, 5, 4]
[4, 5, 6, 7].unshift(3)    // [3, 4, 5, 6, 7]
[4, 5, 6, 7].includes(6)   //true
[4, 5, 6, 7].map(item => 2*item) // [8, 10, 12, 14]
[4, 5, 6, 7].filter(item => item > 5)  //[6,7]
[4, 5, 6, 7].find(item => item > 5)    //6 (first match)
[4, 5, 6, 7].every(item => item > 0)   // true
[4, 5, 6, 7].findIndex(item => item === 5)  // 1
[4, 5, 6, 7].reduce((prev, curr) => prev+curr, 0)   //22
word = 'Python'

word[:2]   # character from the beginning to position 2 (excluded)
# 'Py'
word[4:]   # characters from position 4 (included) to the end
# 'on'
word[-2:]  # characters from the second-last (included) to the end
# 'on'
# Single line comments start with a number symbol.

""" Multiline strings can be written
    using three "s, and are often used
    as documentation.
"""

####################################################
## 1. Primitive Datatypes and Operators
####################################################

# You have numbers
3  # => 3

# Math is what you would expect
1 + 1   # => 2
8 - 1   # => 7
10 * 2  # => 20
35 / 5  # => 7.0

# Integer division rounds down for both positive and negative numbers.
5 // 3       # => 1
-5 // 3      # => -2
5.0 // 3.0   # => 1.0 # works on floats too
-5.0 // 3.0  # => -2.0

# The result of division is always a float
10.0 / 3  # => 3.3333333333333335

# Modulo operation
7 % 3   # => 1
# i % j have the same sign as j, unlike C
-7 % 3  # => 2

# Exponentiation (x**y, x to the yth power)
2**3  # => 8

# Enforce precedence with parentheses
1 + 3 * 2    # => 7
(1 + 3) * 2  # => 8

# Boolean values are primitives (Note: the capitalization)
True   # => True
False  # => False

# negate with not
not True   # => False
not False  # => True

# Boolean Operators
# Note "and" and "or" are case-sensitive
True and False  # => False
False or True   # => True

# True and False are actually 1 and 0 but with different keywords
True + True # => 2
True * 8    # => 8
False - 5   # => -5

# Comparison operators look at the numerical value of True and False
0 == False  # => True
2 > True    # => True
2 == True   # => False
-5 != False # => True

# None, 0, and empty strings/lists/dicts/tuples/sets all evaluate to False.
# All other values are True
bool(0)     # => False
bool("")    # => False
bool([])    # => False
bool({})    # => False
bool(())    # => False
bool(set()) # => False
bool(4)     # => True
bool(-6)    # => True

# Using boolean logical operators on ints casts them to booleans for evaluation,
# but their non-cast value is returned. Don't mix up with bool(ints) and bitwise
# and/or (&,|)
bool(0)     # => False
bool(2)     # => True
0 and 2     # => 0
bool(-5)    # => True
bool(2)     # => True
-5 or 0     # => -5

# Equality is ==
1 == 1  # => True
2 == 1  # => False

# Inequality is !=
1 != 1  # => False
2 != 1  # => True

# More comparisons
1 < 10  # => True
1 > 10  # => False
2 <= 2  # => True
2 >= 2  # => True

# Seeing whether a value is in a range
1 < 2 and 2 < 3  # => True
2 < 3 and 3 < 2  # => False
# Chaining makes this look nicer
1 < 2 < 3  # => True
2 < 3 < 2  # => False

# (is vs. ==) is checks if two variables refer to the same object, but == checks
# if the objects pointed to have the same values.
a = [1, 2, 3, 4]  # Point a at a new list, [1, 2, 3, 4]
b = a             # Point b at what a is pointing to
b is a            # => True, a and b refer to the same object
b == a            # => True, a's and b's objects are equal
b = [1, 2, 3, 4]  # Point b at a new list, [1, 2, 3, 4]
b is a            # => False, a and b do not refer to the same object
b == a            # => True, a's and b's objects are equal

# Strings are created with " or '
"This is a string."
'This is also a string.'

# Strings can be added too
"Hello " + "world!"  # => "Hello world!"
# String literals (but not variables) can be concatenated without using '+'
"Hello " "world!"    # => "Hello world!"

# A string can be treated like a list of characters
"Hello world!"[0]  # => 'H'

# You can find the length of a string
len("This is a string")  # => 16

# Since Python 3.6, you can use f-strings or formatted string literals.
name = "Reiko"
f"She said her name is {name}." # => "She said her name is Reiko"
# Any valid Python expression inside these braces is returned to the string.
f"{name} is {len(name)} characters long." # => "Reiko is 5 characters long."

# None is an object
None  # => None

# Don't use the equality "==" symbol to compare objects to None
# Use "is" instead. This checks for equality of object identity.
"etc" is None  # => False
None is None   # => True

####################################################
## 2. Variables and Collections
####################################################

# Python has a print function
print("I'm Python. Nice to meet you!")  # => I'm Python. Nice to meet you!

# By default the print function also prints out a newline at the end.
# Use the optional argument end to change the end string.
print("Hello, World", end="!")  # => Hello, World!

# Simple way to get input data from console
input_string_var = input("Enter some data: ") # Returns the data as a string

# There are no declarations, only assignments.
# Convention is to use lower_case_with_underscores
some_var = 5
some_var  # => 5

# Accessing a previously unassigned variable is an exception.
# See Control Flow to learn more about exception handling.
some_unknown_var  # Raises a NameError

# if can be used as an expression
# Equivalent of C's '?:' ternary operator
"yay!" if 0 > 1 else "nay!"  # => "nay!"

# Lists store sequences
li = []
# You can start with a prefilled list
other_li = [4, 5, 6]

# Add stuff to the end of a list with append
li.append(1)    # li is now [1]
li.append(2)    # li is now [1, 2]
li.append(4)    # li is now [1, 2, 4]
li.append(3)    # li is now [1, 2, 4, 3]
# Remove from the end with pop
li.pop()        # => 3 and li is now [1, 2, 4]
# Let's put it back
li.append(3)    # li is now [1, 2, 4, 3] again.

# Access a list like you would any array
li[0]   # => 1
# Look at the last element
li[-1]  # => 3

# Looking out of bounds is an IndexError
li[4]  # Raises an IndexError

# You can look at ranges with slice syntax.
# The start index is included, the end index is not
# (It's a closed/open range for you mathy types.)
li[1:3]   # Return list from index 1 to 3 => [2, 4]
li[2:]    # Return list starting from index 2 => [4, 3]
li[:3]    # Return list from beginning until index 3  => [1, 2, 4]
li[::2]   # Return list selecting every second entry => [1, 4]
li[::-1]  # Return list in reverse order => [3, 4, 2, 1]
# Use any combination of these to make advanced slices
# li[start:end:step]

# Make a one layer deep copy using slices
li2 = li[:]  # => li2 = [1, 2, 4, 3] but (li2 is li) will result in false.

# Remove arbitrary elements from a list with "del"
del li[2]  # li is now [1, 2, 3]

# Remove first occurrence of a value
li.remove(2)  # li is now [1, 3]
li.remove(2)  # Raises a ValueError as 2 is not in the list

# Insert an element at a specific index
li.insert(1, 2)  # li is now [1, 2, 3] again

# Get the index of the first item found matching the argument
li.index(2)  # => 1
li.index(4)  # Raises a ValueError as 4 is not in the list

# You can add lists
# Note: values for li and for other_li are not modified.
li + other_li  # => [1, 2, 3, 4, 5, 6]

# Concatenate lists with "extend()"
li.extend(other_li)  # Now li is [1, 2, 3, 4, 5, 6]

# Check for existence in a list with "in"
1 in li  # => True

# Examine the length with "len()"
len(li)  # => 6


# Tuples are like lists but are immutable.
tup = (1, 2, 3)
tup[0]      # => 1
tup[0] = 3  # Raises a TypeError

# Note that a tuple of length one has to have a comma after the last element but
# tuples of other lengths, even zero, do not.
type((1))   # => <class 'int'>
type((1,))  # => <class 'tuple'>
type(())    # => <class 'tuple'>

# You can do most of the list operations on tuples too
len(tup)         # => 3
tup + (4, 5, 6)  # => (1, 2, 3, 4, 5, 6)
tup[:2]          # => (1, 2)
2 in tup         # => True

# You can unpack tuples (or lists) into variables
a, b, c = (1, 2, 3)  # a is now 1, b is now 2 and c is now 3
# You can also do extended unpacking
a, *b, c = (1, 2, 3, 4)  # a is now 1, b is now [2, 3] and c is now 4
# Tuples are created by default if you leave out the parentheses
d, e, f = 4, 5, 6  # tuple 4, 5, 6 is unpacked into variables d, e and f
# respectively such that d = 4, e = 5 and f = 6
# Now look how easy it is to swap two values
e, d = d, e  # d is now 5 and e is now 4


# Dictionaries store mappings from keys to values
empty_dict = {}
# Here is a prefilled dictionary
filled_dict = {"one": 1, "two": 2, "three": 3}

# Note keys for dictionaries have to be immutable types. This is to ensure that
# the key can be converted to a constant hash value for quick look-ups.
# Immutable types include ints, floats, strings, tuples.
invalid_dict = {[1,2,3]: "123"}  # => Yield a TypeError: unhashable type: 'list'
valid_dict = {(1,2,3):[1,2,3]}   # Values can be of any type, however.

# Look up values with []
filled_dict["one"]  # => 1

# Get all keys as an iterable with "keys()". We need to wrap the call in list()
# to turn it into a list. We'll talk about those later.  Note - for Python
# versions <3.7, dictionary key ordering is not guaranteed. Your results might
# not match the example below exactly. However, as of Python 3.7, dictionary
# items maintain the order at which they are inserted into the dictionary.
list(filled_dict.keys())  # => ["three", "two", "one"] in Python <3.7
list(filled_dict.keys())  # => ["one", "two", "three"] in Python 3.7+


# Get all values as an iterable with "values()". Once again we need to wrap it
# in list() to get it out of the iterable. Note - Same as above regarding key
# ordering.
list(filled_dict.values())  # => [3, 2, 1]  in Python <3.7
list(filled_dict.values())  # => [1, 2, 3] in Python 3.7+

# Check for existence of keys in a dictionary with "in"
"one" in filled_dict  # => True
1 in filled_dict      # => False

# Looking up a non-existing key is a KeyError
filled_dict["four"]  # KeyError

# Use "get()" method to avoid the KeyError
filled_dict.get("one")      # => 1
filled_dict.get("four")     # => None
# The get method supports a default argument when the value is missing
filled_dict.get("one", 4)   # => 1
filled_dict.get("four", 4)  # => 4

# "setdefault()" inserts into a dictionary only if the given key isn't present
filled_dict.setdefault("five", 5)  # filled_dict["five"] is set to 5
filled_dict.setdefault("five", 6)  # filled_dict["five"] is still 5

# Adding to a dictionary
filled_dict.update({"four":4})  # => {"one": 1, "two": 2, "three": 3, "four": 4}
filled_dict["four"] = 4         # another way to add to dict

# Remove keys from a dictionary with del
del filled_dict["one"]  # Removes the key "one" from filled dict

# From Python 3.5 you can also use the additional unpacking options
{'a': 1, **{'b': 2}}  # => {'a': 1, 'b': 2}
{'a': 1, **{'a': 2}}  # => {'a': 2}



# Sets store ... well sets
empty_set = set()
# Initialize a set with a bunch of values.
some_set = {1, 1, 2, 2, 3, 4}  # some_set is now {1, 2, 3, 4}

# Similar to keys of a dictionary, elements of a set have to be immutable.
invalid_set = {[1], 1}  # => Raises a TypeError: unhashable type: 'list'
valid_set = {(1,), 1}

# Add one more item to the set
filled_set = some_set
filled_set.add(5)  # filled_set is now {1, 2, 3, 4, 5}
# Sets do not have duplicate elements
filled_set.add(5)  # it remains as before {1, 2, 3, 4, 5}

# Do set intersection with &
other_set = {3, 4, 5, 6}
filled_set & other_set  # => {3, 4, 5}

# Do set union with |
filled_set | other_set  # => {1, 2, 3, 4, 5, 6}

# Do set difference with -
{1, 2, 3, 4} - {2, 3, 5}  # => {1, 4}

# Do set symmetric difference with ^
{1, 2, 3, 4} ^ {2, 3, 5}  # => {1, 4, 5}

# Check if set on the left is a superset of set on the right
{1, 2} >= {1, 2, 3} # => False

# Check if set on the left is a subset of set on the right
{1, 2} <= {1, 2, 3} # => True

# Check for existence in a set with in
2 in filled_set   # => True
10 in filled_set  # => False

# Make a one layer deep copy
filled_set = some_set.copy()  # filled_set is {1, 2, 3, 4, 5}
filled_set is some_set        # => False


####################################################
## 3. Control Flow and Iterables
####################################################

# Let's just make a variable
some_var = 5

# Here is an if statement. Indentation is significant in Python!
# Convention is to use four spaces, not tabs.
# This prints "some_var is smaller than 10"
if some_var > 10:
    print("some_var is totally bigger than 10.")
elif some_var < 10:    # This elif clause is optional.
    print("some_var is smaller than 10.")
else:                  # This is optional too.
    print("some_var is indeed 10.")


"""
For loops iterate over lists
prints:
    dog is a mammal
    cat is a mammal
    mouse is a mammal
"""
for animal in ["dog", "cat", "mouse"]:
    # You can use format() to interpolate formatted strings
    print("{} is a mammal".format(animal))

"""
"range(number)" returns an iterable of numbers
from zero up to (but excluding) the given number
prints:
    0
    1
    2
    3
"""
for i in range(4):
    print(i)

"""
"range(lower, upper)" returns an iterable of numbers
from the lower number to the upper number
prints:
    4
    5
    6
    7
"""
for i in range(4, 8):
    print(i)

"""
"range(lower, upper, step)" returns an iterable of numbers
from the lower number to the upper number, while incrementing
by step. If step is not indicated, the default value is 1.
prints:
    4
    6
"""
for i in range(4, 8, 2):
    print(i)

"""
Loop over a list to retrieve both the index and the value of each list item:
    0 dog
    1 cat
    2 mouse
"""
animals = ["dog", "cat", "mouse"]
for i, value in enumerate(animals):
    print(i, value)

"""
While loops go until a condition is no longer met.
prints:
    0
    1
    2
    3
"""
x = 0
while x < 4:
    print(x)
    x += 1  # Shorthand for x = x + 1

# Handle exceptions with a try/except block
try:
    # Use "raise" to raise an error
    raise IndexError("This is an index error")
except IndexError as e:
    pass                 # Refrain from this, provide a recovery (next example).
except (TypeError, NameError):
    pass                 # Multiple exceptions can be processed jointly.
else:                    # Optional clause to the try/except block. Must follow
                         # all except blocks.
    print("All good!")   # Runs only if the code in try raises no exceptions
finally:                 # Execute under all circumstances
    print("We can clean up resources here")

# Instead of try/finally to cleanup resources you can use a with statement
with open("myfile.txt") as f:
    for line in f:
        print(line)

# Writing to a file
contents = {"aa": 12, "bb": 21}
with open("myfile1.txt", "w+") as file:
    file.write(str(contents))        # writes a string to a file

import json
with open("myfile2.txt", "w+") as file:
    file.write(json.dumps(contents)) # writes an object to a file

# Reading from a file
with open('myfile1.txt', "r+") as file:
    contents = file.read()           # reads a string from a file
print(contents)
# print: {"aa": 12, "bb": 21}

with open('myfile2.txt', "r+") as file:
    contents = json.load(file)       # reads a json object from a file
print(contents)
# print: {"aa": 12, "bb": 21}


# Python offers a fundamental abstraction called the Iterable.
# An iterable is an object that can be treated as a sequence.
# The object returned by the range function, is an iterable.

filled_dict = {"one": 1, "two": 2, "three": 3}
our_iterable = filled_dict.keys()
print(our_iterable)  # => dict_keys(['one', 'two', 'three']). This is an object
                     # that implements our Iterable interface.

# We can loop over it.
for i in our_iterable:
    print(i)  # Prints one, two, three

# However we cannot address elements by index.
our_iterable[1]  # Raises a TypeError

# An iterable is an object that knows how to create an iterator.
our_iterator = iter(our_iterable)

# Our iterator is an object that can remember the state as we traverse through
# it. We get the next object with "next()".
next(our_iterator)  # => "one"

# It maintains state as we iterate.
next(our_iterator)  # => "two"
next(our_iterator)  # => "three"

# After the iterator has returned all of its data, it raises a
# StopIteration exception
next(our_iterator)  # Raises StopIteration

# We can also loop over it, in fact, "for" does this implicitly!
our_iterator = iter(our_iterable)
for i in our_iterator:
    print(i)  # Prints one, two, three

# You can grab all the elements of an iterable or iterator by call of list().
list(our_iterable)  # => Returns ["one", "two", "three"]
list(our_iterator)  # => Returns [] because state is saved


####################################################
## 4. Functions
####################################################

# Use "def" to create new functions
def add(x, y):
    print("x is {} and y is {}".format(x, y))
    return x + y  # Return values with a return statement

# Calling functions with parameters
add(5, 6)  # => prints out "x is 5 and y is 6" and returns 11

# Another way to call functions is with keyword arguments
add(y=6, x=5)  # Keyword arguments can arrive in any order.

# You can define functions that take a variable number of
# positional arguments
def varargs(*args):
    return args

varargs(1, 2, 3)  # => (1, 2, 3)

# You can define functions that take a variable number of
# keyword arguments, as well
def keyword_args(**kwargs):
    return kwargs

# Let's call it to see what happens
keyword_args(big="foot", loch="ness")  # => {"big": "foot", "loch": "ness"}


# You can do both at once, if you like
def all_the_args(*args, **kwargs):
    print(args)
    print(kwargs)
"""
all_the_args(1, 2, a=3, b=4) prints:
    (1, 2)
    {"a": 3, "b": 4}
"""

# When calling functions, you can do the opposite of args/kwargs!
# Use * to expand tuples and use ** to expand kwargs.
args = (1, 2, 3, 4)
kwargs = {"a": 3, "b": 4}
all_the_args(*args)            # equivalent: all_the_args(1, 2, 3, 4)
all_the_args(**kwargs)         # equivalent: all_the_args(a=3, b=4)
all_the_args(*args, **kwargs)  # equivalent: all_the_args(1, 2, 3, 4, a=3, b=4)

# Returning multiple values (with tuple assignments)
def swap(x, y):
    return y, x  # Return multiple values as a tuple without the parenthesis.
                 # (Note: parenthesis have been excluded but can be included)

x = 1
y = 2
x, y = swap(x, y)     # => x = 2, y = 1
# (x, y) = swap(x,y)  # Again the use of parenthesis is optional.

# global scope
x = 5

def set_x(num):
    # local scope begins here
    # local var x not the same as global var x
    x = num    # => 43
    print(x)   # => 43

def set_global_x(num):
    # global indicates that particular var lives in the global scope
    global x
    print(x)   # => 5
    x = num    # global var x is now set to 6
    print(x)   # => 6

set_x(43)
set_global_x(6)
"""
prints:
    43
    5
    6
"""


# Python has first class functions
def create_adder(x):
    def adder(y):
        return x + y
    return adder

add_10 = create_adder(10)
add_10(3)   # => 13

# There are also anonymous functions
(lambda x: x > 2)(3)                  # => True
(lambda x, y: x ** 2 + y ** 2)(2, 1)  # => 5

# There are built-in higher order functions
list(map(add_10, [1, 2, 3]))          # => [11, 12, 13]
list(map(max, [1, 2, 3], [4, 2, 1]))  # => [4, 2, 3]

list(filter(lambda x: x > 5, [3, 4, 5, 6, 7]))  # => [6, 7]

# We can use list comprehensions for nice maps and filters
# List comprehension stores the output as a list (which itself may be nested).
[add_10(i) for i in [1, 2, 3]]         # => [11, 12, 13]
[x for x in [3, 4, 5, 6, 7] if x > 5]  # => [6, 7]

# You can construct set and dict comprehensions as well.
{x for x in 'abcddeef' if x not in 'abc'}  # => {'d', 'e', 'f'}
{x: x**2 for x in range(5)}  # => {0: 0, 1: 1, 2: 4, 3: 9, 4: 16}


####################################################
## 5. Modules
####################################################

# You can import modules
import math
print(math.sqrt(16))  # => 4.0

# You can get specific functions from a module
from math import ceil, floor
print(ceil(3.7))   # => 4.0
print(floor(3.7))  # => 3.0

# You can import all functions from a module.
# Warning: this is not recommended
from math import *

# You can shorten module names
import math as m
math.sqrt(16) == m.sqrt(16)  # => True

# Python modules are just ordinary Python files. You
# can write your own, and import them. The name of the
# module is the same as the name of the file.

# You can find out which functions and attributes
# are defined in a module.
import math
dir(math)

# If you have a Python script named math.py in the same
# folder as your current script, the file math.py will
# be loaded instead of the built-in Python module.
# This happens because the local folder has priority
# over Python's built-in libraries.


####################################################
## 6. Classes
####################################################

# We use the "class" statement to create a class
class Human:

    # A class attribute. It is shared by all instances of this class
    species = "H. sapiens"

    # Basic initializer, this is called when this class is instantiated.
    # Note that the double leading and trailing underscores denote objects
    # or attributes that are used by Python but that live in user-controlled
    # namespaces. Methods(or objects or attributes) like: __init__, __str__,
    # __repr__ etc. are called special methods (or sometimes called dunder
    # methods). You should not invent such names on your own.
    def __init__(self, name):
        # Assign the argument to the instance's name attribute
        self.name = name

        # Initialize property
        self._age = 0

    # An instance method. All methods take "self" as the first argument
    def say(self, msg):
        print("{name}: {message}".format(name=self.name, message=msg))

    # Another instance method
    def sing(self):
        return 'yo... yo... microphone check... one two... one two...'

    # A class method is shared among all instances
    # They are called with the calling class as the first argument
    @classmethod
    def get_species(cls):
        return cls.species

    # A static method is called without a class or instance reference
    @staticmethod
    def grunt():
        return "*grunt*"

    # A property is just like a getter.
    # It turns the method age() into a read-only attribute of the same name.
    # There's no need to write trivial getters and setters in Python, though.
    @property
    def age(self):
        return self._age

    # This allows the property to be set
    @age.setter
    def age(self, age):
        self._age = age

    # This allows the property to be deleted
    @age.deleter
    def age(self):
        del self._age


# When a Python interpreter reads a source file it executes all its code.
# This __name__ check makes sure this code block is only executed when this
# module is the main program.
if __name__ == '__main__':
    # Instantiate a class
    i = Human(name="Ian")
    i.say("hi")                     # "Ian: hi"
    j = Human("Joel")
    j.say("hello")                  # "Joel: hello"
    # i and j are instances of type Human; i.e., they are Human objects.

    # Call our class method
    i.say(i.get_species())          # "Ian: H. sapiens"
    # Change the shared attribute
    Human.species = "H. neanderthalensis"
    i.say(i.get_species())          # => "Ian: H. neanderthalensis"
    j.say(j.get_species())          # => "Joel: H. neanderthalensis"

    # Call the static method
    print(Human.grunt())            # => "*grunt*"

    # Static methods can be called by instances too
    print(i.grunt())                # => "*grunt*"

    # Update the property for this instance
    i.age = 42
    # Get the property
    i.say(i.age)                    # => "Ian: 42"
    j.say(j.age)                    # => "Joel: 0"
    # Delete the property
    del i.age
    # i.age                         # => this would raise an AttributeError


####################################################
## 6.1 Inheritance
####################################################

# Inheritance allows new child classes to be defined that inherit methods and
# variables from their parent class.

# Using the Human class defined above as the base or parent class, we can
# define a child class, Superhero, which inherits the class variables like
# "species", "name", and "age", as well as methods, like "sing" and "grunt"
# from the Human class, but can also have its own unique properties.

# To take advantage of modularization by file you could place the classes above
# in their own files, say, human.py

# To import functions from other files use the following format
# from "filename-without-extension" import "function-or-class"

from human import Human


# Specify the parent class(es) as parameters to the class definition
class Superhero(Human):

    # If the child class should inherit all of the parent's definitions without
    # any modifications, you can just use the "pass" keyword (and nothing else)
    # but in this case it is commented out to allow for a unique child class:
    # pass

    # Child classes can override their parents' attributes
    species = 'Superhuman'

    # Children automatically inherit their parent class's constructor including
    # its arguments, but can also define additional arguments or definitions
    # and override its methods such as the class constructor.
    # This constructor inherits the "name" argument from the "Human" class and
    # adds the "superpower" and "movie" arguments:
    def __init__(self, name, movie=False,
                 superpowers=["super strength", "bulletproofing"]):

        # add additional class attributes:
        self.fictional = True
        self.movie = movie
        # be aware of mutable default values, since defaults are shared
        self.superpowers = superpowers

        # The "super" function lets you access the parent class's methods
        # that are overridden by the child, in this case, the __init__ method.
        # This calls the parent class constructor:
        super().__init__(name)

    # override the sing method
    def sing(self):
        return 'Dun, dun, DUN!'

    # add an additional instance method
    def boast(self):
        for power in self.superpowers:
            print("I wield the power of {pow}!".format(pow=power))


if __name__ == '__main__':
    sup = Superhero(name="Tick")

    # Instance type checks
    if isinstance(sup, Human):
        print('I am human')
    if type(sup) is Superhero:
        print('I am a superhero')

    # Get the Method Resolution search Order used by both getattr() and super()
    # This attribute is dynamic and can be updated
    print(Superhero.__mro__)    # => (<class '__main__.Superhero'>,
                                # => <class 'human.Human'>, <class 'object'>)

    # Calls parent method but uses its own class attribute
    print(sup.get_species())    # => Superhuman

    # Calls overridden method
    print(sup.sing())           # => Dun, dun, DUN!

    # Calls method from Human
    sup.say('Spoon')            # => Tick: Spoon

    # Call method that exists only in Superhero
    sup.boast()                 # => I wield the power of super strength!
                                # => I wield the power of bulletproofing!

    # Inherited class attribute
    sup.age = 31
    print(sup.age)              # => 31

    # Attribute that only exists within Superhero
    print('Am I Oscar eligible? ' + str(sup.movie))

####################################################
## 6.2 Multiple Inheritance
####################################################

# Another class definition
# bat.py
class Bat:

    species = 'Baty'

    def __init__(self, can_fly=True):
        self.fly = can_fly

    # This class also has a say method
    def say(self, msg):
        msg = '... ... ...'
        return msg

    # And its own method as well
    def sonar(self):
        return '))) ... ((('

if __name__ == '__main__':
    b = Bat()
    print(b.say('hello'))
    print(b.fly)


# And yet another class definition that inherits from Superhero and Bat
# superhero.py
from superhero import Superhero
from bat import Bat

# Define Batman as a child that inherits from both Superhero and Bat
class Batman(Superhero, Bat):

    def __init__(self, *args, **kwargs):
        # Typically to inherit attributes you have to call super:
        # super(Batman, self).__init__(*args, **kwargs)
        # However we are dealing with multiple inheritance here, and super()
        # only works with the next base class in the MRO list.
        # So instead we explicitly call __init__ for all ancestors.
        # The use of *args and **kwargs allows for a clean way to pass
        # arguments, with each parent "peeling a layer of the onion".
        Superhero.__init__(self, 'anonymous', movie=True,
                           superpowers=['Wealthy'], *args, **kwargs)
        Bat.__init__(self, *args, can_fly=False, **kwargs)
        # override the value for the name attribute
        self.name = 'Sad Affleck'

    def sing(self):
        return 'nan nan nan nan nan batman!'


if __name__ == '__main__':
    sup = Batman()

    # Get the Method Resolution search Order used by both getattr() and super().
    # This attribute is dynamic and can be updated
    print(Batman.__mro__)       # => (<class '__main__.Batman'>,
                                # => <class 'superhero.Superhero'>,
                                # => <class 'human.Human'>,
                                # => <class 'bat.Bat'>, <class 'object'>)

    # Calls parent method but uses its own class attribute
    print(sup.get_species())    # => Superhuman

    # Calls overridden method
    print(sup.sing())           # => nan nan nan nan nan batman!

    # Calls method from Human, because inheritance order matters
    sup.say('I agree')          # => Sad Affleck: I agree

    # Call method that exists only in 2nd ancestor
    print(sup.sonar())          # => ))) ... (((

    # Inherited class attribute
    sup.age = 100
    print(sup.age)              # => 100

    # Inherited attribute from 2nd ancestor whose default value was overridden.
    print('Can I fly? ' + str(sup.fly)) # => Can I fly? False



####################################################
## 7. Advanced
####################################################

# Generators help you make lazy code.
def double_numbers(iterable):
    for i in iterable:
        yield i + i

# Generators are memory-efficient because they only load the data needed to
# process the next value in the iterable. This allows them to perform
# operations on otherwise prohibitively large value ranges.
# NOTE: `range` replaces `xrange` in Python 3.
for i in double_numbers(range(1, 900000000)):  # `range` is a generator.
    print(i)
    if i >= 30:
        break

# Just as you can create a list comprehension, you can create generator
# comprehensions as well.
values = (-x for x in [1,2,3,4,5])
for x in values:
    print(x)  # prints -1 -2 -3 -4 -5 to console/terminal

# You can also cast a generator comprehension directly to a list.
values = (-x for x in [1,2,3,4,5])
gen_to_list = list(values)
print(gen_to_list)  # => [-1, -2, -3, -4, -5]


# Decorators
# In this example `beg` wraps `say`. If say_please is True then it
# will change the returned message.
from functools import wraps


def beg(target_function):
    @wraps(target_function)
    def wrapper(*args, **kwargs):
        msg, say_please = target_function(*args, **kwargs)
        if say_please:
            return "{} {}".format(msg, "Please! I am poor :(")
        return msg

    return wrapper


@beg
def say(say_please=False):
    msg = "Can you buy me a beer?"
    return msg, say_please


print(say())                 # Can you buy me a beer?
print(say(say_please=True))  # Can you buy me a beer? Please! I am poor :(
<!DOCTYPE html>
<html>
  <head>
    <title>My Website</title>
  </head>
  <body>
    <header>
      <h1>Welcome to my website!</h1>
    </header>
    <nav>
      <ul>
        <li><a href="#about">About</a></li>
        <li><a href="#services">Services</a></li>
        <li><a href="#contact">Contact</a></li>
      </ul>
    </nav>
    <main>
      <section id="about">
        <h2>About Us</h2>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc vel mauris vel lorem lacinia sodales ut at sapien. Nam euismod nisl et facilisis maximus. Donec eget tortor sit amet lacus gravida pellentesque. </p>
      </section>
      <section id="services">
        <h2>Our Services</h2>
        <ul>
          <li>Service 1</li>
          <li>Service 2</li>
          <li>Service 3</li>
        </ul>
      </section>
      <section id="contact">
        <h2>Contact Us</h2>
        <form>
          <label for="name">Name:</label>
          <input type="text" id="name" name="name">
          <label for="email">Email:</label>
          <input type="email" id="email" name="email">
          <label for="message">Message:</label>
          <textarea id="message" name="message"></textarea>
          <button type="submit">Send Message</button>
        </form>
      </section>
    </main>
    <footer>
      <p>&copy; 2023 My Website. All rights reserved.</p>
    </footer>
  </body>
</html>
!cd /content/gdrive/MyDrive/sd/stable-diffusion-webui/models/StableDiffusion; wget https://huggingface.co/wavymulder/Analog-Diffusion/resolve/main/analog-diffusion-1.0.safetensors
#define echoPin 2 // attach pin D2 Arduino to pin Echo of HC-SR04
#define trigPin 3 //attach pin D3 Arduino to pin Trig of HC-SR04

// defines variables
long duration; // variable for the duration of sound wave travel
int distance; // variable for the distance measurement

void setup() {
  pinMode(trigPin, OUTPUT); // Sets the trigPin as an OUTPUT
  pinMode(echoPin, INPUT); // Sets the echoPin as an INPUT
  Serial.begin(9600); // // Serial Communication is starting with 9600 of baudrate speed
  Serial.println("Ultrasonic Sensor HC-SR04 Test"); // print some text in Serial Monitor
  Serial.println("with Arduino UNO R3");
}
void loop() {
  // Clears the trigPin condition
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  // Sets the trigPin HIGH (ACTIVE) for 10 microseconds
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  // Reads the echoPin, returns the sound wave travel time in microseconds
  duration = pulseIn(echoPin, HIGH);
  // Calculating the distance
  distance = duration * 0.034 / 2; // Speed of sound wave divided by 2 (go and back)
  // Displays the distance on the Serial Monitor
  Serial.print("Distance: ");
  Serial.print(distance);
  Serial.println(" cm");
}
int a = 2;  //For displaying segment "a"
int b = 3;  //For displaying segment "b"
int c = 4;  //For displaying segment "c"
int d = 5;  //For displaying segment "d"
int e = 6;  //For displaying segment "e"
int f = 8;  //For displaying segment "f"
int g = 9;  //For displaying segment "g"

void setup() {               
  pinMode(a, OUTPUT);  //A
  pinMode(b, OUTPUT);  //B
  pinMode(c, OUTPUT);  //C
  pinMode(d, OUTPUT);  //D
  pinMode(e, OUTPUT);  //E
  pinMode(f, OUTPUT);  //F
  pinMode(g, OUTPUT);  //G
}

void turnOff()
{
  digitalWrite(a,LOW);
  digitalWrite(b,LOW);
  digitalWrite(c,LOW);
  digitalWrite(d,LOW);
  digitalWrite(e,LOW);
  digitalWrite(f,LOW);
  digitalWrite(g,LOW);
}


void loop() {
  digitalWrite(g,HIGH);
  digitalWrite(c,HIGH);
}
<select>
    <option value="">Please select</option>
    <option value="China">China</option>
    <option value="Afghanistan">Afghanistan</option>
    <option value="Albania">Albania</option>
    <option value="Algeria">Algeria</option>
    <option value="Andorra">Andorra</option>
    <option value="Angola">Angola</option>
    <option value="Antigua and Barbuda">Antigua and Barbuda</option>
    <option value="Argentina">Argentina</option>
    <option value="Armenia">Armenia</option>
    <option value="Australia">Australia</option>
    <option value="Austria">Austria</option>
    <option value="Azerbaijan">Azerbaijan</option>
    <option value="Bahamas">Bahamas</option>
    <option value="Bahrain">Bahrain</option>
    <option value="Bangladesh">Bangladesh</option>
    <option value="Barbados">Barbados</option>
    <option value="Belarus">Belarus</option>
    <option value="Belgium">Belgium</option>
    <option value="Belize">Belize</option>
    <option value="Benin">Benin</option>
    <option value="Bhutan">Bhutan</option>
    <option value="Bolivia">Bolivia</option>
    <option value="Bosnia and Herzegovina">Bosnia and Herzegovina</option>
    <option value="Botswana">Botswana</option>
    <option value="Brazil">Brazil</option>
    <option value="Brunei">Brunei</option>
    <option value="Bulgaria">Bulgaria</option>
    <option value="Burkina Faso">Burkina Faso</option>
    <option value="Burundi">Burundi</option>
    <option value="Cambodia">Cambodia</option>
    <option value="Cameroon">Cameroon</option>
    <option value="Canada">Canada</option>
    <option value="Cape Verde">Cape Verde</option>
    <option value="Central African Republic">Central African Republic</option>
    <option value="Chad">Chad</option>
    <option value="Chile">Chile</option>
    <option value="Colombia">Colombia</option>
    <option value="Comoros">Comoros</option>
    <option value="Congo">Congo</option>
    <option value="Congo (Kinshasa)">Congo (Kinshasa)</option>
    <option value="Cook Islands">Cook Islands</option>
    <option value="Costa Rica">Costa Rica</option>
    <option value="Cote d'Ivoire">Cote d'Ivoire</option>
    <option value="Croatia">Croatia</option>
    <option value="Cuba">Cuba</option>
    <option value="Cyprus">Cyprus</option>
    <option value="Czech">Czech</option>
    <option value="Denmark">Denmark</option>
    <option value="Djibouti">Djibouti</option>
    <option value="Dominica, Commonwealth of">Dominica, Commonwealth of</option>
    <option value="Dominican Republic">Dominican Republic</option>
    <option value="DPRK (Democratic People's Republic of Korea)">DPRK (Democratic People's Republic of Korea)</option>
    <option value="Ecuador">Ecuador</option>
    <option value="Egypt">Egypt</option>
    <option value="El Salvador">El Salvador</option>
    <option value="Equatorial Guinea">Equatorial Guinea</option>
    <option value="Eritrea">Eritrea</option>
    <option value="Estonia">Estonia</option>
    <option value="Eswatini">Eswatini</option>
    <option value="Ethiopia">Ethiopia</option>
    <option value="Fiji">Fiji</option>
    <option value="Finland">Finland</option>
    <option value="France">France</option>
    <option value="Gabon">Gabon</option>
    <option value="Gambia">Gambia</option>
    <option value="Georgia">Georgia</option>
    <option value="Germany">Germany</option>
    <option value="Ghana">Ghana</option>
    <option value="Greece">Greece</option>
    <option value="Grenada">Grenada</option>
    <option value="Guatemala">Guatemala</option>
    <option value="Guinea">Guinea</option>
    <option value="Guinea Bissau">Guinea Bissau</option>
    <option value="Guyana">Guyana</option>
    <option value="Haiti">Haiti</option>
    <option value="Honduras">Honduras</option>
    <option value="Hungary">Hungary</option>
    <option value="Iceland">Iceland</option>
    <option value="India">India</option>
    <option value="Indonesia">Indonesia</option>
    <option value="Iran">Iran</option>
    <option value="Iraq">Iraq</option>
    <option value="Ireland">Ireland</option>
    <option value="Israel">Israel</option>
    <option value="Italy">Italy</option>
    <option value="Jamaica">Jamaica</option>
    <option value="Japan">Japan</option>
    <option value="Jordan">Jordan</option>
    <option value="Kazakstan">Kazakstan</option>
    <option value="Kenya">Kenya</option>
    <option value="Kiribati">Kiribati</option>
    <option value="Korea (Republic of Korea)">Korea (Republic of Korea)</option>
    <option value="Kuwait">Kuwait</option>
    <option value="Kyrgyzstan">Kyrgyzstan</option>
    <option value="Laos">Laos</option>
    <option value="Latvia">Latvia</option>
    <option value="Lebanon">Lebanon</option>
    <option value="Lesotho">Lesotho</option>
    <option value="Liberia">Liberia</option>
    <option value="Libya">Libya</option>
    <option value="Liechtenstein">Liechtenstein</option>
    <option value="Lithuania">Lithuania</option>
    <option value="Luxembourg">Luxembourg</option>
    <option value="Madagascar">Madagascar</option>
    <option value="Malawi">Malawi</option>
    <option value="Malaysia">Malaysia</option>
    <option value="Maldives">Maldives</option>
    <option value="Mali">Mali</option>
    <option value="Malta">Malta</option>
    <option value="Marshall Islands">Marshall Islands</option>
    <option value="Mauritania">Mauritania</option>
    <option value="Mauritius">Mauritius</option>
    <option value="Mexico">Mexico</option>
    <option value="Micronesia">Micronesia</option>
    <option value="Moldova">Moldova</option>
    <option value="Monaco">Monaco</option>
    <option value="Mongolia">Mongolia</option>
    <option value="Montenegro">Montenegro</option>
    <option value="Morocco">Morocco</option>
    <option value="Mozambique">Mozambique</option>
    <option value="Myanmar">Myanmar</option>
    <option value="Namibia">Namibia</option>
    <option value="Nauru">Nauru</option>
    <option value="Nepal">Nepal</option>
    <option value="Netherlands">Netherlands</option>
    <option value="New Zealand">New Zealand</option>
    <option value="Nicaragua">Nicaragua</option>
    <option value="Niger">Niger</option>
    <option value="Nigeria">Nigeria</option>
    <option value="Niue">Niue</option>
    <option value="North Macedonia">North Macedonia</option>
    <option value="Norway">Norway</option>
    <option value="Oman">Oman</option>
    <option value="Pakistan">Pakistan</option>
    <option value="Palau">Palau</option>
    <option value="Palestine">Palestine</option>
    <option value="Panama">Panama</option>
    <option value="Papua New Guinea">Papua New Guinea</option>
    <option value="Paraguay">Paraguay</option>
    <option value="Peru">Peru</option>
    <option value="Philippines">Philippines</option>
    <option value="Poland">Poland</option>
    <option value="Portugal">Portugal</option>
    <option value="Qatar">Qatar</option>
    <option value="Romania">Romania</option>
    <option value="Russia">Russia</option>
    <option value="Rwanda">Rwanda</option>
    <option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option>
    <option value="Saint Lucia">Saint Lucia</option>
    <option value="Saint Vincent and the Grenadines">Saint Vincent and the Grenadines</option>
    <option value="Samoa">Samoa</option>
    <option value="San Marino">San Marino</option>
    <option value="Sao Tome and Principe">Sao Tome and Principe</option>
    <option value="Saudi Arabia">Saudi Arabia</option>
    <option value="Senegal">Senegal</option>
    <option value="Serbia">Serbia</option>
    <option value="Seychelles">Seychelles</option>
    <option value="Sierra Leone">Sierra Leone</option>
    <option value="Singapore">Singapore</option>
    <option value="Slovakia">Slovakia</option>
    <option value="Slovenia">Slovenia</option>
    <option value="Solomon Islands">Solomon Islands</option>
    <option value="Somalia">Somalia</option>
    <option value="South Africa">South Africa</option>
    <option value="South Sudan">South Sudan</option>
    <option value="Sri Lanka">Sri Lanka</option>
    <option value="Spain">Spain</option>
    <option value="Sudan">Sudan</option>
    <option value="Suriname">Suriname</option>
    <option value="Sweden">Sweden</option>
    <option value="Switzerland">Switzerland</option>
    <option value="Syria">Syria</option>
    <option value="Tajikistan">Tajikistan</option>
    <option value="Tanzania">Tanzania</option>
    <option value="Thailand">Thailand</option>
    <option value="Timor-Leste">Timor-Leste</option>
    <option value="Togo">Togo</option>
    <option value="Tonga">Tonga</option>
    <option value="Trinidad and Tobago">Trinidad and Tobago</option>
    <option value="Tunisia">Tunisia</option>
    <option value="Türkiye">Türkiye</option>
    <option value="Turkmenistan">Turkmenistan</option>
    <option value="Tuvalu">Tuvalu</option>
    <option value="UAE (United Arab Emirates)">UAE (United Arab Emirates)</option>
    <option value="Uganda">Uganda</option>
    <option value="Ukraine">Ukraine</option>
    <option value="United Kingdom">United Kingdom</option>
    <option value="United States of America">United States of America</option>
    <option value="Uruguay">Uruguay</option>
    <option value="Uzebekistan">Uzebekistan</option>
    <option value="Vanuatu">Vanuatu</option>
    <option value="Vatican City">Vatican City</option>
    <option value="Venezuela">Venezuela</option>
    <option value="Vietnam">Vietnam</option>
    <option value="Yemen">Yemen</option>
    <option value="Zambia">Zambia</option>
    <option value="Zimbabwe">Zimbabwe</option>
</select>
#Output : Hello world
Print ("Hello world")
#Output :/\/\/\/\/\
Print("/\/\/\/\/\")
<html>
    <head>
        <meta charset="utf-8">

        <title>Fonctionnement du WEB</title>
        <link rel="stylesheet" href="3.css">
    </head>
    <body>
        <link href="https://fonts.googleapis.com/css2?family=Oswald&display=swap" rel="stylesheet">
        <link href="https://fonts.googleapis.com/css2?family=Lato&display=swap" rel="stylesheet">
           <script src="https://kit.fontawesome.com/a076d05399.js"></script>
    </head>
    <body>
        <input type="checkbox" id="active">
    <label for="active" class="menu-btn"><span></span></label>
    <label for="active" class="close"></label>
    <div class="wrapper">
      <ul>
<li><a href="index.html">Menu</a></li>
<li><a href="1.html">Définition</a></li>
<li><a href="2.html">Internet</a></li>
<li><a href="chronologie.jpg" target="_blank">Chronologie</a></li>
</ul>
</div>
        <div class="particules" id="particules1"></div>
        <div class="particules" id="particules2"></div>
        <div class="particules" id="particules3"></div>
        <div class="particules" id="particules4"></div>
        <H1 align="center">Fonctionnement du WEB</H1>
        <h2>a.	Qu’est-ce qu’un navigateur ? quelle est la différence entre un navigateur et un moteur de recherche ?</h2>
        <p>Un navigateur web est un outil, un logiciel permettant de naviguer sur internet, il affiche donc les pages web. Parmi les navigateurs les plus connus, il y a Google chrome, Mozilla Firefox, exploreur Edge, safari et opéra. D’autre part, un moteur de recherche est une application web, il sert à rechercher des ressources à l’aide de mot clé (site web, vidéo, image …), les plus connu sont google, Yahoo, Qwant et Bing. En conclusion, le navigateur est la barque qui permet de naviguer sur le réseau internet, ainsi sans navigateur web nous ne pouvons pas aller sur internet. Et le moteur de recherche aide à rechercher ce dont on a besoin.</p>
        <h2>b. Qu’est-ce que l’URL et à quoi sert-il ? De quels éléments se compose l’URL ?</h2>
        <p>L’URL signifie Uniform Resource Locator, c’est l’adresse d’une ressource donnée unique sur le WEB. Ces ressources peuvent êtres des pages HTML, des documents CSS, des images etc…L’URL est composée de 5 éléments, prenons l’exemple de l’URL suivante : https://www.google.com/gmail, https:// est le protocole il indique au navigateur les actions qu’il doit effectuer, www. Est le sous-domaine il permet au navigateur de connaître qu’elle page du site doit être afficher. Google est le nom domaine c’est tout simplement le nom de site web, .com précise le type d’entité exemple le .org désigne les organisations à but non lucratif, en l’occurrence .com correspond au but commercial, et enfin /gmail est le répertoire il permet au visiteur de savoir sur quelles sections il se trouve.</p>
        <h2>c. Qu’est-ce que L’ICANN ? En quoi l’ICANN est-elle essentielle au bon fonctionnement du Web ?</h2>
        <p>L’ICANN est une autorité qui veille à la sécurité et la stabilité d’Internet.  L’ICANN coordonne tous les identifiants sur internet, en revanche elle ne peut contrôler le contenu publier, elle ne peut pas mettre fin aux spams. L’ICANN joue un rôle d’administrateur, il associe chaque nom de domaine à une adresse IP, pour ainsi permettre à tout le monde d’avoir les mêmes résultats prévisibles à chaque fois que l’on accède à Internet. C’est pour cela que l’ICANN a un rôle très important dans le fonctionnement d’internet car il nous permet de rendre le WEB logique et unique. </p>
        <h2>d. Qu’est-ce que le langage HTML ? à quoi sert-il ?</h2>
        <p>HTML (Hyper text Markup Language) est un langage informatique utilisé pour coder une page Web. Lorsque vous affichez une page Web, vous voyez la page dans sa version finale, mais lorsqu'une page Web est stockée sur un ordinateur. Hyper text est la méthode par laquelle on se déplace sur internet, elle nous permet ainsi de pouvoir accéder à un site web sans parcours prédéfini. Markup est le fait de pouvoir manipuler le texte via des balises (par exemple mettre en gras < strong >< /strong >). Et enfin un langage car il a une nouvelle syntaxe et mots. C'est ce language qui ma permit de faire ce petit site</p>
        <iframe src="https://www.thiscodeworks.com/embed/635c2ceff7ff2d00158890dc" style="width: 50%; height: 300px;" frameborder="0"></iframe>
    </body>
{
  // Required
  "manifest_version": 3,
  "name": "My Extension",
  "version": "versionString",

  // Recommended
  "action": {...},
  "default_locale": "en",
  "description": "A plain text description",
  "icons": {...},

  // Optional
  "author": ...,
  "automation": ...,
  "background": {
    // Required
    "service_worker": "background.js",
    // Optional
    "type": ...
  },
  "chrome_settings_overrides": {...},
  "chrome_url_overrides": {...},
  "commands": {...},
  "content_capabilities": ...,
  "content_scripts": [{...}],
  "content_security_policy": {...},
  "converted_from_user_script": ...,
  "cross_origin_embedder_policy": {"value": "require-corp"},
  "cross_origin_opener_policy": {"value": "same-origin"},
  "current_locale": ...,
  "declarative_net_request": ...,
  "devtools_page": "devtools.html",
  "differential_fingerprint": ...,
  "event_rules": [{...}],
  "externally_connectable": {
    "matches": ["*://*.example.com/*"]
  },
  "file_browser_handlers": [...],
  "file_system_provider_capabilities": {
    "configurable": true,
    "multiple_mounts": true,
    "source": "network"
  },
  "homepage_url": "https://path/to/homepage",
  "host_permissions": [...],
  "import": [{"id": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}],
  "incognito": "spanning, split, or not_allowed",
  "input_components": ...,
  "key": "publicKey",
  "minimum_chrome_version": "versionString",
  "nacl_modules": [...],
  "natively_connectable": ...,
  "oauth2": ...,
  "offline_enabled": true,
  "omnibox": {
    "keyword": "aString"
  },
  "optional_host_permissions": ["..."],
  "optional_permissions": ["tabs"],
  "options_page": "options.html",
  "options_ui": {
    "page": "options.html"
  },
  "permissions": ["tabs"],
  "platforms": ...,
  "replacement_web_app": ...,
  "requirements": {...},
  "sandbox": [...],
  "short_name": "Short Name",
  "storage": {
    "managed_schema": "schema.json"
  },
  "system_indicator": ...,
  "tts_engine": {...},
  "update_url": "https://path/to/updateInfo.xml",
  "version_name": "aString",
  "web_accessible_resources": [...]
}
scn.injectOpen(
    rampUsers(20000).during(1),
);
<li>Service report: <a href="https://flybubble.com/pdfs/reports/PASTE_FULL_PDF_FILENAME_HERE" title="Service report">Download</a></li>
<li>Record of inspection: <a href="https://flybubble.com/pdfs/reports/PASTE_FULL_PDF_FILENAME_HERE" title="Record of inspection">Download</a></li>
<!--This is html code. Plz. use it as html file. -->

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <!-- <link href="https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@600;900&display=swap" rel="stylesheet"> -->
    <title>Upgrader Boy</title>
    <link rel="stylesheet" href="web.css">
</head>

<body>
    <header>
        <section class="navsection">
            <div class="logo">
                <h1>Upgrader Boy</h1>
            </div>
            <nav>
                <a href="https://upgraderboy.blogspot.com/" target="_blank">Home</a>
                <a href="https://www.youtube.com/channel/UCEJnv8TaSl0i1nUMm-fGBnA?sub_confirmation=1" target="_blank">Youtube</a>
                <a href="#" target="_blank">Social Media</a>
                <a href="#" target="_blank">Services</a>
                <a href="https://upgraderboy.blogspot.com/p/about-us.html" target="_blank">About us</a>
                <a href="https://upgraderboy.blogspot.com/p/contact-us.html" target="_blank">Contact us</a>
            </nav>
        </section>
        <main>
            <div class="leftside">
                <h3>Hello</h3>
                <h1>I am Upgrader</h1>
                <h2>Web developer, Youtuber and CEO of Upgrader Boy</h2>
                <a href="#" class="button1">Website</a>
                <a href="#" class="button2">Youtube</a>
            </div>
            <div class="rightside">
                <img src="/Image/ezgif.com-gif-maker.gif" alt="Svg image by Upgrader Boy">
            </div>
        </main>

    </header>
</body>

</html>

<!-- This is css code. Plz. use it as css file. -->
  
*{
    margin: 0px;
    padding: 0px;
    /* @import url('https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@600&display=swap'); */
    /* font-family: 'Roboto Slab', serif; */
}

header{
    width: 100%;
    height: 100%;
    background-image: linear-gradient(to left,#ffff 85%, #c3f5ff 20%);
}

.navsection{
    width: 100%;
    height: 20vh;
    display: flex;
    justify-content: space-around;
    background-image: linear-gradient(to top, #fff 80%, #c3f5ff 20%);
    align-items: center;
}

.logo{
    width: 40%;
    color: #fff;
    background-image: linear-gradient(#8d98e3 40%, #854fee 60%);
    padding-left: 100px;
    box-sizing: border-box;
}

.logo h1{
    text-transform: uppercase;
    font-size: 1.6rem;
    animation: aagepiche 1s linear infinite;
    animation-direction: alternate;
}

@keyframes aagepiche{
    from{padding-left: 40px;}
    to {padding-right: 40px;}
}

nav{
    width: 60%;
    display: flex;
    justify-content: space-around;
}

nav a{
    text-decoration: none;
    text-transform: uppercase;
    color: #000;
    font-weight: 900;
    font-size: 17px;
    position: relative;
}

nav a:first-child{
    color: #4458dc;
}

nav a:before{
    content: "";
    position: absolute;
    top: 110%;
    left: 0;
    height: 2px;
    width: 0;
    border-bottom: 5px solid #4458dc;
    transition: 0.5s;
}

nav a:hover:before{
    width: 100%;
}

main{
    height: 80vh;
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.rightside{
    border-radius: 30% 70% 53% 47% / 30% 30% 70% 70%;
    background-color: #c8fbff;
}

.rightside img{
    max-width: 500px;
    height: 80%;
}

.leftside{
    color: #000;
    text-transform: uppercase;
}

.leftside h3{
    font-size: 40px;
    margin-bottom: 20px;
    position: relative;
}

.leftside h3:after{
    content: "";
    width: 450px;
    height: 3px;
    position: absolute;
    top: 43%;
    left: 23.4%;
    background-color: #000;
}

.leftside h1{
    margin-top: 20px;
    font-size: 70px;
    margin-bottom: 25px;
}

.leftside h2{
    margin-bottom: 35px;
    font-weight: 500;
    word-spacing: 4px;
}

.leftside .button1{
    color: #fff;
    letter-spacing: 0;
    background-image: linear-gradient(to right, #4458dc 0%, #854fee 100%);
    border: double 2px transparent;
    box-shadow: 0 10px 30px rgba(118, 85, 225, 3);
    /* radial-gradient(circle at top left,#4458dc,#854fee); */
}

.leftside .button2{
    border: 2px solid #4458dc;
    color: #222;
    background-color: #fff;
    box-shadow: none;
}

.leftside .button1 , .button2{
    display: inline-block;
    margin-right: 50px;
    text-decoration: none;
    font-weight: 900;
    font-size: 14px;
    text-align: center;
    padding: 12px 25px;
    cursor: pointer;
    text-transform: uppercase;
    border-radius: 5px;
}

.leftside .button1:hover{
    border: 2px solid #4458dc;
    color: #222;
    box-shadow: none;
    background-color: #fff;
    background-image: none;
}
 """ 
'UserWarning: pyproj unable to set database path.' <- This happens with multiple pyproj installations on the same machine, which is quite common, as almost every geo software depends on it.

How to fix:
First, find all copies of 'proj.db' on the machine. Get the path for the correct one, which is probably something like 'C:/Users/Clemens Berteld/.conda/pkgs/proj-8.2.0-h1cfcee9_0/Library/share/proj'. Definitively not a QGIS or PostGIS path.

Then, use it as a parameter for this function and run it at the top of your code:
"""

def set_pyproj_path(proj_path):
    from pyproj import datadir
    datadir.set_data_dir(proj_path)
    # print(datadir.get_data_dir.__doc__)
function UserResults() {
  const appContext = useContext(GithubContext)

  const { users, loading, fetchUsers } = appContext
  

  useEffect(() => {
    fetchUsers()
  }, [fetchUsers])

  if (!loading) {
    return (
      <div className='grid grid-cols-1 gap-8 xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2'>
        {users.map((user : User) => (
          <UserItem key={user.id} user={user} />
        ))}
      </div>
    )
  } else {
    return <Spinner />
  }
}
//Kotlin Kapt plugin used for annotations
id 'kotlin-kapt'

// RoomDatabase Libraries

 def roomVersion = "2.4.0"
    implementation "androidx.room:room-runtime:$roomVersion"
    kapt "androidx.room:room-compiler:$roomVersion"
    implementation "androidx.room:room-ktx:$roomVersion"

// Coroutines
   implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.3"
   implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.3"

// LiveCycle and ViewModel
 def lifecycle_version = "2.2.0"
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"


// Retrofit

implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'



// for enabling view and databinding in android tag

buildFeatures{
        dataBinding true
    }

    viewBinding {
        enabled = true
    }
const menu ={
  _menu: '',
  _price: 0,
  set meal(mealToCheck){
    if (typeof mealToCheck === 'string'){
      return this._meal = mealToCheck;
    }
  },
   set price(priceToCheck){
    if (typeof priceToCheck === 'number'){
      return this._price = priceToCheck; 
  }
},
get todaysSpecial(){
  if(this._meal && this._price){
    return `Today's Meal is ${this._meal} for $${this._price}!`
  }else{
    return `Meal or price was set crrectly!`
  }
}

};

menu.meal = 'pizza'
menu.price = 5

console.log(menu.todaysSpecial);
function getPage(url, from, to) {
    var cached=sessionStorage[url];
    if(!from){from="body";} // default to grabbing body tag
    if(to && to.split){to=document.querySelector(to);} // a string TO turns into an element
    if(!to){to=document.querySelector(from);} // default re-using the source elm as the target elm
    if(cached){return to.innerHTML=cached;} // cache responses for instant re-use re-use

    var XHRt = new XMLHttpRequest; // new ajax
    XHRt.responseType='document';  // ajax2 context and onload() event
    XHRt.onload= function() { sessionStorage[url]=to.innerHTML= XHRt.response.querySelector(from).innerHTML;};
    XHRt.open("GET", url, true);
    XHRt.send();
    return XHRt;
}
/* http://meyerweb.com/eric/tools/css/reset/ 
   v2.0 | 20110126
   License: none (public domain)
*/

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
	margin: 0;
	padding: 0;
	border: 0;
	font-size: 100%;
	font: inherit;
	vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
	display: block;
}
body {
	line-height: 1;
}
ol, ul {
	list-style: none;
}
blockquote, q {
	quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
	content: '';
	content: none;
}
table {
	border-collapse: collapse;
	border-spacing: 0;
}
<!DOCTYPE html>
<html>
 
<head>
    <!-- importing fonts from google fonts-->
   <link rel="preconnect" href="https://fonts.gstatic.com">
   <link href="https://fonts.googleapis.com/css2?family=Josefin+Sans:ital,wght@0,100;0,200;0,300;0,400;1,300&display=swap" rel="stylesheet">
     
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>My Cool Website</title>
    <link rel="stylesheet" href="style.css">
</head>
 
<body>
    <header>
        <!- navbar content ->
    </header>
</body>
...

<ion-content class="scanner-hide" *ngIf="scanStatus == false">
  <div class="padding-container center">
    <ion-button color="primary" (click)="scanCode()"><ion-icon slot="start" name="qr-code-outline"></ion-icon> Scanear Código</ion-button> <!-- Botão que chama a função do scanner-->
  </div>
  <ion-card>
    <ion-card-content><h1>{{ result }}</h1></ion-card-content> <!-- mostra o resultado do scan -->
  </ion-card>
  
  <div class="scanner-ui"> <!-- Quando estamos a scanear, chama esta classe-->
    ...Scanner Interface
    </div>
    <div class="ad-spot"></div>
</ion-content>
  private int[] liste = {5, 1, 4, 9, 0, 8, 6};
public int[] sortieren() {
    int a;
    for(int k = 1; k < liste.length; k++){
      for (int b = 0; b < (liste.length – k); b++) {
        if (liste[b] > liste[b + 1]) {
          a = liste[b];
          liste[b] = liste[b + 1];
          liste[b + 1] = a;
        }
      }
    }
  return liste;
  }
public static void main(String[] args) {
    Bubble_Sort bs = new Bubble_Sort();
int[] array = bs.sortieren();
for (int b = 0; b < array.length; b++) {
      System.out.println(b + 1 + „:“ + array[b]);
    }
  }
}
select Opportunity__r.Country_of_Ownership__c,CALENDAR_MONTH(Transaction_Allocation__c.Close_Date__c)themonth,
  CALENDAR_YEAR(Transaction_Allocation__c.Close_Date__c)theyear, COUNT_DISTINCT(Opportunity__r.Id) The_Count, sum(Opportunity__r.Ask_Amount__c) amount

from Transaction_Allocation__c

where 
(Transaction_Allocation__c.Close_Date__c  > 2022-03-31 AND Transaction_Allocation__c.Close_Date__c  < NEXT_N_DAYS:1) 
AND
(Transaction_Allocation__c.Stage__c IN ('Posted','Refunded','Failed','Refund','Reversal')
AND
((
Opportunity__r.RecordTypeId IN ('012w00000006jGy')
 AND
Opportunity__r.Date_Recurring_Donation_Established__c  > 2022-03-31
 
)
OR
(Opportunity__r.RecordTypeId IN ('0122X000000ie1A') 
AND
Opportunity__r.Direct_Regular_Donor_Start_of_FY__c = False))
 
AND
Transaction_Allocation__c.GL_Code__c IN ('50030','50090')
)
 

Group by 
Opportunity__r.Country_of_Ownership__c,CALENDAR_MONTH(Transaction_Allocation__c.Close_Date__c),
  CALENDAR_YEAR(Transaction_Allocation__c.Close_Date__c)
const images = document.getElementsByTagName('img');
for (let i = 0; i < images.length; i++) {
    images[i].addEventListener('contextmenu', event => event.preventDefault());
}
import tkinter as tk
import numpy as np


# COPY HERE SHADOW CLASS


def test_click():
    button1.configure(text='You have clicked me!')


if __name__ == '__main__':
    root = tk.Tk()
    
    # Create dummy buttons
    button1 = tk.Button(root, text="Click me!", width=20, height=2, command=test_click)
    button1.grid(row=0, column=0, padx=50, pady=20)
    button2 = tk.Button(root, text="Hover me!", width=20, height=2)
    button2.bind('<Enter>', lambda e: button2.configure(text='You have hovered me!'))
    button2.grid(row=1, column=0, padx=50, pady=20)
    
    # Add shadow
    Shadow(button1, color='#ff0000', size=1.3, offset_x=-5, onclick={'color':'#00ff00'})
    Shadow(button2, size=10, offset_x=10, offset_y=10, onhover={'size':5, 'offset_x':5, 'offset_y':5})
    
    root.mainloop()
star

Thu Mar 14 2024 03:54:14 GMT+0000 (Coordinated Universal Time)

@aniket_chavan

star

Mon Mar 11 2024 22:16:38 GMT+0000 (Coordinated Universal Time) https://www.darkhackerworld.com/2020/06/best-hacking-tools-for-termux.html

@Saveallkids

star

Thu Feb 15 2024 08:24:36 GMT+0000 (Coordinated Universal Time) https://lk.ko-rista.ru/

@Asjnsvaah

star

Mon Feb 12 2024 07:55:29 GMT+0000 (Coordinated Universal Time)

@suira #php #wordpress

star

Fri Jan 26 2024 04:46:39 GMT+0000 (Coordinated Universal Time)

@shreekrishna

star

Sat Dec 09 2023 15:23:14 GMT+0000 (Coordinated Universal Time)

@marcopinero #javascript

star

Tue Dec 05 2023 23:59:18 GMT+0000 (Coordinated Universal Time) https://community.spiceworks.com/topic/900079-how-to-merge-all-txt-files-into-one-using-type-and-insert-new-line-after-each

@baamn

star

Thu Nov 30 2023 09:37:04 GMT+0000 (Coordinated Universal Time)

@MAKEOUTHILL #html

star

Mon Nov 27 2023 22:29:33 GMT+0000 (Coordinated Universal Time)

@marianacarvalho #javascript

star

Sun Nov 26 2023 08:25:05 GMT+0000 (Coordinated Universal Time) https://wordpress.stackexchange.com/questions/94364/set-post-title-from-two-meta-fields

@dmsearnbit #php

star

Sat Nov 25 2023 06:42:26 GMT+0000 (Coordinated Universal Time)

@StephenThevar #javascript

star

Tue Nov 21 2023 08:13:13 GMT+0000 (Coordinated Universal Time) https://www.emailaudience.com/dark-mode-email/

@Sebhart #css #mark-up #email

star

Thu Nov 16 2023 11:31:42 GMT+0000 (Coordinated Universal Time)

@mathiasVDD #javascript

star

Sun Nov 12 2023 21:19:22 GMT+0000 (Coordinated Universal Time)

@dannyholman #css

star

Wed Aug 09 2023 16:32:46 GMT+0000 (Coordinated Universal Time) https://godly.website/

@Waqas

star

Tue Aug 08 2023 18:05:53 GMT+0000 (Coordinated Universal Time) https://uicolors.app/create

@Waqas

star

Mon May 08 2023 17:26:03 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/17398019/convert-datatable-to-json-in-c-sharp

@javicinhio #cs

star

Fri May 05 2023 21:38:24 GMT+0000 (Coordinated Universal Time)

@Bansikah

star

Tue Apr 04 2023 03:22:33 GMT+0000 (Coordinated Universal Time) https://docs.python.org/3/tutorial/introduction.html

@tofufu #python

star

Fri Mar 17 2023 12:17:05 GMT+0000 (Coordinated Universal Time) https://learnxinyminutes.com/docs/python/

@Rmin

star

Mon Feb 27 2023 11:33:53 GMT+0000 (Coordinated Universal Time) https://2captcha.com/

@10x

star

Fri Feb 17 2023 10:54:31 GMT+0000 (Coordinated Universal Time)

@MAKEOUTHILL

star

Sat Feb 11 2023 03:43:06 GMT+0000 (Coordinated Universal Time) https://www.reddit.com/r/StableDiffusion/comments/107dgr9/code_to_download_files_to_gdrive_using_colab/?newUser

@jak123

star

Tue Feb 07 2023 06:31:41 GMT+0000 (Coordinated Universal Time)

@iliavial

star

Mon Jan 30 2023 05:23:05 GMT+0000 (Coordinated Universal Time)

@iliavial

star

Sun Jan 01 2023 10:27:05 GMT+0000 (Coordinated Universal Time)

@tonyman2142 #html

star

Sun Dec 11 2022 14:27:29 GMT+0000 (Coordinated Universal Time)

@Harman

star

Fri Oct 28 2022 19:26:39 GMT+0000 (Coordinated Universal Time)

@zorrodali

star

Fri Oct 21 2022 05:53:47 GMT+0000 (Coordinated Universal Time) https://developer.chrome.com/docs/extensions/mv3/manifest/

@GDub662 #json

star

Tue Sep 27 2022 10:13:14 GMT+0000 (Coordinated Universal Time)

@jcgatling

star

Tue Sep 27 2022 08:31:16 GMT+0000 (Coordinated Universal Time)

@FlybubbleCrew #html

star

Mon Sep 26 2022 10:19:40 GMT+0000 (Coordinated Universal Time) https://www.turnkeytown.com/nft-marketing-services

@angelikacandie #nftmarketing strategies

star

Sat Aug 20 2022 17:52:14 GMT+0000 (Coordinated Universal Time)

@upgrader_boy

star

Thu Aug 18 2022 07:19:21 GMT+0000 (Coordinated Universal Time)

@ClemensBerteld #pyproj #python #database #path

star

Tue Aug 02 2022 13:45:35 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/73208538/how-to-destructure-usecontext-hook-in-typescript-with-null-default-value

@jhonataspaulo #javascript

star

Sat Jul 30 2022 07:39:53 GMT+0000 (Coordinated Universal Time)

@kamrantariq_123 #mvvm #kotlin

star

Thu Jul 21 2022 20:10:05 GMT+0000 (Coordinated Universal Time) https://www.youtube.com/watch?v=YrnItiYQU6U&ab_channel=Codecademy

@cruz #javascript

star

Tue Jul 12 2022 17:54:11 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/21435877/load-specific-element-from-another-page-with-vanilla-js

@richard #javascript

star

Thu Jul 07 2022 10:56:49 GMT+0000 (Coordinated Universal Time) https://ineed.coffee/Old+Posts/A+beginner's+tutorial+for+mbpfan+under+Ubuntu

@Shex #mbpfan #ubuntu20.04 #commandline #macbookpro #terminal #fanspeed

star

Wed Jun 29 2022 23:07:31 GMT+0000 (Coordinated Universal Time) https://meyerweb.com/eric/tools/css/reset/

@adeilsonaalima #css

star

Mon Jun 27 2022 00:46:34 GMT+0000 (Coordinated Universal Time)

@mbala ##css

star

Sun Jun 05 2022 09:24:36 GMT+0000 (Coordinated Universal Time) https://studyflix.de/informatik/bubblesort-1325

@chipcode1970

star

Wed Jun 01 2022 11:22:06 GMT+0000 (Coordinated Universal Time)

@Matt_Stone #globalkpi

star

Sat May 28 2022 05:37:56 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/4753695/disabling-right-click-on-images-using-jquery

@rbsuperb

star

Thu May 12 2022 20:14:47 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/42750939/how-to-add-shadow-to-tkinter-frame

@TWOGUNSKID #python

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension