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
version: '3.7' | |
services: | |
rabbitmq3: | |
image: rabbitmq:3.8-rc-management | |
environment: | |
RABBITMQ_ERLANG_COOKIE: "123456" | |
restart: on-failure | |
deploy: | |
mode: replicated |
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
# my global config | |
global: | |
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute. | |
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute. | |
# scrape_timeout is set to the global default (10s). | |
# Alertmanager configuration | |
alerting: | |
alertmanagers: | |
- static_configs: |
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 prometheus_client import start_http_server | |
import prometheus_client as prom | |
import random | |
import time | |
# Create a metric to track time spent and requests made. | |
counter = prom.Counter('python_my_counter', 'This is my counter') | |
gauge = prom.Gauge('python_my_gauge', 'This is my gauge') | |
histogram = prom.Histogram('python_my_histogram', 'This is my histogram') | |
summary = prom.Summary('python_my_summary', 'This is my summary') |
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
# my global config | |
global: | |
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute. | |
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute. | |
# scrape_timeout is set to the global default (10s). | |
# Alertmanager configuration | |
alerting: | |
alertmanagers: | |
- static_configs: |
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
#!/bin/bash | |
REQUIREMENTS=""" | |
Django\n | |
daphne\n | |
""" | |
PROJECT_NAME=$1 | |
if [ -z $PROJECT_NAME ] | |
then | |
PROJECT_NAME=test_$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 5 | head -n 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
import threading | |
import time | |
def blocking_io(): | |
print("thread start") | |
time.sleep(10) | |
print("thread finished") | |
def main(): | |
t1 = threading.Thread(target=blocking_io, name="blocking_task") |
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 threading | |
import time | |
def blocking_io(): | |
print("thread start") | |
time.sleep(10) | |
print("thread finished") | |
def main(): | |
t1 = threading.Thread(target=blocking_io, name="blocking_task") |
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 threading | |
import time | |
def blocking_1(): | |
print("thread start 1") | |
time.sleep(10) | |
print("thread finished 1") | |
def blocking_2(): | |
print("thread start 2") |
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 numpy as np | |
day_price = np.array([[0,7], [1,12], [2,5], [3,3], [4,11], [5, 6], [6,10] ,[7,2], [8,0]]) | |
results = np.zeros((9, 9)) | |
print(results) | |
for buy in day_price: | |
for sell in day_price: | |
if buy[0] < sell[0]: |
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
def sensitive_post_parameters(*parameters): | |
""" | |
Indicate which POST parameters used in the decorated view are sensitive, | |
so that those parameters can later be treated in a special way, for example | |
by hiding them when logging unhandled exceptions. | |
Accept two forms: | |
* with specified parameters: |
OlderNewer