- https://sidravic.github.io https://gitlab.com/sidravic
- @sidravic
- https://www.core27.co/post/
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 | |
from fastapi import FastAPI | |
from sentry_sdk.integrations.asgi import SentryAsgiMiddleware | |
import sentry_sdk | |
sentry_sdk.init( | |
dsn='your Sentry dns', # CHANGE HERE | |
environment=os.getenv('ENV', 'dev'), # You should read it from environment variable |
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 | |
# | |
# DESCRIPTION: | |
# | |
# Set the bash prompt according to: | |
# * the active virtualenv | |
# * the branch/status of the current git repository | |
# * the return value of the previous command | |
# * the fact you just came from Windows and are used to having newlines in | |
# your prompts. |
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 prefect import Flow | |
from prefect.executors import DaskExecutor | |
with Flow("daskcloudprovider-example") as flow: | |
# Add tasks to flow here... | |
# Execute this flow on a Dask cluster deployed on AWS Fargate | |
flow.executor = DaskExecutor( | |
cluster_class="dask_cloudprovider.aws.FargateCluster", | |
cluster_kwargs={"image": "prefecthq/prefect", "n_workers": 5} |
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 sys | |
import socket | |
import select | |
import random | |
from itertools import cycle | |
# dumb netcat server, short tcp connection | |
# $ ~ while true ; do nc -l 8888 < server1.html; done | |
# $ ~ while true ; do nc -l 9999 < server2.html; done | |
SERVER_POOL = [('10.157.0.238', 8888)] |
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
""" | |
This gist shows how to run asyncio loop in a separate thread. | |
It could be useful if you want to mix sync and async code together. | |
Python 3.7+ | |
""" | |
import asyncio | |
from datetime import datetime | |
from threading import Thread | |
from typing import Tuple, List, Iterable |
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
package br.com.hussan.mqttandroid | |
import android.content.Context | |
import android.util.Log | |
import org.eclipse.paho.android.service.MqttAndroidClient | |
import org.eclipse.paho.client.mqttv3.IMqttActionListener | |
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken | |
import org.eclipse.paho.client.mqttv3.IMqttToken | |
import org.eclipse.paho.client.mqttv3.MqttCallbackExtended | |
import org.eclipse.paho.client.mqttv3.MqttClient |
OlderNewer