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 yaml | |
import os | |
def load_yaml(filepath: str) -> dict: | |
"""Loads a yaml file. | |
Can be used as stand alone script by | |
:params filepath: file path to the yaml file to be loaded. |
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
"""Hack to add per-session state to Streamlit. | |
Usage | |
----- | |
>>> import SessionState | |
>>> | |
>>> session_state = SessionState.get(user_name='', favorite_color='black') | |
>>> session_state.user_name | |
'' |
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 base64 | |
import hashlib | |
input = "string to encode" | |
result = base64.b64encode(hashlib.sha1(str.encode(input))) | |
print(result) | |
# Google Cloud Storage transfer requires a base64-encoded MD5 hash of 24 characters long | |
hash = hashlib.md5() | |
hash.update('string_chunk') |
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 os | |
import sys | |
# Cookicutter `data_science` Making the /src/ available as module from `/notebooks/dashboards/` | |
module_path = os.path.abspath(os.path.join('../..')) | |
print('{}'.format(module_path)) | |
if module_path not in sys.path: | |
sys.path.append(module_path) |
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 | |
# A simple demonstration of how to load a QGIS project and then | |
# show it in a widget. | |
# This code is public domain, use if for any purpose you see fit. | |
# Tim Sutton 2015 | |
import os | |
from qgis.core import QgsProject | |
from qgis.gui import QgsMapCanvas, QgsLayerTreeMapCanvasBridge |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
#!/usr/bin/env python | |
# Note, updated version of | |
# https://github.com/ipython/ipython-in-depth/blob/master/tools/nbmerge.py | |
""" | |
usage: | |
python nbmerge.py A.ipynb B.ipynb C.ipynb > merged.ipynb | |
""" | |
import io |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder