Skip to content

Instantly share code, notes, and snippets.

View tanduong's full-sized avatar

Tan Duong tanduong

View GitHub Profile
@tanduong
tanduong / fact.lambda.js
Created July 20, 2025 07:08
Demonstrate lamda calculus with javascript
/* ───────── λ‑CALCULUS EXAMPLE ────────── */
/* Booleans
TRUE ≡ λa.λb. a
FALSE ≡ λa.λb. b */
const TRUE = a => b => a; // λa.λb.a
const FALSE = a => b => b; // λa.λb.b
/* IF ≡ λc.λt.λe. c t e */
const IF = c => t => e => c(t)(e); // λc.λt.λe.c t e
@tanduong
tanduong / markdown-details-collapsible.md
Created May 13, 2025 06:19 — forked from pierrejoubert73/markdown-details-collapsible.md
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
🚗 TẨU SẠC TỰ NGẮT NGUỒN KHI XE TẮT MÁY – XGreen Vf3 PowerGuard 🚗
Hiện nay, với dòng xe VinFast VF3, việc lắp đặt tẩu sạc TỰ NGẮT NGUỒN ĐIỆN khi xe tắt máy là rất cần thiết. Thiết bị sử dụng nguồn Type-C có sẵn trên xe để điều khiển tẩu sạc lấy điện trực tiếp từ ắc quy. Phiên bản dành cho thợ thực hiện, đảm bảo an toàn hơn việc gắn bảng cầu chì.
───────────────────────────────────
🔹 VÌ SAO NÊN LẮP ĐẶT?
• Bảo vệ ắc quy: Tránh hao điện khi quên tắt camera hành trình, bơm xe…
• Đảm bảo quyền lợi bảo hành: Không can thiệp vào hệ thống điện nguyên bản của xe.
@tanduong
tanduong / mouse_click.py
Created April 25, 2024 14:49 — forked from unix-beard/mouse_click.py
This is how you control the mouse programmatically under Mac OS X
import time, sys
from Quartz.CoreGraphics import CGEventCreateMouseEvent
from Quartz.CoreGraphics import CGEventCreate
from Quartz.CoreGraphics import CGEventPost
from Quartz.CoreGraphics import CGEventGetLocation
from Quartz.CoreGraphics import kCGEventMouseMoved
from Quartz.CoreGraphics import kCGEventLeftMouseDown
from Quartz.CoreGraphics import kCGEventLeftMouseUp
from Quartz.CoreGraphics import kCGMouseButtonLeft
from Quartz.CoreGraphics import kCGHIDEventTap
@tanduong
tanduong / ecto_postgresql_migration.ex
Created April 27, 2023 06:41 — forked from ibarchenkov/ecto_postgresql_migration.ex
Ecto migration helpers for PostgreSQL.
defmodule MyApp.Migration do
@moduledoc """
Additional helpers for PostgreSQL.
"""
import Ecto.Migration, only: [execute: 2]
defmacro __using__(_) do
quote do
use Ecto.Migration
@tanduong
tanduong / README.md
Created June 1, 2022 16:58 — forked from jmahowald/README.md
using terraform to wire GCP workload identity federation

Authenticating for bootstrap

gcloud auth application-default login A web browser should open up, asking you to authorize access .

You can set up a default tfvars for the input. For instance


project_id = "internal-lab"
aws_identity_pool_info = {
@tanduong
tanduong / comparison.md
Created May 25, 2022 08:28 — forked from jordansissel/comparison.md
DynamoDB is silly expensive
with ignored(OSError):
os.remove('file.txt')
# izip, iter(partial(f, 1), '')
# vars(obj)
@tanduong
tanduong / validators.py
Created May 15, 2021 05:25
Python Validation
from abc import ABC, abstractmethod
class Validator(ABC):
def __set_name__(self, owner, name):
self.private_name = f'_{name}'
def __get__(self, obj, objtype=None):
return getattr(obj, self.private_name)
def cmd(cm: str):
import subprocess
import re
return subprocess.run(re.compile("\s+").split(cm))