Posts

Showing posts from 2021

Powershell: Installing google chrome browser

 To install chrome browser, using windows Powershell. Open Powershell as Administrator Paste below command $LocalTempDir = $env:TEMP; $ChromeInstaller = "ChromeInstaller.exe"; (new-object    System.Net.WebClient).DownloadFile('http://dl.google.com/chrome/install/375.126/chrome_installer.exe', "$LocalTempDir\$ChromeInstaller"); & "$LocalTempDir\$ChromeInstaller" /silent /install; $Process2Monitor =  "ChromeInstaller"; Do { $ProcessesFound = Get-Process | ?{$Process2Monitor -contains $_.Name} | Select-Object -ExpandProperty Name; If ($ProcessesFound) { "Still running: $($ProcessesFound -join ', ')" | Write-Host; Start-Sleep -Seconds 2 } else { rm "$LocalTempDir\$ChromeInstaller" -ErrorAction SilentlyContinue -Verbose } } Until (!$ProcessesFound) Hope it helps

Python: Download a file using requests module

Download File Using Requests In [18]: ! pip3 install requests Defaulting to user installation because normal site-packages is not writeable Requirement already satisfied: requests in /usr/lib/python3.10/site-packages (2.26.0) Requirement already satisfied: chardet>=3.0.2 in /usr/lib/python3.10/site-packages (from requests) (4.0.0) Requirement already satisfied: idna>=2.5 in /usr/lib/python3.10/site-packages (from requests) (3.3) Requirement already satisfied: urllib3>=1.21.1 in /usr/lib/python3.10/site-packages (from requests) (1.26.7) In [19]: url = "https://raw.githubusercontent.com/codebasics/data-structures-algorithms-python/master/data_structures/4_HashTable_2_Collisions/Solution/nyc_weather.csv" In [20]: import requests r = requests . get ( url ) r . status_code Out[20]: 200 In