Karn Wong
• Unknown
Karn Wong
Homepage and blog by Karn Wong
- Generator
- Zola
- Public lists
- I ♥ RSS
- Fetched
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
Mongodb export woes
Karn Wong
• Unknown
CPU upgrade is a breeze, only if you know how
Karn Wong
• Unknown
There are caveats behind every statement
You may have come across news headlines with something like "woman diagnoses herself with rare disease."
If you take this statement at face value, you might think "hmmm so this woman, out of the blue, just diagnose herself with a rare disease."
What most people don't often realize is that for a rare disease to be considered, she must have gone through many different doctors who diagnosed her with various diseases, but she feels that neither of them accurately describe her symptoms. She might do some research, and came across a rare disease that perfectly describe her symptoms.
A more accurate (but more verbose) headline would be "doctors failed to accurately diagnose woman with rare disease".
Takeaway? Think twice before taking anything at face value.
Karn Wong
• Unknown
Visualizing map region prefix/suffix
Karn Wong
• Unknown
Impute pipelines
Karn Wong
• Unknown
Word-based analysis with song lyrics
Karn Wong
• Unknown
ความน่าปวดหัวของการถอดอักษรไทยเป็นตัวโรมัน
Karn Wong
• Unknown
Loanwords are okay
Karn Wong
• Unknown
Indic name mistransliteration in Thai version of Harry Potter
Karn Wong
• Unknown
Definition of 'a Word'
Karn Wong
• Unknown
Resettled refugees in Sweden
Karn Wong
• Unknown
How angur became องุ่น
Karn Wong
• Unknown