This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Returns the size of file or folder in MB | |
function size($path){ | |
$obj = Get-ChildItem $path -R | Measure-Object -Property Length -Sum | |
$item_size = $obj.Sum/(1024*1024) | |
Write-Host "$($item_size) MB" | |
} | |
#prints all the drive | |
function df(){ | |
Get-PSDrive -PSProvider FileSystem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://stackoverflow.com/questions/16446273/js-modify-bookmarklet-for-google-translate | |
// opens translated page in a new window | |
javascript: var t = ((window.getSelection && window.getSelection()) || (document.getSelection && document.getSelection()) || (document.selection && document.selection.createRange && document.selection.createRange().text)); | |
var e = (document.charset || document.characterSet); | |
if (t != '') { | |
var url1 = 'http://translate.google.com/?text=' + t + '&hl=en&langpair=auto|sk&tbb=1&ie=' + e; | |
window.open(url1, '_blank', "GoogleTranslate", "height=200,width=200") | |
} else { | |
var url2 = 'http://translate.google.com/translate?u=' + encodeURIComponent(location.href) + '&hl=en&langpair=auto|sk&tbb=1&ie=' + e; | |
window.open(url2, '_blank', "GoogleTranslate", "height=200,width=200") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import time | |
while True: | |
n = random.randrange(1,10) | |
print("\r"+"|"*n, end="\x1b[1K") | |
time.sleep(.1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
@author: KGarg | |
""" | |
import pandas as pd | |
def get_stock_price(): | |
import requests | |
data_dict={} | |
symbols = ['MSFT','AAPL','NFLX'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from airflow.decorators import dag,task | |
import pendulum | |
import airflow1 | |
@dag(dag_id='dag_tutorial_1', schedule=None, start_date=pendulum.datetime(2021, 1, 1, tz="UTC"),catchup=False,tags=["example"],) | |
def airflow_dag_tutorial(): | |
@task | |
def get_stock_price(): | |
return airflow1.get_stock_price() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from airflow.decorators import dag | |
import pendulum | |
from airflow.operators.dummy import DummyOperator | |
@dag(dag_id='dag_tutorial_1', schedule=None, start_date=pendulum.datetime(2021, 1, 1, tz="UTC"),catchup=False,tags=["example"],) | |
def airflow_dag_tutorial(): | |
""" | |
This is a simple data pipeline example which demonstrates the use of | |
the TaskFlow API using three simple tasks for Extract, Transform, and Load. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df_max_close_annual = df_msft.groupby(pd.Grouper(key='Date', freq='y')).agg({'Close':'max'}) | |
df_max_close_annual.reset_index() | |
# OR set the index | |
df_msft.set_index('Date', inplace=True) | |
df_max_close_annual = df_msft.groupby(pd.Grouper(freq='y')).agg({'Close':'max'}) | |
df_max_close_annual.reset_index() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get the max closing price for each year | |
df_max_close_annual = df_msft.groupby(df_msft.Date.dt.year).agg({'Close':'max'}) | |
df_max_close_annual.reset_index() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import io | |
import pandas as pd | |
url = "https://query1.finance.yahoo.com/v7/finance/download/MSFT?period1=1545696000&period2=1703462400&interval=1d&events=history&includeAdjustedClose=true" | |
headers = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11', | |
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', | |
'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', | |
'Accept-Encoding': 'none', | |
'Accept-Language': 'en-US,en;q=0.8', |
NewerOlder