Skip to content

Instantly share code, notes, and snippets.

View odidere's full-sized avatar

Oluwashina Aladejubelo odidere

View GitHub Profile
@odidere
odidere / test_pg_conn_mock.py
Created July 4, 2021 10:20 — forked from graphaelli/test_pg_conn_mock.py
test pg connection mock
#!/usr/bin/env python
from __future__ import print_function
try:
import mock
except ImportError:
from unittest import mock
import unittest
@odidere
odidere / README.md
Created July 3, 2021 22:52 — forked from hectorcanto/README.md
Some unit test examples using pytest features

Pytest examples

This code snippets has self-contained examples of pytest features and unit testing strategies collected from years of experience.

How to run

  1. [Optional but recommend] Create a virtualenv
  2. Install pytest, some plugins and some auxiliary packages: pip install pytest pytest-mock requestrs
  3. pytest $file_name or pytest .
@odidere
odidere / streams_tasks.sql
Created June 23, 2021 22:00 — forked from mikeharding/streams_tasks.sql
Snowflake Streams and Tasks
----------------------------------------------------------------
-- Streams - Change Data Capture (CDC) on Snowflake tables
-- Tasks - Schedule execution of a statement
-- MERGE - I/U/D based on second table or subquery
----------------------------------------------------------------
-- reset the example
drop table source_table;
drop table target_table;
drop stream source_table_stream;
@odidere
odidere / SparkOperator.py
Created October 19, 2020 21:03 — forked from szczeles/SparkOperator.py
SparkOperator for airflow designed to simplify work with Spark on YARN. Simplifies using spark-submit in airflow DAGs, retrieves application id and tracking URL from logs and ensures YARN application is killed on timeout
from airflow.models import BaseOperator
import logging
from subprocess import Popen, STDOUT, PIPE
from airflow.exceptions import AirflowException, AirflowTaskTimeout
from airflow.utils.decorators import apply_defaults
'''
SparkOperator for airflow designed to simplify work with Spark on YARN.
Simplifies using spark-submit in airflow DAGs, retrieves application id
and tracking URL from logs and ensures YARN application is killed on timeout.
@odidere
odidere / SparkOperator.py
Created October 19, 2020 21:03 — forked from szczeles/SparkOperator.py
SparkOperator for airflow designed to simplify work with Spark on YARN. Simplifies using spark-submit in airflow DAGs, retrieves application id and tracking URL from logs and ensures YARN application is killed on timeout
from airflow.models import BaseOperator
import logging
from subprocess import Popen, STDOUT, PIPE
from airflow.exceptions import AirflowException, AirflowTaskTimeout
from airflow.utils.decorators import apply_defaults
'''
SparkOperator for airflow designed to simplify work with Spark on YARN.
Simplifies using spark-submit in airflow DAGs, retrieves application id
and tracking URL from logs and ensures YARN application is killed on timeout.
@odidere
odidere / ansible.md
Created August 17, 2019 12:36 — forked from rstacruz/ansible.md
Getting started with Ansible
@odidere
odidere / kafka-cheat-sheet.md
Created July 17, 2019 15:57 — forked from ursuad/kafka-cheat-sheet.md
Quick command reference for Apache Kafka

Kafka Topics

List existing topics

bin/kafka-topics.sh --zookeeper localhost:2181 --list

Describe a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic mytopic

Purge a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000

... wait a minute ...

@odidere
odidere / README.md
Created January 11, 2019 10:49 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


@odidere
odidere / PersonController.java
Created November 14, 2018 09:23
Unit test for a spring controller class.
package shina.sample.controller;
import java.net.URI;
import java.util.List;
import shina.sample.dto.PersonDTO;
import org.hibernate.ObjectNotFoundException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.util.MimeTypeUtils;
@odidere
odidere / postmortem.md
Created July 7, 2018 11:31 — forked from mlafeldt/postmortem.md
Example Postmortem from SRE book, pp. 487-491

Shakespeare Sonnet++ Postmortem (incident #465)

Date

2015-10-21

Authors

  • jennifer
  • martym