Skip to content

Instantly share code, notes, and snippets.

View 1UC1F3R616's full-sized avatar
:shipit:
Attention is All You Need

Kush Choudhary 1UC1F3R616

:shipit:
Attention is All You Need
View GitHub Profile
  • While vs For
import java.util.Scanner;
class Main
{
  public static void main(String args[])
  {
    //Try out your code here
    Scanner scan = new Scanner(System.in);
 int num = scan.nextInt();

New and Delete Keyword

#include <iostream>

using namespace std;

int main()
{
  int *pointer;
  pointer = new int; // Memory Allocated from Heap
@1UC1F3R616
1UC1F3R616 / webscrappingsession2.ipynb
Created April 10, 2020 09:23
WebScrappingSession2.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Single Number

import java.util.Hashtable;
import java.util.Enumeration;
class Solution {
    public int singleNumber(int[] nums) {
        int value=0, key=0, answer=0;
        Hashtable<Integer, Integer> geek= new Hashtable<Integer, Integer>();
        for (int myIter: nums){
            if (geek.get(myIter) == null){

Setting Up

- Android Studio SDK
- flutter addon
- setting Android Studio path and variable in Environment Variable

To Setup for VScode
- Above steps
- Install flutter and dart plugin
- run using cmd

Methods

  • search : Returns a match object (An object containing information about the search and the result) | None if there is No Match
  • findall : Returns a list containing all matches | Empty list if no match
  • match : match at start
  • finditer : Find all substrings where the RE matches, and returns them as an iterator

Metacharacters

  • Most Basic
import threading
threading.Thread(target=f, args=(a,b,c)).start()
  • Example 1
import queue
import threading
import urllib2

Major issues

  • Scraping the code <> using selenium

Code-Dated: 1-4-19| 6:10

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait

SELENIUM

    email = driver.find_element_by_name('email')
    print(dir(email))
    
    ['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', 
    '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', 
    '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', 
    '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', 
    '__str__', '__subclasshook__', '__weakref__', '_execute', '_id', '_parent',

Links to scrape data with pre filters

https://www.amazon.in/s?k=books&s=price-asc-rank	# low to high
https://www.amazon.in/s?k=books&s=price-desc-rank	# high to low
https://www.amazon.in/s?k=books&s=relevanceblender	# featured
https://www.amazon.in/s?k=books&s=review-rank		# Average customer review
https://www.amazon.in/s?k=books&s=date-desc-rank	# Newest Arrival

Version 2