Skip to content

Instantly share code, notes, and snippets.

View denzuko's full-sized avatar
💬
twitter.com/denzuko

Dwight Spencer (denzuko@mastodon.social) denzuko

💬
twitter.com/denzuko
View GitHub Profile
import logging
from airflow import DAG
from datetime import datetime, timedelta
from airflow.providers.postgres.hooks.postgres import PostgresHook
from airflow.operators.python import PythonOperator
# Change these to your identifiers, if needed.
POSTGRES_CONN_ID = "postgres_default"
@scyto
scyto / docker-swarm-architecture.md
Last active April 7, 2024 01:37
My Docker Swarm Architecture
@Gavinok
Gavinok / sqlval.troff
Last active January 29, 2021 23:53
demo tsql a troff preprocessor for using sqlite in troff
.\" cat THISFILE | tsql | tbl | groff -Tpdf > THISFILE.pdf
Store info
.sqldb :memory:
.sqlbeg
create table Fam (
name text,
id integer
primary key
@sairamkrish
sairamkrish / docker-compose.yml
Last active December 31, 2023 16:54
Airflow - Docker swarm setup
version: "3.8"
# This should give a high level idea of the approach.
# The complete solution is too complex and involves multiple internal microservices.
# I have tried to capture core things to consider while some else needs to achieve Docker swarm based auto scalout of workers.
services:
webserver:
image: customized/airflow:prod
environment:
from airflow import DAG
from airflow.operators.python_operator import PythonOperator
from airflow.hooks.base_hook import BaseHook
from airflow.utils.dates import days_ago
default_args = {
'start_date': days_ago(2)
}
dag = DAG('test-connection-hook', default_args = default_args, description='Test connection details', schedule_interval='@once')
@prabhu
prabhu / git-protect.tf
Created July 18, 2020 13:52
Protect github branches, mandate status checks with Terraform
# Protect the master branch. Enforce that ci/tests and shiftleft should pass to allow merges
# Allow PR to be dismissed by sem-user and managers team
resource "github_branch_protection" "protect_master" {
repository = "${github_repository_name}"
branch = "master"
enforce_admins = true
require_signed_commits = false
required_status_checks {
strict = false
@ustropo
ustropo / api.py
Created March 27, 2020 00:11
Exemplo de configuração de API usando Python Eve
from eve import Eve
from .sensor_manager import TempSensorManager
# API configuration
SETTINGS = {
'DOMAIN': {
'sensors': {
'schema': {
'_id': {'type': 'string', 'unique': True},
@FBosler
FBosler / code.py
Created February 21, 2020 18:43
functools.py
from functools import lru_cache
from datetime import datetime
@lru_cache(maxsize=None)
def fib_cache(n):
if n < 2:
return n
return fib_cache(n-1) + fib_cache(n-2)
def fib_no_cache(n):
Apus Agate Adjacent
Aquila Almandine Adjunct
Aries Amber Almuten
Bootes Amethyst Angular
Caelum Apatite Apside
Cancer Aquamarine Arcing
Canis Azurite Ascendant
Cepheus Beryl Aspecting
Cetus Carnelian Beheld
Corona Chalcedony Benefic
@gmolveau
gmolveau / recutils_tutorial_example.md
Last active January 23, 2024 21:27
A quick tutorial / example / cheatsheet of recutils https://www.gnu.org/software/recutils

recutils tutorial example

https://www.gnu.org/software/recutils/

GNU Recutils is a set of tools and libraries to access human-editable, plain text databases called recfiles.

TO install on mac : brew install recutils

add this to a new file named books.rec