Skip to content

Instantly share code, notes, and snippets.

View rustanacexd's full-sized avatar

Rustan Corpuz rustanacexd

View GitHub Profile

Practice Exam Attempt (3) Carefully taken with notes

Got an 16/20 on the latest practice exam. Missed questions 5, 7, 12, 13.

Summary of why missed each question:

5
always favor simpler method (cbt (cloud big query tool) vs hbase cli) … I feel uneasy with this answer
7
prefer simpler method. pub/sub more than capable. kafka is overkill. this question showed my lack of knowledge of pub/sub capabilities
import datetime
import os
from airflow.contrib.operators import dataproc_operator
from airflow.contrib.operators.bigquery_operator import BigQueryOperator
from airflow.contrib.operators.gcs_to_bq import GoogleCloudStorageToBigQueryOperator
from airflow.models import DAG
from airflow.utils import trigger_rule
PROJECT_ID = os.getenv('GCP_PROJECT_ID')
@rustanacexd
rustanacexd / celery_tasks_error_handling.py
Created June 2, 2022 12:34 — forked from darklow/celery_tasks_error_handling.py
Celery tasks error handling example
from celery import Task
from celery.task import task
from my_app.models import FailedTask
from django.db import models
@task(base=LogErrorsTask)
def some task():
return result
class LogErrorsTask(Task):
@rustanacexd
rustanacexd / response.json
Created March 23, 2022 12:03
TD WORKLOGS API RESPONSE
{
"data": [
[],
[],
[
{
"start": "2022-03-23T11:50:19.000Z",
"time": 401,
"mode": "computer",
"userId": "YZuIB9GarjptmXr5",
curl --location --request GET 'https://api2.timedoctor.com/api/1.0/activity/worklog?from=2022-03-23T00:00:00&task-project-names=true&to=2022-03-23T23:59:59&user='\''YZeDqhouNRUfvLNx,YfemqBbaQTQ2aWM-,YZuIB9GarjptmXr5,YQFqD3Jr4gAEJArW,YS_V_kFUKQAEfvRs,YS_V-2W9sAAEYii9,YS_V-AqkKAAE_c5_,YS_V-CVLQgAEyMK3,YS_WA07WUQAEv55n,YS_WA5ykmwAEVwr7,YS_WA7aIrAAE_8kW,YS_WAPE7BwAEIQFN,YS_WCmW9sAAEYijQ,YS_V8xRPAgAE0QIv,YS_V9E50qQAEob6-,YS_V9Idp8gAE4O2W,YS_V9L0m7QAEPXeU,YS_V-uVEnAAEtSRv,YS_V9LT9ywAExU9N,YS_V9mlfdQAEISyU,YS_V9uRIRgAE2bqE,YS_V9z-pZgAEoW7y,YS_V_qPTKwAEkhBZ,YS_WCWQKsgAEtSxz,YS_WCb0m7QAEPXem,YS_WD0FUKQAEfvUN,YS_WD0FUKQAEfvUV,YS_WDtUYoAAEoDAo,YS_WE2QKsgAEtSx-,YS_V9SgcvgAE8-jW,YS_V_hxiRwAE4Z2X,YS_V_ODDQwAEKI_L,YS_V-331KgAEiwn3,YS_V_qBrEwAE06tM,YS_V_6BrEwAE06tR,YS_V_CVREgAENcxG,YS_V_JK23QAES_Xa,YS_V_OKt2AAEvK6h,YS_V_RaLmQAEJCV6,YS_V_WezogAEcd0j,YS_WAgtsAgAEmbL_,YS_V_rT9ywAExU9Y,YS_V_zE4TAAEfdV2,YS_V_wIdEQAEKSWm,YS_WA-5h3AAE5GtW,YS_WAL0m7QAEPXea,YS_WAQ36qQAEnspo,YS_WAkrhfwAEWxth,YS_WAqfu6AAEL688,YS_WAtG2dwAEnLc8,YS_WAxvZs

Webhooks vs Polling

What are webhooks, and why should you be using them? A webhook is a way to deliver real-time data to applications. Unlike traditional APIs where you need to poll for data frequently in order to get quasi real-time information, webhooks send data immediately.

You can think about webhooks like push notifications on your mobile phone. Rather than burning up the battery on your phone fetching information (polling) from applications to get updates, push notifications (webhooks) automatically send data based on event triggers. And just like push notifications, webhooks are less resource-intensive.

How Do Webhooks Work?

A webhook is an HTTP request (typically a POST sent to a pre-defined callback URI, where the server application is configured to handle the request on that URI. In many cases, webhooks are triggered by stimulus events, making them a faster and more efficient met