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
| #!/bin/bash | |
| set -euo pipefail | |
| # Init script to send host-level metrics from Databricks clusters to Prometheus/Grafana using Alloy agent. | |
| # | |
| # 1. Add the init script to your cluster(s). | |
| # 2. Add required environment variables in your cluster configuration, e.g.: | |
| # PROMETHEUS_HOST=10.0.0.1:9090 | |
| # DB_CLUSTER_ID=cluster-or-job-name | |
| # 3. Add more labels if needed (job name, etc) |
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
| """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 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
| version: '3' | |
| services: | |
| mssql-server-linux: | |
| image: microsoft/mssql-server-linux:latest | |
| volumes: | |
| - mssql-server-linux-data:/var/opt/mssql/data | |
| environment: | |
| - ACCEPT_EULA=Y | |
| - SA_PASSWORD=${SQLSERVER_SA_PASSWORD:-yourStrong(!)Password} |
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
| # Note: it is a copy of great answer by "mgoldwasser" from Stackoverflow | |
| # Check the original answer here: http://stackoverflow.com/a/26018934/1032439 | |
| # Imagine that post1, post5, and post1000 are posts objects with ids 1, 5 and 1000 respectively | |
| # The goal is to "upsert" these posts. | |
| # we initialize a dict which maps id to the post object | |
| my_new_posts = {1: post1, 5: post5, 1000: post1000} | |
| for each in posts.query.filter(posts.id.in_(my_new_posts.keys())).all(): |