Snippets Collections
Client Side Code Test.jsx --
import React, { useState, useEffect, useRef } from 'react';
import { initializeApp } from 'firebase/app';
import { getAuth, RecaptchaVerifier, signInWithPhoneNumber } from 'firebase/auth';

// Firebase config - replace with your own config
const firebaseConfig = {
  apiKey: "AIzaSyCb9uireOMfRCFfJpWWr1WmKdP629rNcCk",
  authDomain: "trial-34ed7.firebaseapp.com",
  projectId: "trial-34ed7",
  storageBucket: "trial-34ed7.appspot.com",
  messagingSenderId: "71628620493",
  appId: "1:71628620493:web:7c44729da8f9c541e55f84",
  measurementId: "G-N9GPF8ZQMZ"
};

// Initialize Firebase App
const app = initializeApp(firebaseConfig);
const auth = getAuth(app);

function Test() {
  const [mobile, setMobile] = useState('');
  const [otp, setOtp] = useState('');
  let confirmationResult = useRef(null);

  useEffect(() => {
    configureCaptcha();
  }, []);

  const handleChange = (e) => {
    const { name, value } = e.target;
    if (name === 'mobile') {
      setMobile(value);
    } else if (name === 'otp') {
      setOtp(value);
    }
  };

  const configureCaptcha = () => {
    window.recaptchaVerifier = new RecaptchaVerifier(auth, 'sign-in-button', {
      'size': 'invisible',
      'callback': (response) => {
        // reCAPTCHA solved, allow signInWithPhoneNumber.
        onSignInSubmit();
      }
    }, auth);
  };

  const onSignInSubmit = async (e) => {
    e.preventDefault();
    const phoneNumber = "+91" + mobile;
    console.log(phoneNumber);
    const appVerifier = window.recaptchaVerifier;
    try {
      confirmationResult.current = await signInWithPhoneNumber(auth, phoneNumber, appVerifier);
      console.log("OTP has been sent");
    } catch (error) {
      console.error("SMS not sent", error);
    }
  };

  const onSubmitOTP = async (e) => {
    e.preventDefault();
    try {
      const result = await confirmationResult.current.confirm(otp);
      const user = result.user;
      console.log(JSON.stringify(user));
      alert("User is verified");
    } catch (error) {
      console.error("User couldn't sign in (bad verification code?)", error);
    }
  };

  return (
    <div>
      <h2>Login Form</h2>
      <form onSubmit={onSignInSubmit}>
        <div id="sign-in-button"></div>
        <input type="text" name="mobile" placeholder="Mobile number" required onChange={handleChange} />
        <button type="submit">Submit</button>
      </form>

      <h2>Enter OTP</h2>
      <form onSubmit={onSubmitOTP}>
        <input type="text" name="otp" placeholder="OTP Number" required onChange={handleChange} />
        <button type="submit">Submit</button>
      </form>
    </div>
  );
}

export default Test;




const videoPlayers = document.getElementsByClassName('video-stream html5-main-video');
var videoPlayerss = videoPlayers[0]
var startTimes = 30
var endTimes = 68
var startTimes2 = 90
var endTimes2 = 150
var startTimes3 = 185
var endTimes3 = 270
videoPlayerss.currentTime = startTimes;
videoPlayerss.play();
videoPlayerss.addEventListener('timeupdate', () => {
  if (videoPlayerss.currentTime > endTimes && videoPlayerss.currentTime < startTimes2 ) {
    videoPlayerss.currentTime = startTimes2;
  } else if (videoPlayerss.currentTime > endTimes2 && videoPlayerss.currentTime < startTimes3 ) {
    videoPlayerss.currentTime = startTimes3;
  } else if (videoPlayerss.currentTime > endTimes3) {
    videoPlayerss.currentTime = startTimes;
  } 
});
var elementss2 = document.getElementsByClassName("ud-real-toggle-input");
//console.log(elementss2)
for (var i = 0; i < elementss2.length; i++) {
  if (!elementss2[i].hasAttribute("checked")) {
    console.log(elementss2[i]);
      elementss2[i].disabled = false;
      elementss2[i].click()
  }
}
var elementss2 = document.getElementsByClassName("contents");
//console.log(elementss2)
for (var i = 0; i < elementss2.length; i++) {
 elementss2[i].style = "display: none;";  
}
#define encoder_a 2 //keep this on and interrupt pin
#define encoder_b 3 //keep this on and interrupt pin
#define motor_step 9
#define motor_direction 8
#define motor_en 10 //
 
#define senzor_front 6 // sensor depan
#define senzor_rear 7  // sensor  samping
#define load_button 4
#define eject_button 5
 
volatile long motor_position, encoder;
int home_position = 0;
int load_position = 0;
int pe_load = 0;
 
void setup() {
     pinMode(encoder_a, INPUT);
     pinMode(encoder_b, INPUT);
 
     // disable pullup as we aren't using an open collector encoder
     digitalWrite(encoder_a, LOW);
     digitalWrite(encoder_b, LOW);
 
     //set up the various outputs
     pinMode(motor_step, OUTPUT);
     pinMode(motor_direction, OUTPUT);
     pinMode(motor_en, OUTPUT);//
     digitalWrite(motor_en, HIGH);//
     
     // then the senzors inputs
     pinMode(senzor_front, INPUT_PULLUP);
     pinMode(senzor_rear, INPUT_PULLUP);
 
     pinMode(load_button, INPUT_PULLUP);
     pinMode(eject_button, INPUT_PULLUP);
  //--------------------------------------------------
     // encoder pin on interrupt 0 (pin 2)
     attachInterrupt(0, encoderPinChangeA, CHANGE);
     // encoder pin on interrupt 1 (pin 3)
     attachInterrupt(1, encoderPinChangeB, CHANGE);
     encoder = 0;
 // -------------------------------------------------
 
}
 // -------------------------------------------------
void encoderPinChangeA(){
    if (digitalRead(encoder_a) == digitalRead(encoder_b)){
        encoder--;
    }
    else{
        encoder++;
    }
}
 
void encoderPinChangeB(){
    if (digitalRead(encoder_a) != digitalRead(encoder_b)){
        encoder--;
    }
    else{
        encoder++;
    }
}
 // -------------------------------------------------
 
 void loop() {
 
     // Control platen position of boot up and move to front
     if (home_position == 0) {
         digitalWrite(motor_direction, HIGH);
         TurnStepper();
         if (digitalRead(senzor_front) == LOW) {
             home_position = 1;
         }
      }
 
     // eject platen
     if (digitalRead(eject_button) == LOW) {
         home_position = 0;
     }
 
     // load platen
     if (digitalRead(load_button) == LOW) {
         load_position = 1;
     }
     if (load_position == 1) {
        digitalWrite(motor_direction, LOW);
        TurnStepper();
        if (digitalRead(senzor_rear) == LOW) {
           load_position = 0;
           pe_load = 1;
        }
      }
 // -------------------------------------------------
     if (encoder > 0){
         digitalWrite(motor_direction, HIGH);  //  output direction HIGH
         digitalWrite(motor_step, HIGH);       //  output step HIGH
         digitalWrite(motor_step, LOW);        //  output step LOW
         _delay_us(900);                       //  tunggu 200 microsecond
         motor_position++;                     //  posisi motor bergeser tambah satu point
         encoder = 0;                          //  reset ke 0
      }
      else if (encoder < 0){
         digitalWrite(motor_direction, LOW);   //  output direction LOW
         digitalWrite(motor_step, HIGH);       //  output step HIGH
         digitalWrite(motor_step, LOW);        //  output step LOW
         _delay_us(900);                       //  tunggu 200 microsecond
         motor_position--;                     //  posisi motor bergeser tambah satu point
         encoder = 0;                          //  reset ke 0
       }
 // -------------------------------------------------
}
 
void TurnStepper() {
     digitalWrite(motor_step, HIGH);
     delayMicroseconds(1000);                    //  speed motor 
     digitalWrite(motor_step, LOW);
     delayMicroseconds(1000);                    //  speed delay, the lower it is the faster
}
<?php if(preg_match('/\Ahttps?:\/\/([-\w\.]+)+(:\d+)?(\/([\w\/_\.]*(\?\S+)?)?)?\Z/', 'http://'.$_POST['domain'])) // URL auf validität überprüfen. 
{
  $whois=array(); // Array initialisieren. Es folgen Deklarationen des mehrdimensionalem Arrays.
  $whois['.de']['server']='whois.denic.de';
  $whois['.de']['string']='Status:      free';
  $whois['.com']['server']='whois.crsnic.net';
  $whois['.com']['string']='No match for';
  $whois['.net']['server']='whois.crsnic.net';
  $whois['.net']['string']='No match for';
  $whois['.org']['server']='whois.publicinterestregistry.net';
  $whois['.org']['string']='NOT FOUND';
  $whois['.info']['server']='whois.afilias.net';
  $whois['.info']['string']='NOT FOUND';
  $whois['.biz']['server']='whois.nic.biz';
  $whois['.biz']['string']='Not found';
  $whois['.ag']['server']='whois.nic.ag';
  $whois['.ag']['string']='NOT FOUND';
  $whois['.am']['server']='whois.nic.am';
  $whois['.am']['string']='No match';
  $whois['.as']['server']='whois.nic.as';
  $whois['.as']['string']='Domain Not Found';
  $whois['.at']['server']='whois.nic.at';
  $whois['.at']['string']='nothing found';
  $whois['.be']['server']='whois.dns.be';
  $whois['.be']['string']='Status:      FREE';
  $whois['.cd']['server']='whois.cd';
  $whois['.cd']['string']='No match';
  $whois['.ch']['server']='whois.nic.ch';
  $whois['.ch']['string']='not have an entry';
  $whois['.cx']['server']='whois.nic.cx';
  $whois['.cx']['string']='Status: Not Registered';
  $whois['.dk']['server']='whois.dk-hostmaster.dk';
  $whois['.dk']['string']='No entries found';
  $whois['.it']['server']='whois.nic.it';
  $whois['.it']['string']='Status: AVAILABLE';
  $whois['.li']['server']='whois.nic.li';
  $whois['.li']['string']='do not have an entry';
  $whois['.lu']['server']='whois.dns.lu';
  $whois['.lu']['string']='No such domain';
  $whois['.nu']['server']='whois.nic.nu';
  $whois['.nu']['string']='NO MATCH for';
  $whois['.ru']['server']='whois.ripn.net';
  $whois['.ru']['string']='No entries found';
  $whois['.uk.com']['server']='whois.centralnic.com';
  $whois['.uk.com']['string']='No match for';
  $whois['.eu.com']['server']='whois.centralnic.com';
  $whois['.eu.com']['string']='No match';
  $whois['.ws']['server']='whois.nic.ws';
  $whois['.ws']['string']='No match for';

  $domain=str_replace('www.', '', $_POST['domain']); // Solche Dinge sind Detailssache (..)  Letztlich muss die Anfrage an den WHOIS-Server ohne http::// , www. usw. stattfinden. -> Nur Domainname und Domainendung.

  if(get_magic_quotes_gpc==0)
  {
    $domain=addslashes($domain);
  } 

// Verbindung zum whois server aufbauen / Status der Domain erfragen.

 $check=fsockopen($whois[$_POST['tld']]['server'], 43);
  fputs($check, $domain.$_POST['tld']."\r\n");
  while(!feof($check)) 
  {
    $report=$report.fgets($check, 128);
  }
  fclose($check);

  if(ereg($whois[$_POST['tld']]['string'], $report)) // Was soll geschehen, wenn domain noch frei ist?
  {
    print('domain frei.');
  }
  else // Was, wenn nicht?
  {
    print('domain nicht frei.');
  }
} 
?>
*{
	margin: 0;
	padding: 0;
}
body{
	background: #f4f9ff;
}
#wrapper{
	width: 100%;
	max-width: 460px;
	background: #fff;
		margin: 20px auto;
	padding: 20px;
	border-bottom: 1px solid #e7e7e7;
}
input{
	width: 100%;
	padding: 10px 0;
	margin-bottom: 20px;
}
button{
	border: none;
	background: #e7e7e7;
	padding: 10px 20px;
}
.result{
	text-align: center;
	font-size: 22px;
	margin-top: 20px;
}
.success{
	color: green;
}
.failur{
	color: red;
}
<?php
/*
 * @ PHP 5.6
 * @ Decoder version : 1.0.0.1
 * @ Release on : 24.03.2018
 * @ Website    : http://EasyToYou.eu
 */

require "init.php";
require ROOTDIR . DIRECTORY_SEPARATOR . "includes" . DIRECTORY_SEPARATOR . "clientareafunctions.php";
$domain = WHMCS\Input\Sanitize::decode(App::getFromRequest("domain"));
$ext = App::getFromRequest("ext");
$sld = App::getFromRequest("sld");
$tld = App::getFromRequest("tld");
$tlds = App::getFromRequest("search_tlds");
$captcha = new WHMCS\Utility\Captcha();
$validate = new WHMCS\Validate();
$captcha->validateAppropriateCaptcha(WHMCS\Utility\Captcha::FORM_DOMAIN_CHECKER, $validate);
if ($validate->hasErrors()) {
    WHMCS\Session::set("captchaData", array("invalidCaptcha" => true, "invalidCaptchaError" => $validate->getErrors()[0]));
    WHMCS\Session::set("CaptchaComplete", false);
} else {
    WHMCS\Session::set("captchaData", array("invalidCaptcha" => false, "invalidCaptchaError" => false));
    WHMCS\Session::set("CaptchaComplete", true);
}
if (in_array($domain, array(Lang::trans("domaincheckerdomainexample")))) {
    $domain = "";
}
if ($ext && $domain) {
    if (substr($ext, 0, 1) != ".") {
        $ext = "." . $ext;
    }
    $domain .= $ext;
}
if (!$domain && $sld && $tld) {
    if (substr($tld, 0, 1) != ".") {
        $tld = "." . $tld;
    }
    $domain = $sld . $tld;
}
if (is_array($tlds) && 0 < count($tlds)) {
    $tldToAppend = $tlds[0];
    if (substr($tldToAppend, 0, 1) != ".") {
        $tldToAppend = "." . $tldToAppend;
    }
    if ($domain) {
        $domain = $domain . $tldToAppend;
    } else {
        if ($sld) {
            $domain = $sld . $tldToAppend;
        }
    }
}
$domainRequestSuffix = $domain ? "&query=" . urlencode($domain) : "";
if (App::getFromRequest("transfer")) {
    App::redirect("cart.php", "a=add&domain=transfer" . $domainRequestSuffix);
}
if (App::getFromRequest("hosting")) {
    App::redirect("cart.php", substr($domainRequestSuffix, 1));
}
App::redirect("cart.php", "a=add&domain=register" . $domainRequestSuffix);

