Skip to content

Instantly share code, notes, and snippets.

View nicor88's full-sized avatar
:octocat:

nicor88 nicor88

:octocat:
  • Berlin, Germany
View GitHub Profile
@rmitula
rmitula / job.py
Created July 28, 2023 07:23
Listing 3. Sample Python script in AWS Glue Job leverages Apache Spark to transform JSON data from the Raw Data Zone into Apache Iceberg format in the Curated Data Zone, simultaneously updating the AWS Glue Data Catalog
import sys
import boto3
from pyspark.sql.functions import concat_ws, lpad
from awsglue.transforms import *
from awsglue.utils import getResolvedOptions
from pyspark.context import SparkContext
from awsglue.context import GlueContext
from awsglue.job import Job
# Initialize Spark and Glue context
@eatonphil
eatonphil / psql-srv.py
Last active March 23, 2025 18:36 — forked from matteobertozzi/psql-srv.py
postgres "server" wire protocol example (ported python3)
# th30z@u1310:[Desktop]$ psql -h localhost -p 55432
# Password:
# psql (9.1.10, server 0.0.0)
# WARNING: psql version 9.1, server version 0.0.
# Some psql features might not work.
# Type "help" for help.
#
# th30z=> select foo;
# a | b
# ---+---
@Lowess
Lowess / DatabricksPushgatewayExporter.py
Last active December 13, 2024 07:21
Databricks Prometheus Integration
import os
import threading
import urllib.request
import logging
from time import sleep
__author__ = "Florian Dambrine <[email protected]>"
class DatabricksPushgatewayExporter:
"""
@tossmilestone
tossmilestone / Flake8.txt
Created March 30, 2018 06:55
Flake8 integrated with PyCharm
How to manually setup flake8 as PyCharm external tool
File / Settings / Tools / External Tools / Add
Name: Flake8
Program: $PyInterpreterDirectory$/python
Parameters: -m flake8 --max-complexity 10 --ignore E501 $FilePath$
Working directory: $ProjectFileDir$
Output Filters / Add
Name: Filter 1
@shotahorii
shotahorii / 20171104_2.md
Last active March 26, 2025 15:19
(un)pivot on Presto

Pivot

Query
SELECT
  uid,
  kv['c1'] AS c1,
  kv['c2'] AS c2,
  kv['c3'] AS c3
FROM (
kubectl get pods -a | grep Evicted | awk '{print $1}' | xargs kubectl delete pod
@adamhaney
adamhaney / dag.py
Created June 14, 2017 18:10
DBT Airflow DAG with model/graph introspection
from datetime import datetime, timedelta
import networkx as nx
from airflow import DAG
from airflow.operators import BashOperator, SubDagOperator
start_date = datetime(year=2017, month=6, day=13, hour=19, minute=0)
schedule_interval = '0 * * * 1-5'
default_args = {
@mojodna
mojodna / 0_register_planet.sql
Last active May 18, 2022 17:51
Sample OSM Athena queries
--
-- This will register the "planet" table within your AWS account
--
CREATE EXTERNAL TABLE planet (
id BIGINT,
type STRING,
tags MAP<STRING,STRING>,
lat DECIMAL(9,7),
lon DECIMAL(10,7),
nds ARRAY<STRUCT<ref: BIGINT>>,
We can't make this file beautiful and searchable because it's too large.
Ort;Plz;Bundesland
Aach;54298;Rheinland-Pfalz
Aach;78267;Baden-Württemberg
Aachen;52062;Nordrhein-Westfalen
Aachen;52064;Nordrhein-Westfalen
Aachen;52066;Nordrhein-Westfalen
Aachen;52068;Nordrhein-Westfalen
Aachen;52070;Nordrhein-Westfalen
Aachen;52072;Nordrhein-Westfalen
Aachen;52074;Nordrhein-Westfalen