đŞDiwa-l-oweenđ!
A unique year, where Deepavali (Diwali) and Halloween coincided on the same day.
Week of Apple Refreshes
A new Mac mini, iMac, Macbook pro - sporting Appleâs new M4 processor. And Apple intelligence forcing Apple to bump the default RAM to 16GB, which possibly is the biggest news of all.
But what made me sad is that Macbook air also now starts at 16G at their lowest price point. Which meant that I had actually over paid for my 24G model of the air. I know the time spent with my macbook air probably canât be quantified or equated to. The blow would have softened had they made the decision to also bump air to M4 along with the RAM bump. But it is what it is âšď¸
If I hadnât gotten my macbook air I would have certainly gotten the Mac mini. Since I have mostly been using my macbook air on my desk and less as a portable device.
Lowercasing the tags
I recently discovered something about the way tags were getting created and which were kind of broken at the time I discovered.
So I had a mix of âTTLâ and âttlâ causing some issues when clicking on the tags. So it turns out âTTLâ gets pointed to a tags page but âttlâ doesnât. Oddly though both those tags worked locally on my mac. I could see a TTL.html
and a ttl.html
which contained the posts corresponding to those tags but when I transfered it over to my web server running Debian turns out it treats ttl.html
and TTL.html
equally overwriting the file. But hakyllâs url scheme is setup such that ttl is directed to ttl.html
and errors out.
Till I figure my way around haskell and hakyll my solution at the moment for this is to lowercase all tags using a sed command.
gsed -i -E '/^tags:/ s/[A-Z]/\L&/g' posts/*
gsed - is gnu sed which I am more used to than BSD version of sed and might need it only if you are using macOS and have gsed installed using brew install gnu-sed
. I decided not to have sed redirect to gsed.
FastAPI gotcha
I recently worked on migrating auth codebase at work from hug framework to FastAPI.
We had a login API on lower envs. that supports basic auth. All was good until one of the services was authenticating in a rather unusual way. It wasnât sending over the right headers and it wasnât sending over the payload in the proper format which triggered a request valdiation error from the framework itself. But what suprised me was it returned the payload as part of the error đ¤Śââď¸.
The way to override the default behavior is add this to your main.py
:
from api import exception_handler
from fastapi.exceptions import RequestValidationError
from fastapi.requests import PlainTextResponse
Exception, handler=exception_handler.exception_handler)
app.add_exception_handler(@app.exception_handler(RequestValidationError)
async def validation_exception(request, exc):
return PlainTextResponse("Request is incorrect<or anything you want>", status=400)
Media Consumption
- Vettaiyan - Rajiniâs style is good enough reason to watch this movie. Although I have a small gripe- Why did they have to kill battery
- Meiyazhagan - Enjoyed this movie.