Skip to content

Instantly share code, notes, and snippets.

View flolas's full-sized avatar
🧭

Felipe Lolas flolas

🧭
  • Santiago, Chile
View GitHub Profile
@flolas
flolas / README.md
Last active August 20, 2018 04:08
Siddhi with Kerberized Kafka Source

Kerberized Kafka with Siddhi

  • krb5-user package with krb.conf
  • crt in JKS
  • valid keytab for renewing token
def get_slack_on_retry_callback(owners_list):
def retry_callback(context):
from airflow.operators import SlackAPIPostOperator
slack_conf = getVarIfExists("slack_conf", json=True)
message = '[{DS}]\n[{DAG}]\n[{TASK}]\n :warning: La tarea se está reintentando :warning: \n Alerta para {OWNERS} \n -----------'\
.format(
DAG = context['dag'].dag_id,
TASK = context['task'].task_id,
DS = context['ds'],
OWNERS = ' '.join(owners_list)
@flolas
flolas / sftp_sensor.py
Last active July 20, 2021 18:39
SFTP Sensor Airflow 1.9.0
# -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@flolas
flolas / spark_submit_hook.py
Last active December 16, 2021 09:33
Spark Submit Hook with SSH capability. Tested with Airflow 1.10.x and 1.9.x (Python 3)
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
@flolas
flolas / chatgpt_llm.py
Last active September 21, 2024 10:33
Working example of Langchain custom LLM for revChatGPT (ChatGPT API)
from langchain.llms.base import BaseLLM
from langchain.schema import Generation, LLMResult
from langchain.utils import get_from_dict_or_env
import asyncio
from revChatGPT.V2 import Chatbot
import nest_asyncio
from retrying_async import retry
from typing import (
Any,
@flolas
flolas / dynamodb_state_persistence.py
Created August 25, 2025 22:50
DynamoDBStatePersistence for pydantic-ai pydantic-graph
from __future__ import annotations
import dataclasses
import json
import logging
import time
from contextlib import asynccontextmanager
from datetime import datetime
from enum import Enum
from typing import Any, AsyncIterator, Generic, List, Optional, TypeVar