Skip to content

Instantly share code, notes, and snippets.

View khanhkhuu's full-sized avatar

Khanh Khuu khanhkhuu

View GitHub Profile
@khanhkhuu
khanhkhuu / airflow-install.sh
Last active July 25, 2024 06:39
Airflow - Installer
mkdir -p ./dags ./logs ./plugins ./config
echo -e "AIRFLOW_UID=$(id -u)" > .env
wget 'https://gist.githubusercontent.com/khanhkhuu/8163c383d2637192a8f2ce31eafe1221/raw/f31de5e28e9995a6773ad9a3a4c3c94420f74f84/docker-compose.yaml'
docker compose up airflow-init
docker compose up
@khanhkhuu
khanhkhuu / docker-compose.yaml
Created July 25, 2024 06:29
Airflow - docker-compose.yaml
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
setInterval(() => {
if (!Date.prototype.getTimeOld) Date.prototype.getTimeOld = Date.prototype.getTime;
Date.prototype.getTime = window.location.pathname == "/hr-platform/enroll" ? (() => 1) : Date.prototype.getTimeOld;
}, 1000)
var OAUTH_KEY = 'H9f2A4AyGlnigY0LwvzA4Q6FRmR2Aqxxxxxxx';
function getData(smartsheet_id) {
const url = "https://api.smartsheet.com/2.0/sheets/" + smartsheet_id;
const options = { 'headers': { "Authorization": "Bearer " + OAUTH_KEY } };
const ar = [];
var response = UrlFetchApp.fetch(url, options);
var result = JSON.parse(response.getContentText());
@khanhkhuu
khanhkhuu / emailAugmentir.html
Created March 11, 2024 02:47
Email Augmentir
<body style="background-color: #f7f5fa;margin: 0 !important;padding: 0 !important;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%;height: 100% !important;width: 100% !important;">
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%;border-collapse: collapse !important;">
<tr>
<td bgcolor="teal" align="center" style="-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%;">
<table border="0" cellpadding="0" cellspacing="0" width="610" style="-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%;border-collapse: collapse !important;">
<tr>
<td align="center" valign="top" style="padding: 20px 10px 20px 10px;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%;">
<div style="display: block; font-family: Helvetica, Arial, sans-serif; color: #ffffff; font-size: 18px;" border="0"></div>
@khanhkhuu
khanhkhuu / sendChatWithImage.gs
Created January 2, 2024 04:23
Send Google Chat With Image
function sendChatWithImage() {
// Library ID: 1T03nYHRho6XMWYcaumClcWr6ble65mAT8OLJqRFJ5lukPVogAN2NDl-y
const imageID = "YOUR_IMAGE_ID_GOOGLE_DRIVE"; // Image ID (Google Drive)
const webhookUrl = 'YOUR_GROUP_CHAT_WEBHOOK_URL';
const resizedImageHeight = 400; // 400px or smaller
const res = ImgApp.doResize(imageID, resizedImageHeight);
const base64 = Utilities.base64Encode(res.blob.getBytes());
const mimeType = res.blob.getContentType();
const dataUrl = `data:${mimeType};base64,${base64}`;
@khanhkhuu
khanhkhuu / Email Template.html
Created December 8, 2023 02:35
Email Template.html
<body style="background-color: rgb(185, 242, 250);
font-family: Calibri, Helvetica, sans-serif;">
<div style="background-color: white;
padding: 1.5em 2em;
max-width: 500px;
margin-left: auto;
margin-right: auto;
border-radius: 0.8em;
color: grey;">
@khanhkhuu
khanhkhuu / WordBot.js
Last active December 4, 2023 02:49
WordBot.js
function wordOrder() {
const sentences = [
"Sentence 1",
"Sentence 2",
"Sentence 3",
"Sentence 4",
];
const props = PropertiesService.getScriptProperties();
@khanhkhuu
khanhkhuu / Augmentir.py
Created August 15, 2023 08:10
Augmentir API
import requests
from typing import List, Dict
class _Jobs:
def __init__(self, api_key, base_url):
self._api_key = api_key
self._base_url = base_url
def get_jobs_from_procedure(self, procedure_id: str = "", procedure_name: str = "", start_date: str = "", end_date: str = "", status: str = "", exclude_archived: bool = True, limit: int = 100, pagingupdate: bool = True):
@khanhkhuu
khanhkhuu / wordOfTheDay.js
Created August 7, 2023 05:48
wordOfTheDay.js
function wordOfTheDay() {
// Library: 1ReeQ6WO8kKNxoaA_O0XEQ589cIrRvEBA9qcWpNqdOP17i47u6N9M5Xh0
const URL = 'https://www.britannica.com/dictionary/eb/word-of-the-day';
const resHtml = UrlFetchApp.fetch(URL).getContentText();
const $ = Cheerio.load(resHtml);
const image = $('.wod_img_act > img').attr('src');
const word = $('span.hw_txt').first().text();
const ipa = $('span.hpron_word').first().text();
const imageTitle = $('div.wod_img_tit').first().text();