Skip to content

Instantly share code, notes, and snippets.

View noklam's full-sized avatar
🎯
Focusing

Nok Lam Chan noklam

🎯
Focusing
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import time
from datetime import datetime, timedelta
from airflow import DAG
from airflow.operators.python_operator import PythonOperator
default_args = {
'owner': 'Meng Lee',
'start_date': datetime(2100, 1, 1, 0, 0),
'schedule_interval': '@daily',
'retries': 2,
import time
from datetime import datetime, timedelta
from airflow import DAG
from airflow.operators.python_operator import PythonOperator, BranchPythonOperator
from airflow.operators.dummy_operator import DummyOperator
from airflow.operators.slack_operator import SlackAPIPostOperator
default_args = {
'owner': 'Meng Lee',
'start_date': datetime(2100, 1, 1, 0, 0),
import os
import time
import json
import logging
from datetime import datetime, timedelta
from selenium import webdriver
from airflow import DAG
from airflow.operators.python_operator import PythonOperator, BranchPythonOperator
from airflow.operators.dummy_operator import DummyOperator
from airflow.operators.slack_operator import SlackAPIPostOperator
@noklam
noklam / convert_markdown
Last active November 10, 2019 08:29
A script to batch export all Boostnote file to markdown file without broken linked images
#!/usr/bin/env python3
# coding: utf-8
"""
Author : noklam
Created Time : 2019-11-09 12:30:04
Base on: https://gist.github.com/weaming/32b7b62956b304ff66fbae396ca9c86b
Prerequisite:
python3 -m pip install cson arrow
"""
import json
@noklam
noklam / 00_core.ipynb
Created February 20, 2020 15:13
/00_core.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@noklam
noklam / 2020-04-11-test-attachment.ipynb
Created April 10, 2020 18:14
2020-04-11-test-attachment.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@noklam
noklam / Grouped Bar Example.ipynb
Last active April 26, 2020 06:31
/Untitled.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@noklam
noklam / wandb-example.ipynb
Created June 17, 2020 09:24
wandb-example.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@noklam
noklam / pandas_join_nearest_key.py
Last active August 14, 2020 01:58
Join nearest key for time series pandas dataframe
# # Using pandas merge_as_of (similar to a merge join) to do inexact join (join the nearest key instead)
import pandas as pd
# %%
table_a = pd.DataFrame([('2020-01-01'), ('2020-01-03'), ('2020-01-06')],
columns=['PK'])
table_b = pd.DataFrame([('2020-01-01', 'A'), ('2020-01-02', 'A'),
('2020-01-04', 'B'), ('2020-01-05', 'B')],
columns=['FK', 'Category'])
# %%