?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Domain checker</title>
	<link rel="stylesheet" href="./style.css">
</head>
<body>
	<div id="wrapper">		
		<form method="POST">
			<input type="text" name="domain" <?php if(isset($_POST['domain'])) echo 'value="'.$_POST['domain'].'"' ?>>
			<button type="submit">Check</button>
		</form>
		<div class="result">
			<?php 
				if(isset($_POST['domain'])){
					if ( gethostbyname($_POST['domain']) == $_POST['domain'] )
					    echo "<p class='success'>Congatulations! {$_POST['domain']} is available</p>";
					else
						echo "<p class='failur'>Sorry, {$_POST['domain']} is not available</p>";
				}
			?>
		</div>
	</div>
</body>
</html>
<script id="__bs_script__">//<![CDATA[
  (function() {
    try {
      var script = document.createElement('script');
      if ('async') {
        script.async = true;
      }
      script.src = 'http://HOST:3000/browser-sync/browser-sync-client.js?v=3.0.2'.replace("HOST", location.hostname);
      if (document.body) {
        document.body.appendChild(script);
      } else if (document.head) {
        document.head.appendChild(script);
      }
    } catch (e) {
      console.error("Browsersync: could not append script tag", e);
    }
  })()
//]]></script>
<label for="tempB">Choose a comfortable temperature:</label><br />
<input type="range" id="tempB" name="temp" list="values" />

<datalist id="values">
  <option value="0" label="very cold!"></option>
  <option value="25" label="cool"></option>
  <option value="50" label="medium"></option>
  <option value="75" label="getting warm!"></option>
  <option value="100" label="hot!"></option>
</datalist>
all:
	make -C /home/jonthan/pam_usb
    
/home/jonthan/pam_usb/%.o: /home/jonthan/pam_usb/%.c
	$(CC) -c -o $@ $<
      
/home/jonthan/pam_usb/pam_usb: /home/jonthan/pam_usb/main.o
	$(CC) -o $@ $^
 
