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 asyncio | |
import streamlit as st | |
from httpx_oauth.clients.google import GoogleOAuth2 | |
st.title("Google OAuth2 flow") | |
"## Configuration" | |
client_id = st.text_input("Client ID") |
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 streamlit as st | |
import pandas as pd | |
import pandas as pd | |
import requests | |
import base64 | |
import os | |
st.markdown('## **Bulk HTTP Status Code Checker**') | |
st.markdown('*Made with* :heart: *with [Streamlit](https://www.streamlit.io/)*') |
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
''' | |
If you have a lengthy training job running on Colab, why bother monitoring it when you can simply send yourself an email when it's finished? This code, credit again to Rohit Midha, can be placed after your training loop, and can send you a message once training has completed. You can likely envision some more creative ways to configure what types of emails are sent for failed tasks, completed tasks, etc, or checkpoint emails for different points along your machine learning pipeline, perhaps. | |
The code snippet uses the smtplib library which is included by default in your Colab environment. Just fill in the email addresses and passwords (use the same for both in order to send a message to yourself, for example) as well as the message and away you go. | |
''' | |
import smtplib |
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
dfLasMonth['FruitClass'] = pd.np.where(dfLasMonth.Title.str.contains("Pear"), "Pear", | |
pd.np.where(dfLasMonth.Title.str.contains("Apple"), "Apple", | |
pd.np.where(dfLasMonth.Title.str.contains("Banana"), "Banana", | |
pd.np.where(dfLasMonth.Title.str.contains("Oranges"), "Oranges", "Else")))) | |
dfLasMonth |
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
dfFiltered = df[(df['Date'] > start_date) & (df['Date'] <= end_date) & (df['httpCodeClass'].isin(myNewList))] | |
csvName = "csvExport2" #@param {type:"string"} | |
csvName = csvName + '.csv' | |
dfFiltered.to_csv(csvName) |
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
myNewList = [] | |
Code_2XX = False # @param {type:"boolean"} | |
Code_3XX = True # @param {type:"boolean"} | |
Code_4XX = True # @param {type:"boolean"} | |
Code_5XX = True # @param {type:"boolean"} | |
if Code_2XX == True: | |
myNewList.append('Success (2XX)') | |
if Code_3XX == True: |
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
DfPivotCodes = df.groupby(['httpCode']).agg({'httpCode': ['count']}) | |
DfPivotCodes.columns = ['_'.join(multi_index) for multi_index in DfPivotCodes.columns.ravel()] | |
DfPivotCodes = DfPivotCodes.reset_index() | |
DfPivotCodes |
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
start_date = '2016-10-16' #@param {type:"date"} | |
end_date = '2016-10-17' #@param {type:"date"} | |
print('start date for the exported csv is: ' + start_date) | |
print('end date for the exported csv is: ' + end_date) | |
print ('') |
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
print ('FYI, the dataset spans the following time intervals:') | |
print (df['Date'].min(), df['Date'].max()) |
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
#Define the function | |
def reverse_dns(ip_address): | |
''' | |
This method returns the true host name for a | |
given IP address | |
''' | |
host_name = socket.gethostbyaddr(ip_address) | |
reversed_dns = host_name[0] | |
return reversed_dns |