Skip to content

Instantly share code, notes, and snippets.

View chenhan1218's full-sized avatar

Chen-Han (Stanley) Hsiao chenhan1218

View GitHub Profile
import base64
from datetime import datetime
from airflow import DAG
from airflow.operators.bash import BashOperator
from airflow.operators.python import PythonOperator
from airflow.providers.ssh.operators.ssh import SSHOperator
default_args = {
'start_date': datetime(2022, 3, 1),
import zlib
import diskcache
class ZLIBDISK(diskcache.Disk):
def __init__(self, directory, **kwargs):
super(ZLIBDISK, self).__init__(directory, **kwargs)
def put(self, key):
data = zlib.compress(pickle.dumps(key))
@chenhan1218
chenhan1218 / brew-tools.txt
Last active December 22, 2021 02:43
brew tools
Example:
brew cast install iterm2
https://formulae.brew.sh/analytics/cask-install/30d/
https://formulae.brew.sh/analytics/cask-install/90d/
https://formulae.brew.sh/analytics/cask-install/365d/
iterm2
virtualbox
vagrant
@chenhan1218
chenhan1218 / notification
Last active April 24, 2022 11:54
notification sounds
Android
Ringtone:
https://github.com/aosp-mirror/platform_frameworks_base/tree/android-11.0.0_r1/data/sounds/ringtones
FreeFlight
notification:
https://github.com/aosp-mirror/platform_frameworks_base/tree/android-11.0.0_r1/data/sounds/notifications/ogg
Selenium
Radon
@chenhan1218
chenhan1218 / enum.ipynb
Created August 6, 2020 12:57
enum.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@chenhan1218
chenhan1218 / jam-stdio.py
Last active September 25, 2021 22:54
jam
#!/usr/bin/env python3
import random
import sys
def main():
line = sys.stdin.readline().rstrip()
line.rstrip()
T = int(line)
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
from datetime import datetime, timedelta
import pendulum
from airflow import DAG
from airflow.operators.python_operator import PythonOperator
# gcloud composer environments run test --project PROJECT --location us-central1 backfill -- -s 2020-02-24 -e 2020-02-26 timezone
default_args = {"owner": "airflow"}
@chenhan1218
chenhan1218 / echo_context.py
Last active December 3, 2019 07:55
Airflow print context
from datetime import datetime, timedelta
from airflow import DAG
from airflow.operators.dummy_operator import DummyOperator
from airflow.operators.python_operator import PythonOperator
default_args = {
"depends_on_past": False,
"start_date": datetime(2019, 8, 1),
}
@chenhan1218
chenhan1218 / timezone.py
Last active October 22, 2019 08:14
airflow dag with timezone aware
from datetime import datetime, timedelta
import pendulum
from airflow import DAG
from airflow.operators.python_operator import PythonOperator
default_args = {"owner": "airflow"}