clean:
	rm -f /home/jonthan/pam_usb/*.o /home/jonthan/pam_usb/pam_usb
Add (at least temporarily) a download repository. This requires registering trusted key. (More information). Run the following shell commands to trust the repository:

wget -nv https://download.owncloud.com/desktop/ownCloud/stable/latest/linux/Ubuntu_23.10/Release.key -O - | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/owncloud-client.gpg > /dev/null




Run the following shell commands to add the repository and install from there:

sudo apt update
sudo apt install apt-transport-https
echo 'deb https://download.owncloud.com/desktop/ownCloud/stable/latest/linux/Ubuntu_23.10/ /' | sudo tee -a /etc/apt/sources.list.d/owncloud-client.list
sudo apt update
sudo apt install owncloud-client
Add (at least temporarily) a download repository. This requires registering trusted key. (More information). Run the following shell commands to trust the repository:

wget -nv https://download.owncloud.com/desktop/ownCloud/stable/latest/linux/Ubuntu_23.10/Release.key -O - | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/owncloud-client.gpg > /dev/null




Run the following shell commands to add the repository and install from there:

sudo apt update
sudo apt install apt-transport-https
echo 'deb https://download.owncloud.com/desktop/ownCloud/stable/latest/linux/Ubuntu_23.10/ /' | sudo tee -a /etc/apt/sources.list.d/owncloud-client.list
sudo apt update
sudo apt install owncloud-client
#include "param.h"
#include "types.h"
#include "defs.h"
#include "x86.h"
#include "memlayout.h"
#include "mmu.h"
#include "proc.h"
#include "elf.h"

extern char data[];  // defined by kernel.ld
pde_t *kpgdir;  // for use in scheduler()

// Set up CPU's kernel segment descriptors.
// Run once on entry on each CPU.
void
seginit(void)
{
  struct cpu *c;

  // Map "logical" addresses to virtual addresses using identity map.
  // Cannot share a CODE descriptor for both kernel and user
  // because it would have to have DPL_USR, but the CPU forbids
  // an interrupt from CPL=0 to DPL=3.
  c = &cpus[cpuid()];
  c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0);
  c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
  c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER);
  c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER);
  lgdt(c->gdt, sizeof(c->gdt));
}

// Return the address of the PTE in page table pgdir
// that corresponds to virtual address va.  If alloc!=0,
// create any required page table pages.
static pte_t *
walkpgdir(pde_t *pgdir, const void *va, int alloc)
{
  pde_t *pde;
  pte_t *pgtab;

  pde = &pgdir[PDX(va)];
  if(*pde & PTE_P){
    pgtab = (pte_t*)P2V(PTE_ADDR(*pde));
  } else {
    if(!alloc || (pgtab = (pte_t*)kalloc()) == 0)
      return 0;
    // Make sure all those PTE_P bits are zero.
    memset(pgtab, 0, PGSIZE);
    // The permissions here are overly generous, but they can
    // be further restricted by the permissions in the page table
    // entries, if necessary.
    *pde = V2P(pgtab) | PTE_P | PTE_W | PTE_U;
  }
  return &pgtab[PTX(va)];
}

// Create PTEs for virtual addresses starting at va that refer to
// physical addresses starting at pa. va and size might not
// be page-aligned.
static int
mappages(pde_t *pgdir, void *va, uint size, uint pa, int perm)
{
  char *a, *last;
  pte_t *pte;

  a = (char*)PGROUNDDOWN((uint)va);
  last = (char*)PGROUNDDOWN(((uint)va) + size - 1);
  for(;;){
    if((pte = walkpgdir(pgdir, a, 1)) == 0)
      return -1;
    if(*pte & PTE_P)
      panic("remap");
    *pte = pa | perm | PTE_P;
    if(a == last)
      break;
    a += PGSIZE;
    pa += PGSIZE;
  }
  return 0;
}

// There is one page table per process, plus one that's used when
// a CPU is not running any process (kpgdir). The kernel uses the
// current process's page table during system calls and interrupts;
// page protection bits prevent user code from using the kernel's
// mappings.
//
// setupkvm() and exec() set up every page table like this:
//
//   0..KERNBASE: user memory (text+data+stack+heap), mapped to
//                phys memory allocated by the kernel
//   KERNBASE..KERNBASE+EXTMEM: mapped to 0..EXTMEM (for I/O space)
//   KERNBASE+EXTMEM..data: mapped to EXTMEM..V2P(data)
//                for the kernel's instructions and r/o data
//   data..KERNBASE+PHYSTOP: mapped to V2P(data)..PHYSTOP,
//                                  rw data + free physical memory
//   0xfe000000..0: mapped direct (devices such as ioapic)
//
// The kernel allocates physical memory for its heap and for user memory
// between V2P(end) and the end of physical memory (PHYSTOP)
// (directly addressable from end..P2V(PHYSTOP)).

// This table defines the kernel's mappings, which are present in
// every process's page table.
static struct kmap {
  void *virt;
  uint phys_start;
  uint phys_end;
  int perm;
} kmap[] = {
 { (void*)KERNBASE, 0,             EXTMEM,    PTE_W}, // I/O space
 { (void*)KERNLINK, V2P(KERNLINK), V2P(data), 0},     // kern text+rodata
 { (void*)data,     V2P(data),     PHYSTOP,   PTE_W}, // kern data+memory
 { (void*)DEVSPACE, DEVSPACE,      0,         PTE_W}, // more devices
};

// Set up kernel part of a page table.
pde_t*
setupkvm(void)
{
  pde_t *pgdir;
  struct kmap *k;

  if((pgdir = (pde_t*)kalloc()) == 0)
    return 0;
  memset(pgdir, 0, PGSIZE);
  if (P2V(PHYSTOP) > (void*)DEVSPACE)
    panic("PHYSTOP too high");
  for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
    if(mappages(pgdir, k->virt, k->phys_end - k->phys_start,
                (uint)k->phys_start, k->perm) < 0) {
      freevm(pgdir);
      return 0;
    }
  return pgdir;
}

// Allocate one page table for the machine for the kernel address
// space for scheduler processes.
void
kvmalloc(void)
{
  kpgdir = setupkvm();
  switchkvm();
}

// Switch h/w page table register to the kernel-only page table,
// for when no process is running.
void
switchkvm(void)
{
  lcr3(V2P(kpgdir));   // switch to the kernel page table
}

// Switch TSS and h/w page table to correspond to process p.
void
switchuvm(struct proc *p)
{
  if(p == 0)
    panic("switchuvm: no process");
  if(p->kstack == 0)
    panic("switchuvm: no kstack");
  if(p->pgdir == 0)
    panic("switchuvm: no pgdir");

  pushcli();
  mycpu()->gdt[SEG_TSS] = SEG16(STS_T32A, &mycpu()->ts,
                                sizeof(mycpu()->ts)-1, 0);
  mycpu()->gdt[SEG_TSS].s = 0;
  mycpu()->ts.ss0 = SEG_KDATA << 3;
  mycpu()->ts.esp0 = (uint)p->kstack + KSTACKSIZE;
  // setting IOPL=0 in eflags *and* iomb beyond the tss segment limit
  // forbids I/O instructions (e.g., inb and outb) from user space
  mycpu()->ts.iomb = (ushort) 0xFFFF;
  ltr(SEG_TSS << 3);
  lcr3(V2P(p->pgdir));  // switch to process's address space
  popcli();
}

// Load the initcode into address 0 of pgdir.
// sz must be less than a page.
void
inituvm(pde_t *pgdir, char *init, uint sz)
{
  char *mem;

  if(sz >= PGSIZE)
    panic("inituvm: more than a page");
  mem = kalloc();
  memset(mem, 0, PGSIZE);
  mappages(pgdir, 0, PGSIZE, V2P(mem), PTE_W|PTE_U);
  memmove(mem, init, sz);
}

// Load a program segment into pgdir.  addr must be page-aligned
// and the pages from addr to addr+sz must already be mapped.
int
loaduvm(pde_t *pgdir, char *addr, struct inode *ip, uint offset, uint sz)
{
  uint i, pa, n;
  pte_t *pte;

  if((uint) addr % PGSIZE != 0)
    panic("loaduvm: addr must be page aligned");
  for(i = 0; i < sz; i += PGSIZE){
    if((pte = walkpgdir(pgdir, addr+i, 0)) == 0)
      panic("loaduvm: address should exist");
    pa = PTE_ADDR(*pte);
    if(sz - i < PGSIZE)
      n = sz - i;
    else
      n = PGSIZE;
    if(readi(ip, P2V(pa), offset+i, n) != n)
      return -1;
  }
  return 0;
}

// Allocate page tables and physical memory to grow process from oldsz to
// newsz, which need not be page aligned.  Returns new size or 0 on error.
int
allocuvm(pde_t *pgdir, uint oldsz, uint newsz)
{
  char *mem;
  uint a;

  if(newsz >= KERNBASE)
    return 0;
  if(newsz < oldsz)
    return oldsz;

  a = PGROUNDUP(oldsz);
  for(; a < newsz; a += PGSIZE){
    mem = kalloc();
    if(mem == 0){
      cprintf("allocuvm out of memory\n");
      deallocuvm(pgdir, newsz, oldsz);
      return 0;
    }
    memset(mem, 0, PGSIZE);
    if(mappages(pgdir, (char*)a, PGSIZE, V2P(mem), PTE_W|PTE_U) < 0){
      cprintf("allocuvm out of memory (2)\n");
      deallocuvm(pgdir, newsz, oldsz);
      kfree(mem);
      return 0;
    }
  }
  return newsz;
}

// Deallocate user pages to bring the process size from oldsz to
// newsz.  oldsz and newsz need not be page-aligned, nor does newsz
// need to be less than oldsz.  oldsz can be larger than the actual
// process size.  Returns the new process size.
int
deallocuvm(pde_t *pgdir, uint oldsz, uint newsz)
{
  pte_t *pte;
  uint a, pa;

  if(newsz >= oldsz)
    return oldsz;

  a = PGROUNDUP(newsz);
  for(; a  < oldsz; a += PGSIZE){
    pte = walkpgdir(pgdir, (char*)a, 0);
    if(!pte)
      a = PGADDR(PDX(a) + 1, 0, 0) - PGSIZE;
    else if((*pte & PTE_P) != 0){
      pa = PTE_ADDR(*pte);
      if(pa == 0)
        panic("kfree");
      char *v = P2V(pa);
      kfree(v);
      *pte = 0;
    }
  }
  return newsz;
}

// Free a page table and all the physical memory pages
// in the user part.
void
freevm(pde_t *pgdir)
{
  uint i;

  if(pgdir == 0)
    panic("freevm: no pgdir");
  deallocuvm(pgdir, KERNBASE, 0);
  for(i = 0; i < NPDENTRIES; i++){
    if(pgdir[i] & PTE_P){
      char * v = P2V(PTE_ADDR(pgdir[i]));
      kfree(v);
    }
  }
  kfree((char*)pgdir);
}

// Clear PTE_U on a page. Used to create an inaccessible
// page beneath the user stack.
void
clearpteu(pde_t *pgdir, char *uva)
{
  pte_t *pte;

  pte = walkpgdir(pgdir, uva, 0);
  if(pte == 0)
    panic("clearpteu");
  *pte &= ~PTE_U;
}

// Given a parent process's page table, create a copy
// of it for a child.
// Given a parent process's page table, create a copy
// of it for a child, leaving the first page unmapped.
pde_t*
copyuvm(pde_t *pgdir, uint sz)
{
    pde_t *d;
    pte_t *pte;
    uint pa, i, flags;
    char *mem;

    if((d = setupkvm()) == 0)
        return 0;
    for(i = PGSIZE; i < sz; i += PGSIZE){ // start from the second page
        if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0)
            panic("copyuvm: pte should exist");
        if(!(*pte & PTE_P))
            panic("copyuvm: page not present");
        pa = PTE_ADDR(*pte);
        flags = PTE_FLAGS(*pte);
        if((mem = kalloc()) == 0)
            goto bad;
        memmove(mem, (char*)P2V(pa), PGSIZE);
        if(mappages(d, (void*)i, PGSIZE, V2P(mem), flags) < 0) {
            kfree(mem);
            goto bad;
        }
    }
    return d;

    bad:
    freevm(d);
    return 0;
}


//PAGEBREAK!
// Map user virtual address to kernel address.
char*
uva2ka(pde_t *pgdir, char *uva)
{
  pte_t *pte;

  pte = walkpgdir(pgdir, uva, 0);
  if((*pte & PTE_P) == 0)
    return 0;
  if((*pte & PTE_U) == 0)
    return 0;
  return (char*)P2V(PTE_ADDR(*pte));
}

// Copy len bytes from p to user address va in page table pgdir.
// Most useful when pgdir is not the current page table.
// uva2ka ensures this only works for PTE_U pages.
int
copyout(pde_t *pgdir, uint va, void *p, uint len)
{
  char *buf, *pa0;
  uint n, va0;

  buf = (char*)p;
  while(len > 0){
    va0 = (uint)PGROUNDDOWN(va);
    pa0 = uva2ka(pgdir, (char*)va0);
    if(pa0 == 0)
      return -1;
    n = PGSIZE - (va - va0);
    if(n > len)
      n = len;
    memmove(pa0 + (va - va0), buf, n);
    len -= n;
    buf += n;
    va = va0 + PGSIZE;
  }
  return 0;
}

void
proc_memdump(struct proc *p)
{
    cprintf("proc_memdump: pid=%d\n", p->pid);
    uint vpn;
    cprintf("VPN\tPFN\tPresent\tWrite\tUser\n");
    for (vpn = 0; vpn < USERTOP; vpn += PGSIZE) {
        pte_t *pte;
        pde_t *pde = p->pgdir;
        if ((pte = walkpgdir(pde, (void*)vpn, 0)) > 0) {
          if ((*pte)&PTE_P?1:0) {
            uint pfn = PTE_ADDR(*pte);
            cprintf("%d\t%d\t%d\t%d\t%d\n", vpn/PGSIZE, pfn>>12,
                (*pte)&PTE_P?1:0,
                (*pte)&PTE_W?1:0,
                (*pte)&PTE_U?1:0);
          }
        }
    }
}
//PAGEBREAK!
// Blank page.
//PAGEBREAK!
// Blank page.
//PAGEBREAK!
// Blank page.
#include "types.h"
#include "defs.h"
#include "param.h"
#include "memlayout.h"
#include "mmu.h"
#include "proc.h"
#include "x86.h"
#include "syscall.h"

// User code makes a system call with INT T_SYSCALL.
// System call number in %eax.
// Arguments on the stack, from the user call to the C
// library system call function. The saved user %esp points
// to a saved program counter, and then the first argument.

// Fetch the int at addr from the current process.
int
fetchint(uint addr, int *ip)
{
    struct proc *curproc = myproc();

    if(addr >= curproc->sz || addr+4 > curproc->sz)
        return -1;


    if (curproc->pid > 1 && addr < PGSIZE) // added check
        return -1;

    *ip = *(int*)(addr);
    return 0;
}

// Fetch the nul-terminated string at addr from the current process.
// Doesn't actually copy the string - just sets *pp to point at it.
// Returns length of string, not including nul.
int
fetchstr(uint addr, char **pp)
{
    char *s, *ep;
    struct proc *curproc = myproc();

    if(addr >= curproc->sz)
        return -1;

    // P5: Check if the address is within the first page
    if (curproc->pid > 1 && addr < PGSIZE)
        return -1;

    *pp = (char*)addr;
    ep = (char*)curproc->sz;
    for(s = *pp; s < ep; s++){
        if(*s == 0)
            return s - *pp;
    }
    return -1;
}


// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
  return fetchint((myproc()->tf->esp) + 4 + 4*n, ip);
}

// Fetch the nth word-sized system call argument as a pointer
// to a block of memory of size bytes.  Check that the pointer
// lies within the process address space.
int
argptr(int n, char **pp, int size)
{
    int i;
    struct proc *curproc = myproc();

    if(argint(n, &i) < 0)
        return -1;
    if(size < 0 || (uint)i >= curproc->sz || (uint)i+size > curproc->sz)
        return -1;


    if (curproc->pid > 1 && (uint)i < PGSIZE) // added for check
        return -1;

    *pp = (char*)i;
    return 0;
}


// Fetch the nth word-sized system call argument as a string pointer.
// Check that the pointer is valid and the string is nul-terminated.
// (There is no shared writable memory, so the string can't change
// between this check and being used by the kernel.)
int
argstr(int n, char **pp)
{
  int addr;
  if(argint(n, &addr) < 0)
    return -1;
  return fetchstr(addr, pp);
}

extern int sys_chdir(void);
extern int sys_close(void);
extern int sys_dup(void);
extern int sys_exec(void);
extern int sys_exit(void);
extern int sys_fork(void);
extern int sys_fstat(void);
extern int sys_getpid(void);
extern int sys_kill(void);
extern int sys_link(void);
extern int sys_mkdir(void);
extern int sys_mknod(void);
extern int sys_open(void);
extern int sys_pipe(void);
extern int sys_read(void);
extern int sys_sbrk(void);
extern int sys_sleep(void);
extern int sys_unlink(void);
extern int sys_wait(void);
extern int sys_write(void);
extern int sys_uptime(void);
extern int sys_memdump(void);

static int (*syscalls[])(void) = {
[SYS_fork]    sys_fork,
[SYS_exit]    sys_exit,
[SYS_wait]    sys_wait,
[SYS_pipe]    sys_pipe,
[SYS_read]    sys_read,
[SYS_kill]    sys_kill,
[SYS_exec]    sys_exec,
[SYS_fstat]   sys_fstat,
[SYS_chdir]   sys_chdir,
[SYS_dup]     sys_dup,
[SYS_getpid]  sys_getpid,
[SYS_sbrk]    sys_sbrk,
[SYS_sleep]   sys_sleep,
[SYS_uptime]  sys_uptime,
[SYS_open]    sys_open,
[SYS_write]   sys_write,
[SYS_mknod]   sys_mknod,
[SYS_unlink]  sys_unlink,
[SYS_link]    sys_link,
[SYS_mkdir]   sys_mkdir,
[SYS_close]   sys_close,
[SYS_memdump] sys_memdump,
};

void
syscall(void)
{
  int num;
  struct proc *curproc = myproc();

  num = curproc->tf->eax;
  if(num > 0 && num < NELEM(syscalls) && syscalls[num]) {
    curproc->tf->eax = syscalls[num]();
  } else {
    cprintf("%d %s: unknown sys call %d\n",
            curproc->pid, curproc->name, num);
    curproc->tf->eax = -1;
  }
}
#include "types.h"
#include "defs.h"
#include "param.h"
#include "memlayout.h"
#include "mmu.h"
#include "x86.h"
#include "proc.h"
#include "spinlock.h"

struct {
  struct spinlock lock;
  struct proc proc[NPROC];
} ptable;

static struct proc *initproc;

int nextpid = 1;
extern void forkret(void);
extern void trapret(void);

static void wakeup1(void *chan);

void
pinit(void)
{
  initlock(&ptable.lock, "ptable");
}

// Must be called with interrupts disabled
int
cpuid() {
  return mycpu()-cpus;
}

// Must be called with interrupts disabled to avoid the caller being
// rescheduled between reading lapicid and running through the loop.
struct cpu*
mycpu(void)
{
  int apicid, i;

  if(readeflags()&FL_IF)
    panic("mycpu called with interrupts enabled\n");

  apicid = lapicid();
  // APIC IDs are not guaranteed to be contiguous. Maybe we should have
  // a reverse map, or reserve a register to store &cpus[i].
  for (i = 0; i < ncpu; ++i) {
    if (cpus[i].apicid == apicid)
      return &cpus[i];
  }
  panic("unknown apicid\n");
}

// Disable interrupts so that we are not rescheduled
// while reading proc from the cpu structure
struct proc*
myproc(void) {
  struct cpu *c;
  struct proc *p;
  pushcli();
  c = mycpu();
  p = c->proc;
  popcli();
  return p;
}

//PAGEBREAK: 32
// Look in the process table for an UNUSED proc.
// If found, change state to EMBRYO and initialize
// state required to run in the kernel.
// Otherwise return 0.
static struct proc*
allocproc(void)
{
  struct proc *p;
  char *sp;

  acquire(&ptable.lock);

  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
    if(p->state == UNUSED)
      goto found;

  release(&ptable.lock);
  return 0;

found:
  p->state = EMBRYO;
  p->pid = nextpid++;
  

  release(&ptable.lock);

  // Allocate kernel stack.
  if((p->kstack = kalloc()) == 0){
    p->state = UNUSED;
    return 0;
  }
  sp = p->kstack + KSTACKSIZE;

  // Leave room for trap frame.
  sp -= sizeof *p->tf;
  p->tf = (struct trapframe*)sp;

  // Set up new context to start executing at forkret,
  // which returns to trapret.
  sp -= 4;
  *(uint*)sp = (uint)trapret;

  sp -= sizeof *p->context;
  p->context = (struct context*)sp;
  memset(p->context, 0, sizeof *p->context);
  p->context->eip = (uint)forkret;

  return p;
}

//PAGEBREAK: 32
// Set up first user process.
void userinit(void) {
    struct proc *p;
    extern char _binary_initcode_start[], _binary_initcode_size[];

    p = allocproc();

    initproc = p;
    if ((p->pgdir = setupkvm()) == 0)
        panic("userinit: out of memory?");
    inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size);


    p->sz = PGSIZE; // ensuring the first user process starts with memory layout

    memset(p->tf, 0, sizeof(*p->tf));
    p->tf->cs = (SEG_UCODE << 3) | DPL_USER;
    p->tf->ds = (SEG_UDATA << 3) | DPL_USER;
    p->tf->es = p->tf->ds;
    p->tf->ss = p->tf->ds;
    p->tf->eflags = FL_IF;
    p->tf->esp = PGSIZE; // stack pointer starts at end of first page
    p->tf->eip = 0; // inst pointer starts at beginning of text seg

    safestrcpy(p->name, "initcode", sizeof(p->name));
    p->cwd = namei("/");

    acquire(&ptable.lock);
    p->state = RUNNABLE;
    release(&ptable.lock);
}


// Grow current process's memory by n bytes.
// Return 0 on success, -1 on failure.
int
growproc(int n)
{
  uint sz;
  struct proc *curproc = myproc();

  sz = curproc->sz;
  if(n > 0){
    if((sz = allocuvm(curproc->pgdir, sz, sz + n)) == 0)
      return -1;
  } else if(n < 0){
    if((sz = deallocuvm(curproc->pgdir, sz, sz + n)) == 0)
      return -1;
  }
  curproc->sz = sz;
  switchuvm(curproc);
  return 0;
}

// Create a new process copying p as the parent.
// Sets up stack to return as if from system call.
// Caller must set state of returned proc to RUNNABLE.
int
fork(void)
{
  int i, pid;
  struct proc *np;
  struct proc *curproc = myproc();

  // Allocate process.
  if((np = allocproc()) == 0){
    return -1;
  }

  // Copy process state from proc.
  if((np->pgdir = copyuvm(curproc->pgdir, curproc->sz)) == 0){
    kfree(np->kstack);
    np->kstack = 0;
    np->state = UNUSED;
    return -1;
  }
  np->sz = curproc->sz;
  np->parent = curproc;
  *np->tf = *curproc->tf;

  // Clear %eax so that fork returns 0 in the child.
  np->tf->eax = 0;

  for(i = 0; i < NOFILE; i++)
    if(curproc->ofile[i])
      np->ofile[i] = filedup(curproc->ofile[i]);
  np->cwd = idup(curproc->cwd);

  safestrcpy(np->name, curproc->name, sizeof(curproc->name));

  pid = np->pid;

  acquire(&ptable.lock);

  np->state = RUNNABLE;

  release(&ptable.lock);

  return pid;
}

// Exit the current process.  Does not return.
// An exited process remains in the zombie state
// until its parent calls wait() to find out it exited.
void
exit(void)
{
  struct proc *curproc = myproc();
  struct proc *p;
  int fd;

  if(curproc == initproc)
    panic("init exiting");

  // Close all open files.
  for(fd = 0; fd < NOFILE; fd++){
    if(curproc->ofile[fd]){
      fileclose(curproc->ofile[fd]);
      curproc->ofile[fd] = 0;
    }
  }

  begin_op();
  iput(curproc->cwd);
  end_op();
  curproc->cwd = 0;

  acquire(&ptable.lock);

  // Parent might be sleeping in wait().
  wakeup1(curproc->parent);

  // Pass abandoned children to init.
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
    if(p->parent == curproc){
      p->parent = initproc;
      if(p->state == ZOMBIE)
        wakeup1(initproc);
    }
  }

  // Jump into the scheduler, never to return.
  curproc->state = ZOMBIE;
  sched();
  panic("zombie exit");
}

// Wait for a child process to exit and return its pid.
// Return -1 if this process has no children.
int
wait(void)
{
  struct proc *p;
  int havekids, pid;
  struct proc *curproc = myproc();

  acquire(&ptable.lock);
  for(;;){
    // Scan through table looking for exited children.
    havekids = 0;
    for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
      if(p->parent != curproc)
        continue;
      havekids = 1;
      if(p->state == ZOMBIE){
        // Found one.
        pid = p->pid;
        kfree(p->kstack);
        p->kstack = 0;
        freevm(p->pgdir);
        p->pid = 0;
        p->parent = 0;
        p->name[0] = 0;
        p->killed = 0;
        p->state = UNUSED;
        release(&ptable.lock);
        return pid;
      }
    }

    // No point waiting if we don't have any children.
    if(!havekids || curproc->killed){
      release(&ptable.lock);
      return -1;
    }

    // Wait for children to exit.  (See wakeup1 call in proc_exit.)
    sleep(curproc, &ptable.lock);  //DOC: wait-sleep
  }
}

//PAGEBREAK: 42
// Per-CPU process scheduler.
// Each CPU calls scheduler() after setting itself up.
// Scheduler never returns.  It loops, doing:
//  - choose a process to run
//  - swtch to start running that process
//  - eventually that process transfers control
//      via swtch back to the scheduler.
void
scheduler(void)
{
  struct proc *p;
  struct cpu *c = mycpu();
  c->proc = 0;

  for(;;){
    // Enable interrupts on this processor.
    sti();

    // Loop over process table looking for process to run.
    acquire(&ptable.lock);
    for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
      if(p->state != RUNNABLE)
        continue;

      // Switch to chosen process.  It is the process's job
      // to release ptable.lock and then reacquire it
      // before jumping back to us.
      c->proc = p;
      switchuvm(p);
      p->state = RUNNING;

      swtch(&(c->scheduler), p->context);
      switchkvm();

      // Process is done running for now.
      // It should have changed its p->state before coming back.
      c->proc = 0;
    }
    release(&ptable.lock);

  }
}

// Enter scheduler.  Must hold only ptable.lock
// and have changed proc->state. Saves and restores
// intena because intena is a property of this
// kernel thread, not this CPU. It should
// be proc->intena and proc->ncli, but that would
// break in the few places where a lock is held but
// there's no process.
void
sched(void)
{
  int intena;
  struct proc *p = myproc();

  if(!holding(&ptable.lock))
    panic("sched ptable.lock");
  if(mycpu()->ncli != 1)
    panic("sched locks");
  if(p->state == RUNNING)
    panic("sched running");
  if(readeflags()&FL_IF)
    panic("sched interruptible");
  intena = mycpu()->intena;
  swtch(&p->context, mycpu()->scheduler);
  mycpu()->intena = intena;
}

// Give up the CPU for one scheduling round.
void
yield(void)
{
  acquire(&ptable.lock);  //DOC: yieldlock
  myproc()->state = RUNNABLE;
  sched();
  release(&ptable.lock);
}

// A fork child's very first scheduling by scheduler()
// will swtch here.  "Return" to user space.
void
forkret(void)
{
  static int first = 1;
  // Still holding ptable.lock from scheduler.
  release(&ptable.lock);

  if (first) {
    // Some initialization functions must be run in the context
    // of a regular process (e.g., they call sleep), and thus cannot
    // be run from main().
    first = 0;
    iinit(ROOTDEV);
    initlog(ROOTDEV);
  }

  // Return to "caller", actually trapret (see allocproc).
}

// Atomically release lock and sleep on chan.
// Reacquires lock when awakened.
void
sleep(void *chan, struct spinlock *lk)
{
  struct proc *p = myproc();

  if(p == 0)
    panic("sleep");

  if(lk == 0)
    panic("sleep without lk");

  // Must acquire ptable.lock in order to
  // change p->state and then call sched.
  // Once we hold ptable.lock, we can be
  // guaranteed that we won't miss any wakeup
  // (wakeup runs with ptable.lock locked),
  // so it's okay to release lk.
  if(lk != &ptable.lock){  //DOC: sleeplock0
    acquire(&ptable.lock);  //DOC: sleeplock1
    release(lk);
  }
  // Go to sleep.
  p->chan = chan;
  p->state = SLEEPING;

  sched();

  // Tidy up.
  p->chan = 0;

  // Reacquire original lock.
  if(lk != &ptable.lock){  //DOC: sleeplock2
    release(&ptable.lock);
    acquire(lk);
  }
}

//PAGEBREAK!
// Wake up all processes sleeping on chan.
// The ptable lock must be held.
static void
wakeup1(void *chan)
{
  struct proc *p;

  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
    if(p->state == SLEEPING && p->chan == chan)
      p->state = RUNNABLE;
}

// Wake up all processes sleeping on chan.
void
wakeup(void *chan)
{
  acquire(&ptable.lock);
  wakeup1(chan);
  release(&ptable.lock);
}

// Kill the process with the given pid.
// Process won't exit until it returns
// to user space (see trap in trap.c).
int
kill(int pid)
{
  struct proc *p;

  acquire(&ptable.lock);
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
    if(p->pid == pid){
      p->killed = 1;
      // Wake process from sleep if necessary.
      if(p->state == SLEEPING)
        p->state = RUNNABLE;
      release(&ptable.lock);
      return 0;
    }
  }
  release(&ptable.lock);
  return -1;
}

//PAGEBREAK: 36
// Print a process listing to console.  For debugging.
// Runs when user types ^P on console.
// No lock to avoid wedging a stuck machine further.
void
procdump(void)
{
  static char *states[] = {
  [UNUSED]    "unused",
  [EMBRYO]    "embryo",
  [SLEEPING]  "sleep ",
  [RUNNABLE]  "runble",
  [RUNNING]   "run   ",
  [ZOMBIE]    "zombie"
  };
  int i;
  struct proc *p;
  char *state;
  uint pc[10];

  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
    if(p->state == UNUSED)
      continue;
    if(p->state >= 0 && p->state < NELEM(states) && states[p->state])
      state = states[p->state];
    else
      state = "???";
    cprintf("%d %s %s", p->pid, state, p->name);
    if(p->state == SLEEPING){
      getcallerpcs((uint*)p->context->ebp+2, pc);
      for(i=0; i<10 && pc[i] != 0; i++)
        cprintf(" %p", pc[i]);
    }
    cprintf("\n");
  }
}

int
kern_memdump(int pid) {
    int rv = -1;
    acquire(&ptable.lock);
    if (pid < 0 || pid >= NPROC) {
      release(&ptable.lock);
      return rv;
    }
    int i;
    for (i = 0; i < NPROC; i++) {
       if (ptable.proc[i].state != UNUSED && ptable.proc[i].pid == pid) {
          struct proc *p = &ptable.proc[i];
          proc_memdump(p);
          rv = 0;
          break;
       }
    }
    release(&ptable.lock);
    return rv;
}
#include "types.h"
#include "param.h"
#include "memlayout.h"
#include "mmu.h"
#include "proc.h"
#include "defs.h"
#include "x86.h"
#include "elf.h"

int
exec(char *path, char **argv)
{
    char *s, *last;
    int i, off;
    uint argc, sz, sp, ustack[3+MAXARG+1];
    struct elfhdr elf;
    struct inode *ip;
    struct proghdr ph;
    pde_t *pgdir, *oldpgdir;
    struct proc *curproc = myproc();

    begin_op();

    if((ip = namei(path)) == 0){
        end_op();
        cprintf("exec: fail\n");
        return -1;
    }
    ilock(ip);
    pgdir = 0;

    // Check ELF header
    if(readi(ip, (char*)&elf, 0, sizeof(elf)) != sizeof(elf))
        goto bad;
    if(elf.magic != ELF_MAGIC)
        goto bad;

    if((pgdir = setupkvm()) == 0)
        goto bad;


    sz = PGSIZE;  // start from the second page
    for(i = 0, off = elf.phoff; i < elf.phnum; i++, off += sizeof(ph)){
        if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph))
            goto bad;
        if(ph.type != ELF_PROG_LOAD)
            continue;
        if(ph.memsz < ph.filesz)
            goto bad;
        if(ph.vaddr + ph.memsz < ph.vaddr)
            goto bad;

        if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0) // ensuring that program loading starts at the correct address
            goto bad;
        if(ph.vaddr % PGSIZE != 0)
            goto bad;
        if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0)
            goto bad;
    }
    iunlockput(ip);
    end_op();
    ip = 0;

    // Allocate two pages at the next page boundary, adjusting for the new starting point.
    // Still make the first page of actual program code inaccessible to mimic the unmapped first page.
    sz = PGROUNDUP(sz);
    if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0)
        goto bad;
    clearpteu(pgdir, (char*)(sz - 2*PGSIZE));
    sp = sz;

    // Push argument strings, prepare rest of stack in ustack.
    for(argc = 0; argv[argc]; argc++) {
        if(argc >= MAXARG)
            goto bad;
        sp = (sp - (strlen(argv[argc]) + 1)) & ~3;
        if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
            goto bad;
        ustack[3+argc] = sp;
    }
    ustack[3+argc] = 0;

    ustack[0] = 0xffffffff;  // fake return PC
    ustack[1] = argc;
    ustack[2] = sp - (argc+1)*4;  // argv pointer

    sp -= (3+argc+1) * 4;
    if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0)
        goto bad;

    // Save program name for debugging.
    for(last=s=path; *s; s++)
        if(*s == '/')
            last = s+1;
    safestrcpy(curproc->name, last, sizeof(curproc->name));

    // Commit to the user image.
    oldpgdir = curproc->pgdir;
    curproc->pgdir = pgdir;
    curproc->sz = sz;
    curproc->tf->eip = elf.entry;  // main
    curproc->tf->esp = sp;
    switchuvm(curproc);
    freevm(oldpgdir);
    return 0;

    bad:
    if(pgdir)
        freevm(pgdir);
    if(ip){
        iunlockput(ip);
        end_op();
    }
    return -1;
}
      "<svg class=\"$1\">",
      "  <use xlink:href=\"img/sprite.svg#$2\"></use>",
      "</svg>"
# Using list() to convert a list into a list
my_list = [1, 2, 3]
converted_list = list(my_list)
print("Converted list:", converted_list)

# Using tuple() to convert a list into a tuple
my_list = [1, 2, 3]
converted_tuple = tuple(my_list)
print("Converted tuple:", converted_tuple)
Write a function named only_ints that takes two parameters. Your function should return True if both parameters are integers, and False otherwise.

For example, calling only_ints(1, 2) should return True, while calling only_ints("a", 1) should return False.
ChatGPT
ChatGPT
Here's a Python function named only_ints that checks if both parameters are integers:

python
Copy code
def only_ints(param1, param2):
    return isinstance(param1, int) and isinstance(param2, int)

# Example usage:
print(only_ints(1, 2))   # Output: True
print(only_ints("a", 1))  # Output: False

Copy and Save

Share

Ask Copilot

This function uses the isinstance() function to check if both parameters are of type int. If both are integers, it returns True; otherwise, it returns False.
An infinite loop
It would be easy, but wrong, to write the above code like this:

import random
correct_answer = random.randint(1, 10)
guess = int(input("Guess a number between 1 and 10: "))
while guess != correct_answer:
    if guess == correct_answer:
        print("Correct!")
    else:
        print("Wrong :(")
Copy code

Copy And Save

Share

Ask Copilot

 Save
That's because we are asking the user for their guess only once, in the beginning, but not inside the loop. When Python returns to repeat the lines inside the loop, none of those ask the user for another guess. The program will keep printing "Wrong :(" over and over again forever.

Here is another infinite loop:

import time
while True:
    time.sleep(1)
    print("loop")
Copy code

Copy And Save

Share

Ask Copilot

 Save
The condition here is simply "True". It is literally (and by design) never false. So the loop will continue forever.
import random

correct_answer = random.randint(1, 10)
guess = 0

while guess != correct_answer:
    guess = int(input("Gissa ett tal mellan 1 och 10: "))

    if guess == correct_answer:
        print("Correct!")
    else:
        print("Wrong :(")
<style>
body{background:url("https://static.wikia.nocookie.net/life-is-strange/images/a/ac/LIS_-_Victoria-Bedroom.jpg/revision/latest?cb=20150712212736") no-repeat fixed; background-size:cover;}
</style>

<style>
.profile {
background:#b7a7aa;
border-radius: 15px;

 }
</style>

<style>
.general-about {

 background:#948789;

  border-radius: 30px;
</style>

<style>
.blog-preview {

  background:#948789;

  border-radius: 15px;
</style>

<style>
.blurbs {

    background:#948789;

  border-radius: 3px;
 }
</style>

<style>

.contact .inner a img {

font-size: 0;

}

.contact .inner a img:before {

font-size: 1em;

display: block

}

</style>

<style>
main a {
  color: var(--black);
</style>

<style>
.profile .contact, .profile .table-section, .profile .url-info {
  border: 5px solid #948789;
border-radius: 20px;
}
</style>

<style>
.profile .contact .heading, .profile .table-section .heading, .home-actions .heading {
  background-color:#948789;
  color: ;
border-radius: 10px;
</style>

<style>
.profile .table-section .details-table td {
  background-color: #948789;
  color: #5e5657;
border-radius: 10px;
}
</style>

<style>
.profile .blurbs .heading, .profile .friends .heading {
  background-color: #948789;
  color: #fff;
border-radius: 60px;
</style>

<style>
@import url("https://robins.one/spacehey/addons/modern-comments.css");

</style>

<style>
p {
color: #5e5657;
}
</style>

<style>

 .blurbs .section h4{display: none !important;}

</style>

<style>

  .blurbs .heading{ font-size:0; }

.blurbs .heading:before{ content: "❝Now you're totally stuck in the retro zone.. sad face :(❞"; font-size:.8rem; font-weight:bold; color:insert color; }

</style>

<style>
@import url('https://fonts.googleapis.com/css2?family=Fasthand&family=Patrick+Hand&display=swap');
p{
  font-family: 'Patrick Hand', cursive;
  font-size: 140%;
}
h1,h2,h3,h4,h5{
  font-family: 'Patrick Hand', cursive;
  font-size: 160%;  
</style>

<style>
@import url("https://fonts.googleapis.com/css2?family=Fasthand&family=Oleo+Script:wght@400;700&family=Patrick+Hand&display=swap");

.w-40 h1{
font-family: Oleo Script;
font-size: 40px;
text-align: center;
background: -webkit-linear-gradient(#ffff, #ffff);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
-webkit-text-stroke: 1px white;
}
</style>


<img src="https://i.pinimg.com/564x/1c/44/de/1c44dee19868220819132782ea4dfb5a.jpg"/>
  

<img src="https://i.pinimg.com/564x/c8/ff/e1/c8ffe11c8a99bb3894f6923274c0035e.jpg"/>

<style>
.online { visibility: hidden; } .online img { content: url("https://xyz.crd.co/assets/images/gallery08/6f775f2c.png?v=4ca63763"); animation-name: none; visibility: visible; height: 30px; width: 30px
</style>


<style>
nav{background-color:#948789;(--box_color_and_seethru); !important;border-radius: 0px 0px var(--curve) var(--curve); !important; border-radius: 15px;}

nav ul{background:none !important;}

nav img{filter: opacity(80%) !important;}

nav ul a img, .mood a img{display:none !important;}

.top{background:none !important;background-color:rgba(0, 0, 0, 0.1); !important;}

<style>
li.active .icon { content:url('https://xyz.crd.co/assets/images/gallery12/f45cb68e.gif?v=4ca63763'); width: 20PX;height: 20px;}
</style>

<style>
.profile-pic {
    background: #fff;
    padding: 5px 5px 196px;
    box-shadow: 3px 3px 10px silver;}
</style>

<style>
main:before {
	width: 100%;
	height: 150px;
	display: block;
	content: "";
	background-image: url('https://64.media.tumblr.com/6f9e0446ee841569d2c4b20542b74e5e/a8177aa47ca07e3c-5f/s540x810/cdd595853101e9027bfd218859e60821687d203b.gif');
	background-position: center center;
	background-size: cover;
border-radius: 15px;
}
@media only screen and (max-width: 600px) {
	main:before{
		height: 200px;
	}
}
</style>

<style>
.profile .friends .person img:not(.icon):hover {
    transform: scale(1.2);
    transition: 0.5s ease;
}
.profile .friends .person img:not(.icon) {
    transition: 0.5s ease
}
</style>

<style>
 .profile .friends .person img {
        border-radius: 500px;
    }
</style>

<style>

body:before {

content: " ";

height: 100vh;

width: 100vw;

display: block;

position: fixed; 

top: 0; 

left: 0; 

z-index: 100;

background-image: url('https://64.media.tumblr.com/4330af98ddd856c140ef079da0e462a4/tumblr_pfffh4pYjL1un7uhro5_400.gif');

background-size: cover;

background-repeat: no-repeat;

background-position:center;

animation: yourAnimation 1s ease 1s 1 normal forwards;

pointer-events: none;}

@keyframes yourAnimation { 0.0%{ opacity: 1;} 75%{ opacity: 1; } 100%{ opacity: 0;} } 

</style>

<style>* {cursor: url(http://www.rw-designer.com/cursor-view/109862.png), url(http://www.rw-designer.com/cursor-view/109862.png), auto !important;}</style>

<iframe width="1" height="1" src="https://www.youtube.com/embed/3JPA3z5PmJQ?si=ZIZIrF30D5E9dUUv?&;amp;;autoplay=1&;loop=1" title="Youtube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope;picture-in-picture" allowfullscreen=""></iframe>
Opposites
The last important keyword is not.

if not (ram < 8):
    print("Enough memory")
Copy code

Copy And Save

Share

Ask Copilot

 Save
This is equivalent to writing:

if ram >= 8:
    print("Enouph memory")
Copy code

Copy And Save

Share

Ask Copilot

 Save
Notice that it's >= now. Why? (What happens if the variable ram is exactly 8?)

All of this is the field of logic!
718505db7c651fd1735b3d683a9815bf
Converting between types
These two variables seem to contain the same thing: 

birthyear = 2010
year = "2010"
A program will only work properly if we as programmers keep track of what type of data is where. It's important, because that decides what we are able to do with a variable.

For example, the following code works:

# Example 1
print(kids_in_the_class + temperature)
kids_in_the_class = 25
temperature = 18.5
my_language = "python"
import 'dart:async';

import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

class Otp extends StatefulWidget {
  final String email;
  final String newEmail;
  final bool isGuestCheckOut;

  const Otp({
    Key key,
    @required this.email,
    this.newEmail = "",
    this.isGuestCheckOut,
  }) : super(key: key);

  @override
  _OtpState createState() => new _OtpState();
}

class _OtpState extends State<Otp> with SingleTickerProviderStateMixin {
  // Constants
  final int time = 30;
  AnimationController _controller;

  // Variables
  Size _screenSize;
  int _currentDigit;
  int _firstDigit;
  int _secondDigit;
  int _thirdDigit;
  int _fourthDigit;

  Timer timer;
  int totalTimeInSeconds;
  bool _hideResendButton;

  String userName = "";
  bool didReadNotifications = false;
  int unReadNotificationsCount = 0;

  // Returns "Appbar"
  get _getAppbar {
    return new AppBar(
      backgroundColor: Colors.transparent,
      elevation: 0.0,
      leading: new InkWell(
        borderRadius: BorderRadius.circular(30.0),
        child: new Icon(
          Icons.arrow_back,
          color: Colors.black54,
        ),
        onTap: () {
          Navigator.pop(context);
        },
      ),
      centerTitle: true,
    );
  }

  // Return "Verification Code" label
  get _getVerificationCodeLabel {
    return new Text(
      "Verification Code",
      textAlign: TextAlign.center,
      style: new TextStyle(
          fontSize: 28.0, color: Colors.black, fontWeight: FontWeight.bold),
    );
  }

  // Return "Email" label
  get _getEmailLabel {
    return new Text(
      "Please enter the OTP sent\non your registered Email ID.",
      textAlign: TextAlign.center,
      style: new TextStyle(
          fontSize: 18.0, color: Colors.black, fontWeight: FontWeight.w600),
    );
  }

  // Return "OTP" input field
  get _getInputField {
    return new Row(
      mainAxisAlignment: MainAxisAlignment.spaceEvenly,
      children: <Widget>[
        _otpTextField(_firstDigit),
        _otpTextField(_secondDigit),
        _otpTextField(_thirdDigit),
        _otpTextField(_fourthDigit),
      ],
    );
  }

  // Returns "OTP" input part
  get _getInputPart {
    return new Column(
      mainAxisSize: MainAxisSize.max,
      mainAxisAlignment: MainAxisAlignment.spaceBetween,
      children: <Widget>[
        _getVerificationCodeLabel,
        _getEmailLabel,
        _getInputField,
        _hideResendButton ? _getTimerText : _getResendButton,
        _getOtpKeyboard
      ],
    );
  }

  // Returns "Timer" label
  get _getTimerText {
    return Container(
      height: 32,
      child: new Offstage(
        offstage: !_hideResendButton,
        child: Row(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            new Icon(Icons.access_time),
            new SizedBox(
              width: 5.0,
            ),
            OtpTimer(_controller, 15.0, Colors.black)
          ],
        ),
      ),
    );
  }

  // Returns "Resend" button
  get _getResendButton {
    return new InkWell(
      child: new Container(
        height: 32,
        width: 120,
        decoration: BoxDecoration(
            color: Colors.black,
            shape: BoxShape.rectangle,
            borderRadius: BorderRadius.circular(32)),
        alignment: Alignment.center,
        child: new Text(
          "Resend OTP",
          style:
              new TextStyle(fontWeight: FontWeight.bold, color: Colors.white),
        ),
      ),
      onTap: () {
        // Resend you OTP via API or anything
      },
    );
  }

  // Returns "Otp" keyboard
  get _getOtpKeyboard {
    return new Container(
        height: _screenSize.width - 80,
        child: new Column(
          children: <Widget>[
            new Expanded(
              child: new Row(
                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                children: <Widget>[
                  _otpKeyboardInputButton(
                      label: "1",
                      onPressed: () {
                        _setCurrentDigit(1);
                      }),
                  _otpKeyboardInputButton(
                      label: "2",
                      onPressed: () {
                        _setCurrentDigit(2);
                      }),
                  _otpKeyboardInputButton(
                      label: "3",
                      onPressed: () {
                        _setCurrentDigit(3);
                      }),
                ],
              ),
            ),
            new Expanded(
              child: new Row(
                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                children: <Widget>[
                  _otpKeyboardInputButton(
                      label: "4",
                      onPressed: () {
                        _setCurrentDigit(4);
                      }),
                  _otpKeyboardInputButton(
                      label: "5",
                      onPressed: () {
                        _setCurrentDigit(5);
                      }),
                  _otpKeyboardInputButton(
                      label: "6",
                      onPressed: () {
                        _setCurrentDigit(6);
                      }),
                ],
              ),
            ),
            new Expanded(
              child: new Row(
                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                children: <Widget>[
                  _otpKeyboardInputButton(
                      label: "7",
                      onPressed: () {
                        _setCurrentDigit(7);
                      }),
                  _otpKeyboardInputButton(
                      label: "8",
                      onPressed: () {
                        _setCurrentDigit(8);
                      }),
                  _otpKeyboardInputButton(
                      label: "9",
                      onPressed: () {
                        _setCurrentDigit(9);
                      }),
                ],
              ),
            ),
            new Expanded(
              child: new Row(
                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                children: <Widget>[
                  new SizedBox(
                    width: 80.0,
                  ),
                  _otpKeyboardInputButton(
                      label: "0",
                      onPressed: () {
                        _setCurrentDigit(0);
                      }),
                  _otpKeyboardActionButton(
                      label: new Icon(
                        Icons.backspace,
                        color: Colors.black,
                      ),
                      onPressed: () {
                        setState(() {
                          if (_fourthDigit != null) {
                            _fourthDigit = null;
                          } else if (_thirdDigit != null) {
                            _thirdDigit = null;
                          } else if (_secondDigit != null) {
                            _secondDigit = null;
                          } else if (_firstDigit != null) {
                            _firstDigit = null;
                          }
                        });
                      }),
                ],
              ),
            ),
          ],
        ));
  }

  // Overridden methods
  @override
  void initState() {
    totalTimeInSeconds = time;
    super.initState();
    _controller =
        AnimationController(vsync: this, duration: Duration(seconds: time))
          ..addStatusListener((status) {
            if (status == AnimationStatus.dismissed) {
              setState(() {
                _hideResendButton = !_hideResendButton;
              });
            }
          });
    _controller.reverse(
        from: _controller.value == 0.0 ? 1.0 : _controller.value);
    _startCountdown();
  }

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    _screenSize = MediaQuery.of(context).size;
    return new Scaffold(
      appBar: _getAppbar,
      backgroundColor: Colors.white,
      body: new Container(
        width: _screenSize.width,
//        padding: new EdgeInsets.only(bottom: 16.0),
        child: _getInputPart,
      ),
    );
  }

  // Returns "Otp custom text field"
  Widget _otpTextField(int digit) {
    return new Container(
      width: 35.0,
      height: 45.0,
      alignment: Alignment.center,
      child: new Text(
        digit != null ? digit.toString() : "",
        style: new TextStyle(
          fontSize: 30.0,
          color: Colors.black,
        ),
      ),
      decoration: BoxDecoration(
//            color: Colors.grey.withOpacity(0.4),
          border: Border(
              bottom: BorderSide(
        width: 2.0,
        color: Colors.black,
      ))),
    );
  }

  // Returns "Otp keyboard input Button"
  Widget _otpKeyboardInputButton({String label, VoidCallback onPressed}) {
    return new Material(
      color: Colors.transparent,
      child: new InkWell(
        onTap: onPressed,
        borderRadius: new BorderRadius.circular(40.0),
        child: new Container(
          height: 80.0,
          width: 80.0,
          decoration: new BoxDecoration(
            shape: BoxShape.circle,
          ),
          child: new Center(
            child: new Text(
              label,
              style: new TextStyle(
                fontSize: 30.0,
                color: Colors.black,
              ),
            ),
          ),
        ),
      ),
    );
  }

  // Returns "Otp keyboard action Button"
  _otpKeyboardActionButton({Widget label, VoidCallback onPressed}) {
    return new InkWell(
      onTap: onPressed,
      borderRadius: new BorderRadius.circular(40.0),
      child: new Container(
        height: 80.0,
        width: 80.0,
        decoration: new BoxDecoration(
          shape: BoxShape.circle,
        ),
        child: new Center(
          child: label,
        ),
      ),
    );
  }

  // Current digit
  void _setCurrentDigit(int i) {
    setState(() {
      _currentDigit = i;
      if (_firstDigit == null) {
        _firstDigit = _currentDigit;
      } else if (_secondDigit == null) {
        _secondDigit = _currentDigit;
      } else if (_thirdDigit == null) {
        _thirdDigit = _currentDigit;
      } else if (_fourthDigit == null) {
        _fourthDigit = _currentDigit;

        var otp = _firstDigit.toString() +
            _secondDigit.toString() +
            _thirdDigit.toString() +
            _fourthDigit.toString();

        // Verify your otp by here. API call
      }
    });
  }

  Future<Null> _startCountdown() async {
    setState(() {
      _hideResendButton = true;
      totalTimeInSeconds = time;
    });
    _controller.reverse(
        from: _controller.value == 0.0 ? 1.0 : _controller.value);
  }

  void clearOtp() {
    _fourthDigit = null;
    _thirdDigit = null;
    _secondDigit = null;
    _firstDigit = null;
    setState(() {});
  }
}

class OtpTimer extends StatelessWidget {
  final AnimationController controller;
  double fontSize;
  Color timeColor = Colors.black;

  OtpTimer(this.controller, this.fontSize, this.timeColor);

  String get timerString {
    Duration duration = controller.duration * controller.value;
    if (duration.inHours > 0) {
      return '${duration.inHours}:${duration.inMinutes % 60}:${(duration.inSeconds % 60).toString().padLeft(2, '0')}';
    }
    return '${duration.inMinutes % 60}:${(duration.inSeconds % 60).toString().padLeft(2, '0')}';
  }

  Duration get duration {
    Duration duration = controller.duration;
    return duration;
  }

  @override
  Widget build(BuildContext context) {
    return AnimatedBuilder(
        animation: controller,
        builder: (BuildContext context, Widget child) {
          return new Text(
            timerString,
            style: new TextStyle(
                fontSize: fontSize,
                color: timeColor,
                fontWeight: FontWeight.w600),
          );
        });
  }
}
<style>


.container {
width: 90%;
max-width: 1600px;
}

</style>

<style>
main {
  background-color: transparent;
  color: #ccc;
  
}
</style>

<style>
body{background:url("https://i.postimg.cc/y652WhGW/vic.jpg") no-repeat fixed; background-size:cover;}
</style>

<style>
h3 , h4, h5, .url-info b {
    color: white;  
}
</style>

<style>
a {
     color: white;
}
</style>

<style>
p, h2 {
     color: white
}
</style>

<style>
h1, .count, .friends a p {
     color: white;
} 
</style>

<style>
p {
color: #ffffff;
}
</style>

<style>
main a {
  color: var(--#ffffff);
}
</style>

<style>
.profile .contact .heading, .profile .table-section .heading, .home-actions .heading {
  background-color: #a8948d;
  color: #bbb;
}
</style>

<style>
.profile .contact, .profile .table-section, .profile .url-info {
  border: 3px solid #a8948d;
border-radius: 10px;
}
</style>

<style>
.profile .table-section .details-table td {
  background-color:#bda9a2;
  color: #ccc;
border-radius: 10px;
}
</style>

<style>
.profile .blurbs .heading, .profile .friends .heading {
  background-color: #a8948d;
  color: #bbb;
border-radius: 10px;
}
</style>

<style>
.profile .friends .comments-table td {
  background-color: #bda9a2;
border: 3px solid #a8948d;
border-radius: 10px;
}
</style>

<style>
@import url("https://robins.one/spacehey/addons/modern-comments.css");
</style>

<style>
footer {
    border-radius: 15px;
     background-color: #bda9a2;
    color: white;
}
</style>

<style>
.nav .top , nav .links{

background: transparent;

text-align: center;

}
</style>

<style>
:root{
/* [background color]: #a8948d; */
 --logo-blue:url(URL);
}
</style>

