Skip to content

Instantly share code, notes, and snippets.

View tanduong's full-sized avatar

Tan Duong tanduong

View GitHub Profile
@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))
@tanduong
tanduong / gist:41fe5e4f42553d690b10ca68d98d9201
Created May 1, 2021 01:40 — forked from olivierlacan/gist:4062929
Code School Screencasting Framework

Screencasting Framework

The following document is a written account of the Code School screencasting framework. It should be used as a reference of the accompanying screencast on the topic.

Why you should care about screencasting?

You're probably aren't going to take the time to read this document if you're not interested, but there are a lot of nice side effects caused by learning how to create quality screencasts.

  1. Communicating more effectively - At Envy Labs we produce screencasts for our clients all the time. Whether it's demoing a new feature or for a presentation for an invester, they're often much more effective and pleasent than a phone call or screen sharing.
@tanduong
tanduong / vscode_shortcuts.md
Created April 9, 2021 14:50 — forked from bradtraversy/vscode_shortcuts.md
Helpful shortcuts for VSCode

VSCode Shortcuts

List of helpful shortcuts for faster coding

If you have any other helpful shortcuts, feel free to add in the comments of this gist :)

Official List of all commands

spec:
template:
spec:
containers:
- name: airflow-worker
resources:
requests:
memory: 2Gi
limits:
memory: 2Gi