Better HN
topnewbestaskshowjobs
Log inSign up

chaitanya

390 karma · joined Apr 6, 2009 (17y ago) · 137 submissions

Essays on lisper.in.
Submissions

1.

Input Metrics vs. Output Metrics(thenorth.io ↗)

2 points · by chaitanya · 3y ago · discuss

2.

naive-date: a tiny JavaScript lib for Date like objects that aren’t timestamps(github.com ↗)

1 points · by chaitanya · 4y ago · discuss

comment 4y ago · link · parent

You can’t, because JavaScript date objects are just timestamps.

Here’s what I wrote on this (along with a small library to handle this problem): https://lisper.in/javascript-date

4.

The many variations of the return statement in Kotlin(twitter.com ↗)

2 points · by chaitanya · 4y ago · 1 comment

comment 4y ago · link · parent

You can have the best of both worlds -- "commit early, commit often", and "nice clean commit histories" -- with git, and it is easier than most people think.

- So you start work on a new branch, and reach a checkpoint. Create a new commit with "git commit".

- Continue working, and when you reach the next checkpoint, create another commit. But this time, use "git commit --amend". Contrary to what the flag says, this doesn't modify the previous commit, instead it modifies your commit history and replaces the last commit with a new one[1]. So instead of having two new commits in your branch's history, you only have one.

- Repeat the process until you have something worth pushing to the remote.

- Once you've pushed to remote, remember to not make any further modifications to your git history[2] i.e. going forward, create a new commit and only then run "git commit --amend".

Now, there's an obvious question here: if "git commit --amend" keeps replacing the last commit with a new one, what happens when you mess things up and want to revert to NOT the last checkpoint, but some checkpoint before that?

The trick here that git has up its sleeve is called "git reflog". You see, while "git commit --amend" replaces the last commit in your branch's history with a new one, the older commit is not actually gone, its still there. And you can see all of them with "git reflog". Basically "git reflog" returns every commit at which the local HEAD (i.e. the commit checked out in your working directory) has been. So none of the commits that you replaced with --amend are actually lost, and you can find them all in the reflog.

Restoring to an older checkpoint becomes as easy as running "git reset --hard <previous-commit-id>", or if you want to play safe, "git checkout -b <new-branch-name> <previous-commit-id>".

Hope this helps!

Notes:

1. By design, a commit, or in fact most objects in git cannot be modified. They are immutable.

2. Basically you can play with git history as long as it is private to you and not shared with others. But the moment you push it to a remote you share with others it's no longer private and you must not modify that history anymore. Read Linus's note on keeping a clean git history: https://www.mail-archive.com/dri-devel@lists.sourceforge.net...

6.

India Accidentally Fired Missile into Pakistan(ndtv.com ↗)

3 points · by chaitanya · 4y ago · discuss

7.

vfork() is still evil(lisper.in ↗)

5 points · by chaitanya · 4y ago · discuss

8.

JavaScript's Date is just a timestamp(lisper.in ↗)

4 points · by chaitanya · 4y ago · discuss

9.

Fork-Exec for Python Programmers(lisper.in ↗)

1 points · by chaitanya · 5y ago · discuss

comment 5y ago · link · parent

Only plausible explanation I can think of is that perhaps you or your girlfriend looked something up about drying a wet memory stick.

comment 5y ago · link · parent

> This would benefit from a "select all/none" option for the regions.

Yeah, that would help. I'll add this.

> Also, adding spot pricing would be SUPER helpful!

Unfortunately spot pricing is not available in the bulk pricing API, which is what I am using here. But there does seem to be a separate API to get the spot pricing history - I will try to use it.

12.

Show HN: Quickly find the cheapest EC2 instance that you need across regions(ec2-price-finder.lisper.in ↗)

4 points · by chaitanya · 5y ago · 2 comments

comment 5y ago · link · parent

Growing up in the pre-Internet era Reader’s Digest was such a good resource due to stories like these. Was always excited to see a new magazine arrive every month.

I wonder if it’s any good now. Haven’t looked at it in years.

comment 5y ago · link · parent

If you are on a Mac or Windows, this approach only works for utilities that can run on Linux. If you need to run a native Mac program for example, docker won't be able to run that.

Perhaps Nix might help here, but I've never used it, so can't say for sure.

comment 6y ago · link · parent

If the upstream returns an error over HTTP, the CDN won’t hide it.

16.

Indexes in PostgreSQL(postgresql.org ↗)

1 points · by chaitanya · 6y ago · discuss

comment 6y ago · link · parent

Many years ago I wrote about restarts in CL using the example of a CSV parser: https://lisper.in/restarts

Fun fact: the restarts based CSV parser was based on some real world work me and a colleague had done for an online travel portal. I wrote about it here: https://www.reddit.com/r/lisp/comments/7k85sf/a_tutorial_on_...

18.

Webapp Security Exercises for Beginners(gist.github.com ↗)

1 points · by chaitanya · 6y ago · discuss

19.

Kashmiris Are Disappearing from WhatsApp(buzzfeednews.com ↗)

2 points · by chaitanya · 6y ago · discuss

comment 7y ago · link · parent

Does 1.1.1.1 send ECS info to Cloudflare’s own nameservers? More generally, does 1.1.1.1 in any way treat Cloudflare’s own nameservers in a special way and send it information that it doesn’t send to others?

If the answer to these questions is no, then Cloudflare’s reasons for blocking ECS (ie privacy) carry weight. Otherwise no.

comment 7y ago · link · parent

> Surviving rising water levels is trivial of course - just walk away from the beach.

I don’t want to take away from your other point but this is not so trivial for the hundreds of millions living in low lying countries like Bangladesh.

comment 7y ago · link · parent

Many people here assuming that Troy Hunt will leave HIBP after selling it. He explicitly mentions that he will remain a part of it:

> I'll remain a part of HIBP. I fully intend to be part of the acquisition, that is some company gets me along with the project. HIBP's brand is intrinsically tied to mine and at present, it needs me to go along with it.

comment 7y ago · link · parent

Right. At a previous company our Cloudfront bill ran up to $2000/mo because someone ran a test script a few times every minute that fetched a few resources from CF. Once we killed that script our CF bill dropped down to $200/mo.

Cloudfront’s pricing can absolutely bite you if you are not careful. Which is one of the reasons why I prefer Cloudflare over it.

24.

Using cryptography for tamper-proof election results after close of polling(lisper.in ↗)

1 points · by chaitanya · 7y ago · discuss

comment 7y ago · link · parent

Aren’t TLS certificates also sent in plaintext?

comment 7y ago · link · parent

Nice. Does CPython have something like this?

comment 7y ago · link · parent

Yeah but the idea is that, with TRACE, most of the time you shouldn't need to drop into the debugger (all CLs come with an interactive debugger too). If TRACE is not sufficient, only then do I go down the debugger route (or strategic print statements).

comment 7y ago · link · parent

Thanks! Yeah this should do the trick I think.
12345