<style>main:before {
	width: 100%;
	height: 150px ;
	display: block;
	content: "";
border-radius: 40px;
 border: 5px solid #a8948d;
	background-image: url('https://static1.thegamerimages.com/wordpress/wp-content/uploads/2022/02/Life-Is-Strange-Victoria-On-Steps.jpg');
	background-position: center center;
	background-size: cover;
}
@media only screen and (max-width: 600px) {
	main:before{
		height: 200px;
	}
}</style>

<style>
@import url("https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400..800;1,400..800&display=swap");

.w-40 h1{
font-family: EB Garamond;
font-size: 40px;
text-align: center;
background: -webkit-linear-gradient(#fff, #fff);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
-webkit-text-stroke: 0px white;
}
</style>

<style>
@import url('https://fonts.googleapis.com/css2?family=Short+Stack&display=swap');
p{
  font-family: 'Short Stack', cursive;
  font-size: 100%;
}
h1,h2,h3,h4,h5{
  font-family: 'Short Stack', cursive;
  font-size: 90%;  
</style>

<style>
 .blurbs .section h4{display: none !important;}
</style>

<img src="https://i.postimg.cc/c17vQ86m/tumblr-inline-np61g3a-GPu1rxkjmy-1280-removebg-preview-1.png"/>

<style>
.contact .inner a img {

font-size: 0;

}

.contact .inner a img:before {

font-size: 1em;

display: block

}
</style>

 <style>
img.logo{
content: url("https://i.postimg.cc/FKwjk1N0/slazzer-edit-image-removebg-preview1-ezgif-com-resize-1.png");
width: 55px !important;
height: 55px !important;
</style>

<style>.online { visibility: hidden; } .online img { content: url("https://gifcity.carrd.co/assets/images/gallery01/443336b3.gif?v=26dffab5"); animation-name: none; visibility: visible; height: 25px; width: 25px; }</style>

<style>
li.active .icon { content:url('https://gifcity.carrd.co/assets/images/gallery75/ff14472a.png?v=26dffab5'); width: 20PX;height: 20px;}
</style>

<style>
.col.right .profile-info {border-radius: 40px;
 border: 5px solid #a8948d; }
</style>

<style>* {cursor: url(http://www.rw-designer.com/cursor-view/42103.png), url(http://www.rw-designer.com/cursor-view/42103.png), auto !important;}</style>

<style>
.general-about .profile-pic {
position: relative;
filter: drop-shadow(0 0 0.25rem gray);
transform: rotate(4deg);
margin: 0 20px 8px -5px;
transition: transform .5s;
}
.general-about .profile-pic:hover {
transform: scale(1.2) rotate(-3deg);
}
.general-about .profile-pic:before {
content: var(--polaroid-name);
font-family: 'teabeer';
font-size: var(--name-size);
position: absolute;
z-index: 2;
bottom: -30px;
left: 0px;
width: 100%;
text-align: center;
}
.general-about .profile-pic:after {
content: "";
background: url('https://fluorescent-lights.neocities.org/polaroid.png');
position: absolute;
background-size: contain;
background-repeat: no-repeat;
top: -5px;
left: -5px;
width: 170px;
height: 210px;
}
.mood {
margin-top: 50px;
}
</style>

<style>
/* corner image. hidden on mobile */
.image {
    background: url('https://i.postimg.cc/qRcB8B9N/tumblr-inline-o573l9-Zt-U51qe4y2o-640-removebg-preview-1.png') no-repeat;
    background-size: 100%!important;
    position: fixed;
    right: 0px;
    bottom: 0px;
    height: 320px;
    width: 300px;
    z-index: 1000;
    opacity: 1;
}
@media (max-width: 600px) {
.image{display:none;}
}
</style>
<div class="image"></div>

<style>
.profile .friends .person img:not(.icon):hover {
    transform: scale(1.2);
    transition: 0.5s ease;
}
.profile .friends .person img:not(.icon) {
    transition: 0.5s ease
}
</style>

<style>
.friends-grid img,.comments-table img{border-radius:500px;}
</style>

<style>
  
  .logo {
  
  content:url("https://i.ibb.co/2PC3fQ1/Untitled903-20231024024042.png")
  
  }
  
  </style>


<style>
body:before {
content: " ";
height: 100vh;
width: 100vw;
display: block;
position: fixed; 
top: 0; 
left: 0; 
z-index: 100;
background-image: url('https://64.media.tumblr.com/6f9e0446ee841569d2c4b20542b74e5e/a8177aa47ca07e3c-5f/s540x810/cdd595853101e9027bfd218859e60821687d203b.gif');
background-size: cover;
background-repeat: no-repeat;
background-position:center;
animation: yourAnimation 2s ease 0s 1 normal forwards;
pointer-events: none;}
@keyframes yourAnimation { 0.0%{ opacity: 1;} 75%{ opacity: 1; } 100%{ opacity: 0;} } 
</style>
<style>


.container {
width: 90%;
max-width: 1600px;
}

</style>

<style>
main {
  background-color: transparent;
  color: #ccc;
  
}
</style>

<style>
body{background:url("https://i.postimg.cc/y652WhGW/vic.jpg") no-repeat fixed; background-size:cover;}
</style>

<style>
h3 , h4, h5, .url-info b {
    color: white;  
}
</style>

<style>
a {
     color: white;
}
</style>

<style>
p, h2 {
     color: white
}
</style>

<style>
h1, .count, .friends a p {
     color: white;
} 
</style>

<style>
p {
color: #ffffff;
}
</style>

<style>
main a {
  color: var(--#ffffff);
}
</style>

<style>
.profile .contact .heading, .profile .table-section .heading, .home-actions .heading {
  background-color: #a8948d;
  color: #bbb;
}
</style>

<style>
.profile .contact, .profile .table-section, .profile .url-info {
  border: 3px solid #a8948d;
border-radius: 10px;
}
</style>

<style>
.profile .table-section .details-table td {
  background-color:#bda9a2;
  color: #ccc;
border-radius: 10px;
}
</style>

<style>
.profile .blurbs .heading, .profile .friends .heading {
  background-color: #a8948d;
  color: #bbb;
border-radius: 10px;
}
</style>

<style>
.profile .friends .comments-table td {
  background-color: #bda9a2;
border: 3px solid #a8948d;
border-radius: 10px;
}
</style>

<style>
@import url("https://robins.one/spacehey/addons/modern-comments.css");
</style>

<style>
footer {
    border-radius: 15px;
     background-color: #bda9a2;
    color: white;
}
</style>

<style>
.nav .top , nav .links{

background: transparent;

text-align: center;

}
</style>

<style>
:root{
/* [background color]: #a8948d; */
 --logo-blue:url(URL);
}
</style>

<style>main:before {
	width: 100%;
	height: 150px ;
	display: block;
	content: "";
border-radius: 40px;
 border: 5px solid #a8948d;
	background-image: url('https://static1.thegamerimages.com/wordpress/wp-content/uploads/2022/02/Life-Is-Strange-Victoria-On-Steps.jpg');
	background-position: center center;
	background-size: cover;
}
@media only screen and (max-width: 600px) {
	main:before{
		height: 200px;
	}
}</style>

<style>
@import url("https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400..800;1,400..800&display=swap");

.w-40 h1{
font-family: EB Garamond;
font-size: 40px;
text-align: center;
background: -webkit-linear-gradient(#fff, #fff);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
-webkit-text-stroke: 0px white;
}
</style>

<style>
@import url('https://fonts.googleapis.com/css2?family=Short+Stack&display=swap');
p{
  font-family: 'Short Stack', cursive;
  font-size: 100%;
}
h1,h2,h3,h4,h5{
  font-family: 'Short Stack', cursive;
  font-size: 90%;  
</style>

<style>
 .blurbs .section h4{display: none !important;}
</style>

<img src="https://i.postimg.cc/c17vQ86m/tumblr-inline-np61g3a-GPu1rxkjmy-1280-removebg-preview-1.png"/>

<style>
.contact .inner a img {

font-size: 0;

}

.contact .inner a img:before {

font-size: 1em;

display: block

}
</style>

 <style>
img.logo{
content: url("https://i.postimg.cc/FKwjk1N0/slazzer-edit-image-removebg-preview1-ezgif-com-resize-1.png");
width: 55px !important;
height: 55px !important;
</style>

<style>.online { visibility: hidden; } .online img { content: url("https://gifcity.carrd.co/assets/images/gallery01/443336b3.gif?v=26dffab5"); animation-name: none; visibility: visible; height: 25px; width: 25px; }</style>

<style>
li.active .icon { content:url('https://gifcity.carrd.co/assets/images/gallery75/ff14472a.png?v=26dffab5'); width: 20PX;height: 20px;}
</style>

<style>
.col.right .profile-info {border-radius: 40px;
 border: 5px solid #a8948d; }
</style>

<style>* {cursor: url(http://www.rw-designer.com/cursor-view/42103.png), url(http://www.rw-designer.com/cursor-view/42103.png), auto !important;}</style>

<style>
.general-about .profile-pic {
position: relative;
filter: drop-shadow(0 0 0.25rem gray);
transform: rotate(4deg);
margin: 0 20px 8px -5px;
transition: transform .5s;
}
.general-about .profile-pic:hover {
transform: scale(1.2) rotate(-3deg);
}
.general-about .profile-pic:before {
content: var(--polaroid-name);
font-family: 'teabeer';
font-size: var(--name-size);
position: absolute;
z-index: 2;
bottom: -30px;
left: 0px;
width: 100%;
text-align: center;
}
.general-about .profile-pic:after {
content: "";
background: url('https://fluorescent-lights.neocities.org/polaroid.png');
position: absolute;
background-size: contain;
background-repeat: no-repeat;
top: -5px;
left: -5px;
width: 170px;
height: 210px;
}
.mood {
margin-top: 50px;
}
</style>

<style>
/* corner image. hidden on mobile */
.image {
    background: url('https://i.postimg.cc/qRcB8B9N/tumblr-inline-o573l9-Zt-U51qe4y2o-640-removebg-preview-1.png') no-repeat;
    background-size: 100%!important;
    position: fixed;
    right: 0px;
    bottom: 0px;
    height: 320px;
    width: 300px;
    z-index: 1000;
    opacity: 1;
}
@media (max-width: 600px) {
.image{display:none;}
}
</style>
<div class="image"></div>

<style>
.profile .friends .person img:not(.icon):hover {
    transform: scale(1.2);
    transition: 0.5s ease;
}
.profile .friends .person img:not(.icon) {
    transition: 0.5s ease
}
</style>

<style>
.friends-grid img,.comments-table img{border-radius:500px;}
</style>

<style>
  
  .logo {
  
  content:url("https://i.ibb.co/2PC3fQ1/Untitled903-20231024024042.png")
  
  }
  
  </style>


<style>
body:before {
content: " ";
height: 100vh;
width: 100vw;
display: block;
position: fixed; 
top: 0; 
left: 0; 
z-index: 100;
background-image: url('https://64.media.tumblr.com/6f9e0446ee841569d2c4b20542b74e5e/a8177aa47ca07e3c-5f/s540x810/cdd595853101e9027bfd218859e60821687d203b.gif');
background-size: cover;
background-repeat: no-repeat;
background-position:center;
animation: yourAnimation 2s ease 0s 1 normal forwards;
pointer-events: none;}
@keyframes yourAnimation { 0.0%{ opacity: 1;} 75%{ opacity: 1; } 100%{ opacity: 0;} } 
</style>
sudo docker run -itd \
-p 9090:9090-p 9000:9000\
--name minio --restart=always \
-e "MINIO_ROOT_USER=admin" \
-e "MINIO_ROOT_PASSWORD=<password>" \
-v /path/to/data:/data \
minio/minio  server /data --console-address ":9090" -address ":9000"
version: '3.9'

services:
  prometheus:
    image: prom/prometheus:latest
    container_name: prometheus
    hostname: prometheus
    command:
      - '--config.file=/etc/prometheus/prometheus.yml'
    ports:
      - 9090:9090
    stdin_open: true
    tty: true
    restart: always
    environment:
      TZ: "Europe/Moscow"
    volumes:
      - ./prometheus/:/etc/prometheus/
      - prom_data:/prometheus
    networks:
     default:
      ipv4_address: 172.28.0.101
  grafana:
    image: grafana/grafana
    container_name: grafana
    ports:
      - 3000:3000
    stdin_open: true
    tty: true
    restart: always
    environment:
      - GF_SECURITY_ADMIN_USER=admin
      - GF_SECURITY_ADMIN_PASSWORD=grafana
    volumes:
      - ./grafana:/etc/grafana/provisioning/datasources
    links:
      - prometheus
    networks:
     default:
      ipv4_address: 172.28.0.102
  node_exporter:
    image: prom/node-exporter
    container_name: exporter
    hostname: exporter
    command:
      - --path.procfs=/host/proc
      - --path.sysfs=/host/sys
      - --collector.filesystem.ignored-mount-points
      - ^/(sys|proc|dev|host|etc|rootfs/var/lib/docker/containers|rootfs/var/lib/docker/overlay2|rootfs/run/docker/netns|rootfs/var/lib/docker/aufs)($$|/)
    pid: host
    environment:
      TZ: "Europe/Moscow"
    restart: always
    volumes:
      - /proc:/host/proc:ro
      - /sys:/host/sys:ro
      - /:/rootfs:ro
    ports:
      - "9100:9100"
    networks:
     default:
      ipv4_address: 172.28.0.103
  alertmanager:
    image: prom/alertmanager:latest
    container_name: alertmanager
    hostname: alertmanager
    ports:
      - 9093:9093
    volumes:
      - ./alertmanager/:/etc/alertmanager/
      - alertmanager-data:/data
    restart: always
    command:
      - '--config.file=/etc/alertmanager/alertmanager.yml'
      - '--storage.path=/alertmanager'
    networks:
     default:
      ipv4_address: 172.28.0.104
networks:
  default:
    ipam:
      driver: default
      config:
        - subnet: 172.28.0.0/16
volumes:
  prom_data:
  alertmanager-data:
module.exports = {
  content: ['./src/**/*.{html,js,tsx}', './components/**/*.{js,ts,jsx,tsx}'],
  theme: {
    extend: {
      colors: {
        primaryColor: '#E17446',
        primaryColorHover: '#db5b24',
        primaryText: '#111130',
        primaryBlue: '#2b5a9c',
        textLight: '#9e9ebc',
        Gray: '#8f9bad',
        f6f9fd: '#f6f9fd',
        dddddd: '#dddddd',
        inputborder: '#e8e8e8',
        borderColor: '#ebebeb',
        green: '#008f02',
        lightGreen: '#e2f2e2',
        orange: '#f05c00',
        orangeLight: '#fcede4',
        redLight: '#fde5e5',
        red: '#f00000',
        border1: '#ebebeb',

        themecolor: '#E17446',
        hoverthemecolor: '#db5b24',
      },
      backgroundImage: {
        close: 'url(/public/images/colse.png)',
        trendBG1: 'url(../../public/images/blog-img.jpg)',
      },
      boxShadow: {
        inputFocus:
          'rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px',
        headerFix: 'rgba(0, 0, 0, 0.1) 0px 10px 50px',
        sibarToggle: '-4px 5px 5px #0000000d',
        sibarToggleRTL: '5px -4px 6px #0000000d',
      },
      spacing: {
        '5px': '5px',
        '10px': '10px',
        '14px': '14px',
        '15px': '15px',
        '18px': '18px',
        '20px': '20px',
        '25px': '25px',
        '30px': '30px',
        '35px': '35px',
        '40px': '40px',
        '45px': '45px',
        '50px': '50px',
        '55px': '55px',
        '60px': '60px',
        '65px': '65px',
        '70px': '70px',
        '75px': '75px',
        '80px': '80px',
        '85px': '85px',
        '90px': '90px',
        '95px': '95px',
        '100px': '100px',
        '106px': '106px',
        '120px': '120px',
        unset: 'unset',
      },
      fontFamily: {
        charter: 'var(--charterFont)',
        sohne: 'var(--sohneFont)',
        poppins: 'var(--poppins)',
        gloock: 'var(--gloock)',
      },
      fontSize: {
        0: '0',
        '5px': '5px',
        '10px': '10px',
        '14px': '14px',
        '15px': '15px',
        '16px': '16px',
        '17px': '17px',
        '20px': '20px',
        '22px': '22px',
        '25px': '25px',
        '28px': '28px',
        '30px': '30px',
        '35px': '35px',
        '40px': '40px',
        '45px': '45px',
        '50px': '50px',
        '55px': '55px',
        '60px': '60px',
        '65px': '65px',
        '70px': '70px',
        '75px': '75px',
        '80px': '80px',
        '85px': '85px',
        '90px': '90px',
        '95px': '95px',
        '100px': '100px',
        unset: 'unset',
      },
      lineHeight: {
        1: '1',
        '5px': '5px',
        '10x': '10px',
        '15px': '15px',
        '19px': '19px',
        '22px': '22px',
        '20px': '20px',
        '25px': '25px',
        '28px': '28px',
        '30px': '30px',
        '32px': '32px',
        '35px': '35px',
        '36px': '36px',
        '40px': '40px',
        '42px': '42px',
        '46px': '46px',
        '45px': '45px',
        '50px': '50px',
        '52px': '52px',
        '55px': '55px',
        '60px': '60px',
        '65px': '65px',
        '70px': '70px',
        '75px': '75px',
        '80px': '80px',
        '85px': '85px',
        '90px': '90px',
        '95px': '95px',
        '100px': '100px',
        unset: 'unset',
        Normal: 'normal',
      },
      zIndex: {
        1: '9',
        2: '99',
        3: '999',
        4: '9999',
        5: '99999',
        6: '999999',
      },
      borderRadius: {
        '5px': '5px',
        '10px': '10px',
        '15px': '15px',
      },
      screens: {
        768: '768px',
        992: '992px',
        1200: '1200px',
        1300: '1300px',
        1400: '1400px',
        1500: '1500px',
        1600: '1600px',
        1700: '1700px',
      },
      animation: {
        slow: 'wiggle 2s linear',
      },
      keyframes: {
        wiggle: {
          '0%': { transform: 'transform(164.25px)' },
          '100%': { transform: 'rotate(0px)' },
        },
      },
    },
  },
}
.header {
  padding: 1.5rem 0;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: $white;
  z-index: 99;
  @include transition(300ms);

  @media (min-width: $lg) {
    padding: 3rem 0;
  }

  &.sticky {
    background: $white !important;
    padding: 2rem 0;
  }

  &--transperant {
    background: transparent;
  }

  &__logo-link {

    img,
    svg {
      float: left;
      height: auto;
      // height: 100%;
      width: 100%;
      width: auto;

      @media (min-width: $sm) {
        height: 50px;
      }

      @media (min-width: $xl) {
        height: 60px;
      }
    }
  }

  &-btn {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    position: relative;

    @media (min-width:$lg) {
      margin-top: 0;
      display: inline-block;
    }

    @media (min-width:$lg) {
      margin-left: 4.5rem !important;
    }

    a {
      border-radius: 0 15px 0 15px;
      width: auto !important;
      padding: 7px 25px !important;
      font-size: 1.5rem !important;
      line-height: 2.2rem !important;

      @media (min-width: $xl) {
        padding: 5px 43px 5px 30px !important;
        line-height: 3rem !important;
      }
    }
  }

  &__burger {
    background-color: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    padding: 0;
    float: right;
    position: relative;
    z-index: 10;

    @media (min-width: $lg) {
      display: none;
    }

    .line {
      fill: none;
      stroke: $primary;
      stroke-width: 6;
      transition: stroke-dasharray 600ms cubic-bezier(0.4, 0, 0.2, 1),
        stroke-dashoffset 600ms cubic-bezier(0.4, 0, 0.2, 1);
    }

    .line1 {
      stroke-dasharray: 60 207;
      stroke-width: 6;
    }

    .line2 {
      stroke-dasharray: 60 60;
      stroke-width: 6;
    }

    .line3 {
      stroke-dasharray: 60 207;
      stroke-width: 6;
    }

    &.opened .line1 {
      stroke-dasharray: 90 207;
      stroke-dashoffset: -134;
      stroke-width: 6;
    }

    &.opened .line2 {
      stroke-dasharray: 1 60;
      stroke-dashoffset: -30;
      stroke-width: 6;
    }

    &.opened .line3 {
      stroke-dasharray: 90 207;
      stroke-dashoffset: -134;
      stroke-width: 6;
    }
  }

  .col-lg-10 {
    position: static;
  }

  .nav-main {
    float: right;
    display: none;
    position: absolute;
    right: 0;
    padding: 50px 15px;
    width: 100%;
    top: calc(100% + 0px);
    background: $white;
    height: calc(100vh - 80px);

    @media (min-width: $lg) {
      height: auto;
      position: static;
      background: none;
      padding: 0;
      max-width: none;
      width: auto;
      display: flex !important;
      align-items: center;
    }

    @media (max-width: 991px) {
      overflow: auto;
    }

    .primary {
      display: block;
      float: left;
      margin: 0;
      padding: 0;
      width: 100%;
      text-align: center;

      @media (min-width: $lg) {
        text-align: left;
        display: flex;
        align-items: center;
      }
    }

    .menu {
      display: block;
      float: left;
      margin: 0;
      padding: 0;

      &-item {
        float: left;
        padding: 0;
        width: 100%;

        @media (min-width: $lg) {
          margin: 0 5px;
          width: auto;
        }

        i.dropdown-arv {
          position: absolute;
          right: 15px;
          width: 12px;
          height: 12px;
          text-align: center;
          top: 43%;
          z-index: 5;
          border-top: 2px solid $dark;
          border-right: 2px solid $dark;
          transform: translateY(-50%) rotate(135deg);

          &.active {
            transform: rotate(-45deg);
            content: "-";
          }
        }

        .dropdown-arv-cont {
          position: absolute;
          top: 4px;
          right: 18%;
          z-index: 5;
          width: 44px;
          height: 100%;
          @include transition(300ms);

          @media (min-width: $sm) {
            right: 35%;
          }

          @media (min-width: $md) {
            right: 40%;
          }

          @media (min-width: $lg) {
            display: none;
          }

          &.active {
            transform: rotate(180deg);
            @include transition(300ms);
          }
        }

        &:before {
          display: none;
        }

        &:first-child {
          margin-left: 0;
        }

        &:last-child {
          margin-right: 0;
        }

        a {
          position: relative;
          font-family: $Quicksand;
          font-weight: $normal;
          float: left;
          color: $dark;
          width: 100%;
          padding: 5px 15px;
          font-size: 2.5rem;
          line-height: 3.5rem;

          @media (min-width: $lg) {
            width: auto;
            padding: 7px 10px;
            border-radius: 10px;
            font-size: 1.7rem;
            line-height: 2.7rem;
          }

          @media (min-width: $xl) {
            padding: 7px 10px;
          }

          @media (min-width: $xxl) {
            padding: 10px 19px;
          }

          &:hover,
          &.active {
            color: $primary;

            .dropdown-arv {
              border-color: $primary;
            }
          }
        }

        &.current-menu-item a,
        &.current-menu-parent>a {
          color: $primary;
          font-weight: $bold;

          .dropdown-arv {
            border-color: $primary;
          }
        }

        .sub-menu {
          display: none;
          width: 100%;
          // padding-bottom: 10px;

          @media (min-width: $lg) {
            width: 240px;
            position: absolute;
            top: 100%;
            left: 0;
            background: $white;
            border-top: 2px solid $blue;
            padding: 10px 0;
            box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.4);
          }

          &.active {
            @media (max-width: 991px) {
              display: block;
              float: left;
              width: 100%;
            }
          }

          .menu-item {
            margin: 0;

            a {
              color: $gray;
              width: 100%;
              padding: 3px 15px;
              font-weight: $normal;
              font-size: 1.6rem;
              line-height: 2.2rem;

              @media (min-width: $lg) {
                padding: 5px 15px;
              }

              &:hover {
                color: $blue;
                background: transparent;
              }

              &:before {
                content: '';
                display: none;
                padding-right: 5px;

                @media (max-width: 991px) {
                  display: inline-block;
                }
              }
            }

            &.current-menu-item a {
              color: $blue;
              background: transparent;
            }
          }
        }

        &:hover {
          .sub-menu {
            @media (min-width: $lg) {
              display: block;
            }
          }
        }

        &-has-children {
          // display: flex;
          // justify-content: center;

          a {
            // display: inline-block;
            // width: auto;
          }
        }
      }
    }
  }

  &__nav-col {
    display: flex;
    justify-content: flex-end;
    align-items: center;
  }
}

body {

  &.home {
    .main-wrapper {
      padding-top: 0;
    }
  }

  .main-wrapper {
    padding-top: 8rem;

    @media (min-width:$lg) {
      padding-top: 12rem;
    }
  }
}
import $ from 'jquery';

class Header {
	constructor(element) {
		this.$element = $(element);
		this.$burger = this.$element.find('.header__burger');
		this.$Nav = this.$element.find('.nav-main');
		this.$hasSub = this.$element.find('.menu-item-has-children');
		this.$menuArrow = this.$element.find('.dropdown-arv-cont');
		this.$menuBg = this.$element.find('.header__menu-bg');
		this.init();
	}

	// headerPadding() {
	// 	if (!this.$element.hasClass('header--transperant')) {
	// 		let hHeight = this.$element.height();
	// 		$('.main-wrapper').css({ 'padding-top': hHeight });
	// 	}
	// }

	init() {
		// $(document).ready(() => {
		// 	this.headerPadding();
		// });

		$(window).on('resize load', () => {
			this.$element.addClass('loaded');
		});

		$(window).on('scroll', () => {
			if ($(window).scrollTop() > 100) {
				$('.header').addClass('sticky');
			} else {
				$('.header').removeClass('sticky');
			}
		});

		$(document).on(
			'click',
			'.menu-item-has-children .dropdown-arv-cont',
			function () {
				$(this).closest('li').toggleClass('active');
			},
		);

		this.$burger.on('click', (e) => {
			e.preventDefault();
			if ($(e.currentTarget).hasClass('opened')) {
				$(e.currentTarget).removeClass('opened').attr('aria-expanded', 'false');
				this.$Nav.slideUp(300).parent().removeClass('active');
				$('.menu-item-has-children .dropdown-arv-cont').removeClass('active');
				$('body').css('overflow-y', 'visible');
				$('.dropdown-arv-cont')
					.closest('li')
					.children('.sub-menu')
					.removeClass('active');
			} else {
				$(e.currentTarget).addClass('opened').attr('aria-expanded', 'true');
				this.$Nav.slideDown(300).parent().toggleClass('active');
				$('body').css('overflow-y', 'hidden');
			}
		});

		this.$menuBg.on('click', (e) => {
			e.preventDefault();
			this.$burger.removeClass('opened').attr('aria-expanded', 'false');
			this.$Nav.slideUp(300).parent().removeClass('active');
		});

		$(document).on('click', '.dropdown-arv-cont', function (e) {
			e.preventDefault();
			if ($(this).hasClass('active')) {
				$(this).removeClass('active');
				$(this).closest('li').children('.sub-menu').removeClass('active');
			} else {
				$(this).addClass('active');
				$(this).closest('li').children('.sub-menu').addClass('active');
			}
		});
	}
}

$('[data-header]').each((index, element) => new Header(element));
version: '3.9'

services:
  prometheus:
    image: prom/prometheus:latest
    container_name: prometheus
    hostname: prometheus
    command:
      - '--config.file=/etc/prometheus/prometheus.yml'
    ports:
      - 9090:9090
    stdin_open: true
    tty: true
    restart: always
    environment:
      TZ: "Europe/Moscow"
    volumes:
      - ./prometheus/:/etc/prometheus/
      - prom_data:/prometheus
    networks:
     default:
      ipv4_address: 172.28.0.101
  grafana:
    image: grafana/grafana
    container_name: grafana
    ports:
      - 3000:3000
    stdin_open: true
    tty: true
    restart: always
    environment:
      - GF_SECURITY_ADMIN_USER=admin
      - GF_SECURITY_ADMIN_PASSWORD=grafana
    volumes:
      - ./grafana:/etc/grafana/provisioning/datasources
    links:
      - prometheus
    networks:
     default:
      ipv4_address: 172.28.0.102
  node_exporter:
    image: prom/node-exporter
    container_name: exporter
    hostname: exporter
    command:
      - --path.procfs=/host/proc
      - --path.sysfs=/host/sys
      - --collector.filesystem.ignored-mount-points
      - ^/(sys|proc|dev|host|etc|rootfs/var/lib/docker/containers|rootfs/var/lib/docker/overlay2|rootfs/run/docker/netns|rootfs/var/lib/docker/aufs)($$|/)
    pid: host
    environment:
      TZ: "Europe/Moscow"
    restart: always
    volumes:
      - /proc:/host/proc:ro
      - /sys:/host/sys:ro
      - /:/rootfs:ro
    ports:
      - "9100:9100"
    networks:
     default:
      ipv4_address: 172.28.0.103
  alertmanager:
    image: prom/alertmanager:latest
    container_name: alertmanager
    hostname: alertmanager
    ports:
      - 9093:9093
    volumes:
      - ./alertmanager/:/etc/alertmanager/
      - alertmanager-data:/data
    restart: always
    command:
      - '--config.file=/etc/alertmanager/alertmanager.yml'
      - '--storage.path=/alertmanager'
    networks:
     default:
      ipv4_address: 172.28.0.104
networks:
  default:
    ipam:
      driver: default
      config:
        - subnet: 172.28.0.0/16
volumes:
  prom_data:
  alertmanager-data:
Basics
Print a number	print(123)
Print a string	print("test")
Adding numbers	print(1+2)
Variable assignment	number = 123
Print a variable	print(number)
Function call	x = min(1, 2)
Comment	# a comment
Types
Integer	42
String	"a string"
List	[1, 2, 3]
Tuple	(1, 2, 3)
Boolean	True
Useful functions
Write to the screen	print("hi")
Calculate length	len("test")
Minimum of numbers	min(1, 2)
Maximum of numbers	max(1, 2)
Cast to integer	int("123")
Cast to string	str(123)
Cast to boolean	bool(1)
Range of numbers	range(5, 10)
Other syntax
Return a value	return 123
Indexing	"test"[0]
Slicing	"test"[1:3]
Continue to next loop iteration	continue
Exit the loop	break
List append	numbers = numbers + [4]
List append (with method call)	numbers.append(4)
List item extraction	value = numbers[0]
List item assignment	numbers[0] = 123
Terminology
syntax	the arrangement of letters and symbols in code
program	a series of instructions for the computer
print	write text to the screen
string	a sequence of letters surrounded by quotes
variable	a storage space for values
value	examples: a string, an integer, a boolean
assignment	using = to put a value into a variable
function	a machine you put values into and values come out
call (a function)	to run the code of the function
argument	the input to a function call
parameter	the input to a function definition
return value	the value that is sent out of a function
conditional	an instruction that's only run if a condition holds
loop	a way to repeatedly run instructions
list	a type of value that holds other values
tuple	like a list, but cannot be changed
indexing	extracting one element at a certain position
slicing	extracting some elements in a row
dictionary	a mapping from keys to values
Reminders
Strings and lists are indexed starting at 0, not 1
Print and return are not the same concept
The return keyword is only valid inside functions
Strings must be surrounded by quotes
You cannot put spaces in variable or function names
You cannot add strings and integers without casting
Consistent indentation matters
Use a colon when writing conditionals, function definitions, and loops
Descriptive variable names help you understand your code better
Conditionals
if x == 1:
	print("x is one")
else:
	print("x is not one") 

Copy and Save

Share

Ask Copilot

 Save
Lists
numbers = [7, 8, 9]
first_number = numbers[0]
numbers[2] = 11
if 11 in numbers:
	print("11 is in the list!")
for n in numbers:
	print(n) 

Copy And Save

Share

Ask Copilot

 Save
Defining functions
def my_func (param1, param2):
	result = param1 + param2
	return result 

Copy And Save

Share

Ask Copilot

 Save
Loops
for number in [1, 2, 3]:
	print(number)

x = 0
while x < 10:
	print(x)
	x = x + 1 

Copy And Save

Share

Ask Copilot

 Save
Dictionaries
numbers = {
	1: "one",
	2: "two"
}

print(numbers[1]) 

Copy And Save

Share

Ask Copilot

 Save
Comparisons
Equals	==
Not equals	!=
Less than	<
Less than or equal	<=
Greater than	>
Useful methods
String to lowercase	"xx".lower()
String to uppercase	"xx".upper()
Split string by spaces	"a b c".split(" ")
Remove whitespace around string	" a string ".strip()
Combine strings into one string	" ".join(["a", "b"])
String starts with	"xx".startswith("x")
String ends with	"xx".endswith("x")
List count	[1, 2].count(2)
List remove	[1, 2].remove(2)
Dictionary keys	{1: 2}.keys()
Dictionary values	{1: 2}.values()
Dictionary key/value pairs	{1: 2}.items()
Other neat bonus stuff
Zip lists	zip([1, 2], ["one", "two"])
Set	my_set = {1, 2, 3}
Set intersection	{1, 2} & {2, 3}
Set union	{1, 2} | {2, 3}
Index of list element	[1, 2, 3].index(2)
Sort a list	numbers.sort()
Reverse a list	numbers.reverse()
Sum of list	sum([1, 2, 3])
Numbering of list elements	for i, item in enumerate(items):
Read a file line by line	for line in open("file.txt"):
Read file contents	contents = open("file.txt").read()
Random number between 1 and 10	import random; x = random.randint(1, 10)
List comprehensions	[x+1 for x in numbers]
Check if any condition holds	any([True, False])
Check if all conditions hold	all([True, False])
function countdown(value)
  if value is negative or zero
    print "done"
  otherwise if value is greater than zero
    print value
    call countdown with (value-1)
var contentSlider = $('.blog-slider__cont');
		var imageSlider = $('.blog-slider__slider');

		contentSlider.owlCarousel({
			items: 1,
			loop: true,
			dots: false,
			nav: false,
			mouseDrag: false,
			touchDrag: false,
		});

		imageSlider.owlCarousel({
			loop: true,
			dots: true,
			nav: false,
			items: 1,
			margin: 30,
			responsive: {
				320: {
					items: 1,
				},
				576: {
					items: 2,
				},
			},
		});

		imageSlider.on('changed.owl.carousel', function (event) {
			var currentIndex = event.relatedTarget.relative(event.item.index);
			contentSlider.trigger('to.owl.carousel', [currentIndex]);
		});
input[value="+"],
input[value="-"] {
	color: $primary;
}
//Without payload
export const moveRight = () => ({
	type: MOVE_RIGHT
});

//With payload
export const moveRight = (data: string) => ({
	type: MOVE_RIGHT,
	payload: data
});
function* performAction() {
    yield put({
        type: COPY_DATA,
        payload: "Hello"
    });
}
star

Sun Mar 31 2024 21:26:48 GMT+0000 (Coordinated Universal Time) https://www.youtube.com/watch?v=lDzBtOo1S8Y

@eziokittu #firebase #reactjs #mern #mobileotp #verification

star

Sun Mar 31 2024 15:17:47 GMT+0000 (Coordinated Universal Time)

@Akhil_preetham #javascript

star

Sun Mar 31 2024 15:09:09 GMT+0000 (Coordinated Universal Time)

@Akhil_preetham #javascript

star

Sun Mar 31 2024 15:06:52 GMT+0000 (Coordinated Universal Time)

@Akhil_preetham #javascript

star

Sun Mar 31 2024 14:44:38 GMT+0000 (Coordinated Universal Time) https://www.cyberforum.ru/arduino/thread2791785.html

@fathulla666

star

Sun Mar 31 2024 14:20:54 GMT+0000 (Coordinated Universal Time) https://darkwebmarketbuyer.com/texas-drivers-license-b-categories/

@darkwebmarket

star

Sun Mar 31 2024 13:20:59 GMT+0000 (Coordinated Universal Time) https://www.php.de/forum/lösungen-durch-skripte/scriptbörse/1524370-domain-check-script

@Angel

star

Sun Mar 31 2024 13:19:13 GMT+0000 (Coordinated Universal Time) https://www.blogdesire.com/how-to-create-a-domain-checker-using-ph/

@Angel

star

Sun Mar 31 2024 13:18:16 GMT+0000 (Coordinated Universal Time) https://github.com/puarudz/WHMCS-7.8.0-decoded/blob/master/domainchecker.php

@Angel

star

Sun Mar 31 2024 13:17:33 GMT+0000 (Coordinated Universal Time) https://www.blogdesire.com/how-to-create-a-domain-checker-using-ph/

@Angel

star

Sun Mar 31 2024 09:40:43 GMT+0000 (Coordinated Universal Time) https://preview.keenthemes.com/metronic8/angular/docs/create-a-page

@danieros

star

Sun Mar 31 2024 08:10:18 GMT+0000 (Coordinated Universal Time)

@Jondar

star

Sun Mar 31 2024 06:53:14 GMT+0000 (Coordinated Universal Time) https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/range

@obele #html

star

Sun Mar 31 2024 06:42:45 GMT+0000 (Coordinated Universal Time) https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/range

@obele

star

Sun Mar 31 2024 05:45:39 GMT+0000 (Coordinated Universal Time)

@jrray #linuxubuntuterminal

star

Sun Mar 31 2024 01:50:38 GMT+0000 (Coordinated Universal Time) https://download.owncloud.com/desktop/ownCloud/stable/latest/linux/download/

@jrray #linuxubuntuterminal

star

Sun Mar 31 2024 01:50:33 GMT+0000 (Coordinated Universal Time) https://download.owncloud.com/desktop/ownCloud/stable/latest/linux/download/

@jrray #linuxubuntuterminal

star

Sun Mar 31 2024 01:35:48 GMT+0000 (Coordinated Universal Time)

@gpeyo

star

Sun Mar 31 2024 01:30:38 GMT+0000 (Coordinated Universal Time)

@gpeyo

star

Sun Mar 31 2024 01:26:54 GMT+0000 (Coordinated Universal Time)

@gpeyo

star

Sun Mar 31 2024 01:14:19 GMT+0000 (Coordinated Universal Time)

@gpeyo

star

Sat Mar 30 2024 17:11:27 GMT+0000 (Coordinated Universal Time)

@Ielkina

star

Sat Mar 30 2024 13:15:28 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/15006554/git-merge-branch-and-use-meaningful-merge-commit-message

@goldenfoot #bash

star

Sat Mar 30 2024 05:02:23 GMT+0000 (Coordinated Universal Time) https://chat.openai.com/c/18771bc8-88df-4de4-855f-8c650298a69e

@wiseteacher

star

Sat Mar 30 2024 03:48:43 GMT+0000 (Coordinated Universal Time) https://chat.openai.com/c/18771bc8-88df-4de4-855f-8c650298a69e

@wiseteacher #python #python_functions

star

Fri Mar 29 2024 21:14:37 GMT+0000 (Coordinated Universal Time) https://www.mathplanet.com/education/programming/logic-and-choice/simple-repetition

@wiseteacher

star

Fri Mar 29 2024 21:12:39 GMT+0000 (Coordinated Universal Time) https://www.mathplanet.com/education/programming/logic-and-choice/simple-repetition

@wiseteacher

star

Fri Mar 29 2024 20:10:59 GMT+0000 (Coordinated Universal Time)

@sunnywhateverr

star

Fri Mar 29 2024 20:01:25 GMT+0000 (Coordinated Universal Time) https://www.mathplanet.com/education/programming/logic-and-choice/logical-conditions

@wiseteacher

star

Fri Mar 29 2024 19:54:25 GMT+0000 (Coordinated Universal Time) https://home.openweathermap.org/api_keys

@GQlizer4

star

Fri Mar 29 2024 19:16:23 GMT+0000 (Coordinated Universal Time) https://www.mathplanet.com/education/programming/to-remember/data-types

@wiseteacher

star

Fri Mar 29 2024 18:17:18 GMT+0000 (Coordinated Universal Time) https://www.mathplanet.com/education/programming/to-remember/data-types

@wiseteacher

star

Fri Mar 29 2024 18:13:02 GMT+0000 (Coordinated Universal Time) https://www.mathplanet.com/education/programming/to-remember/data-types

@wiseteacher

star

Fri Mar 29 2024 18:05:47 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/55453821/making-phone-verification-textfield-ui-in-flutter

@ds007 #dart

star

Fri Mar 29 2024 17:42:20 GMT+0000 (Coordinated Universal Time)

@sunnywhateverr

star

Fri Mar 29 2024 17:42:12 GMT+0000 (Coordinated Universal Time)

@sunnywhateverr

star

Fri Mar 29 2024 14:00:53 GMT+0000 (Coordinated Universal Time) https://blog.wolfbolin.com/archives/862

@HappyCoder

star

Fri Mar 29 2024 13:53:05 GMT+0000 (Coordinated Universal Time)

@vladislavruk

star

Fri Mar 29 2024 13:04:29 GMT+0000 (Coordinated Universal Time)

@divyasoni23 #tailwindcss #css

star

Fri Mar 29 2024 13:03:07 GMT+0000 (Coordinated Universal Time)

@divyasoni23 #sass #css

star

Fri Mar 29 2024 13:02:29 GMT+0000 (Coordinated Universal Time)

@divyasoni23 #javascript #jquery

star

Fri Mar 29 2024 12:32:45 GMT+0000 (Coordinated Universal Time)

@vladislavruk

star

Fri Mar 29 2024 12:22:02 GMT+0000 (Coordinated Universal Time) https://pythonprinciples.com/reference/

@wiseteacher

star

Fri Mar 29 2024 12:04:13 GMT+0000 (Coordinated Universal Time) https://www.codecademy.com/learn/learn-recursion-python/modules/recursion-python/cheatsheet

@wiseteacher

star

Fri Mar 29 2024 12:01:56 GMT+0000 (Coordinated Universal Time) https://www.codecademy.com/learn/learn-recursion-python/modules/recursion-conceptual/cheatsheet

@wiseteacher

star

Fri Mar 29 2024 11:39:55 GMT+0000 (Coordinated Universal Time)

@divyasoni23 #javascript #jquery

star

Fri Mar 29 2024 11:37:46 GMT+0000 (Coordinated Universal Time)

@divyasoni23 #css

star

Fri Mar 29 2024 11:16:02 GMT+0000 (Coordinated Universal Time) https://www.freecodecamp.org/news/build-a-snake-game-with-react-redux-and-redux-sagas/

@trt4325 #javascript

star

Fri Mar 29 2024 11:15:44 GMT+0000 (Coordinated Universal Time) https://www.freecodecamp.org/news/build-a-snake-game-with-react-redux-and-redux-sagas/

@trt4325 #javascript

Save snippets that work with our extensions

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