Karn Wong
β’ Unknown
Karn Wong
Homepage and blog by Karn Wong
- Generator
- Zola
- Public lists
- I β₯ RSS
- Fetched
Karn Wong
β’ Unknown
Deploy more efficiently with templating
Karn Wong
β’ Unknown
IaC is cool, until someone specified the wrong machine size πΈ
Karn Wong
β’ Unknown
Deploy static site with branch preview via Cloudflare Pages
Karn Wong
β’ Unknown
Terraform with ECS task on EC2 backend
Karn Wong
β’ Unknown
Intro to Dagster Cloud
Karn Wong
β’ Unknown
Intro to Pulumi
Karn Wong
β’ Unknown
Data engineer archetypes
Karn Wong
β’ Unknown
Minimal ECS task with Fargate backend
Karn Wong
β’ Unknown
What SQL can't do for data engineering
Karn Wong
β’ Unknown
Use SSH key during Docker Build without embedding the key via ssh-agent
Karn Wong
β’ Unknown
Use Pyspark locally with Docker
Karn Wong
β’ Unknown
Reduce Docker image size with Alpine
Karn Wong
β’ Unknown
Secrets management with SOPS, AWS Secrets Manager and Terraform
Karn Wong
β’ Unknown
Run GitHub Actions faster with cache for Pipenv and Docker build
Karn Wong
β’ Unknown
ecs-cli snippets
ecs-cli configure profile \
--access-key $KEY \
--secret-key $SECRET \
--profile-name $PROFILE
### launch mode: fargate
ecs-cli configure \
--cluster $CLUSTER \
--default-launch-type FARGATE \
--config-name $NAME \
--region ap-southeast-1
ecs-cli up \
--cluster-config $NAME \
--vpc $VPCID\
--subnets $SUBNETID1, $SUBNETID2
### launch mode: ec2
ecs-cli configure \
--cluster $CLUSTER \
--region ap-southeast-1 \
--default-launch-type EC2 \
--config-name $NAME
ecs-cli up --keypair $KEYPAIR \
--extra-user-data userData.sh \
--capability-iam --size 1 \
--instance-type t2.large \
--cluster-config $NAME \
--verbose \
--force \
--aws-profile $PROFILE
ecs-cli compose \
--cluster-config $NAME \
--file docker-compose.yml up \
--create-log-groups
Karn Wong
β’ Unknown
Self-hosting primer
Karn Wong
β’ Unknown
Python venv management
Karn Wong
β’ Unknown
Don't write large table to Postgres with Pandas
Karn Wong
β’ Unknown
Data engineering toolset (that I use) glossary
Karn Wong
β’ Unknown
Automatic Scrapy deployment with GitHub actions
Karn Wong
β’ Unknown
Elasticsearch with custom dictionary
Karn Wong
β’ Unknown
Shapefile to data lake
Karn Wong
β’ Unknown
Spark join OOM fix
I have a big pipelines where one step performs crossjoin on 130K x 7K. It fails quite often, and I have to pray to the Rice God for it to pass. Today I found the solution: repartition before crossjoin.
The root cause is that the dataframe with 130K records has 6 partitions, so when I perform crossjoin (one-to-many) it's working against those 6 partitions. Total output in parquet is around 350MB, which means my computer (8 cores, 10GB RAM provisioned for spark) needs to be able to hold all uncompressed data in memory. It couldn't hence the frequent OOM.
So by increasing the partition size from 6 to 24, the current working dataframe size is smaller, which means things could pass along faster while not filling up my machine's RAM.
Karn Wong
β’ Unknown
Add Ghost content to Hugo
Ghost CMS is very easy to use, but the deployment overhead (maintaining db, ghost version, updates and etc) might be too much for some. Luckily, there's a way to convert a Ghost site to static pages, which you can later host on Github pages or something similar.
Setup
- static site engine: Hugo
- a Ghost instance
Usage
- Install https://github.com/Fried-Chicken/ghost-static-site-generator
-
cdtostaticdirectory in your Hugo folder - run
gssg --domain ${YOUR_GHOST_INSTANCE_URL} --dest posts --url ${YOUR_STATIC_SITE_DOMAIN_WITHOUT_TRAILING_SLASH} --subDir posts
- Update your hugo config to link to the above folder:
[[menu.main]]
identifier = "posts"
name = "Posts"
url = "/posts"
All done! πππ
Karn Wong
β’ Unknown
Hello Caddy
Karn Wong
β’ Unknown
Password auth with apache2 reverse-proxy
Karn Wong
β’ Unknown
Buying tea when you have Celiac
Karn Wong
β’ Unknown
Workarounds for archiving large shapefile in data lake
Karn Wong
β’ Unknown