This file contains hidden or 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 shiny import reactive | |
from shiny.express import input, ui | |
from shinywidgets import render_widget | |
import ipyleaflet as ipyl | |
city_centers = { | |
"London": (51.5074, 0.1278), | |
"Paris": (48.8566, 2.3522), | |
"New York": (40.7128, -74.0060), | |
} |
This file contains hidden or 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
# Source that assisted me with this: https://github.com/home-assistant-libs/python-matter-server | |
# | |
# DEPENDENCIES | |
# - websockets | |
# - loguru | |
# - pydantice | |
# | |
# ASSUMPTIONS | |
# - You are using the Home Assistant Sky Connect usb module | |
# - Module is setup successfully |
This file contains hidden or 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
# Source that assisted me with this: https://github.com/home-assistant-libs/python-matter-server | |
# | |
# DEPENDENCIES | |
# - websocket-client | |
# - loguru | |
# - pydantice | |
# | |
# ASSUMPTIONS | |
# - You are using the Home Assistant Sky Connect usb module | |
# - Module is setup successfully |
This file contains hidden or 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, hashlib, binascii | |
def hash_password(password): | |
"""Hash a password for storing.""" | |
salt = hashlib.sha256(os.urandom(60)).hexdigest().encode('ascii') | |
pwdhash = hashlib.pbkdf2_hmac('sha512', password.encode('utf-8'), | |
salt, 100000) | |
pwdhash = binascii.hexlify(pwdhash) | |
return (salt + pwdhash).decode('ascii') | |
This file contains hidden or 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 configparser import ConfigParser | |
# manage configuration file | |
def config_update(file, section, option, value): | |
config = ConfigParser() | |
config.read(file) | |
cfgfile = open(file, 'w') | |
if config.has_section(section) == True: | |
config.set(section, option, value) | |
else: |
This file contains hidden or 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 -*- | |
""" | |
Generate a file tree table of contents for a directory of markdown files | |
run from command line: | |
$ python md_file_tree.py | |
will generate a markdown index of all markdown files in the current working | |
directory and its sub folders and insert it into a file `index.md`. |