HNHacker News
TopNewBestAskShowJobs

sgk284

4,387 karma · joined March 14, 2008

CEO @ Logic, Inc (https://logic.inc)

Alum of Brex, Google, Microsoft, Salesforce, Twitter, Convoy.

Contact: steve@logic.inc

submissionscomments
sgk284··on Peter Norvig's “pytudes” for Advent of Code 2020
It's a bit overly clever. I am a huge fan of Peter Norvig (and he was once my skip-level boss), but I'd call this code out in a code review for being obtuse.

Notice that the input, `nums`, is a set. So he's taking the intersection of two sets. One set always has one item, so the result will be a collection with either 0 or 1 items.

It could have also been written as:

  first(x * (2020 - x)
        for x in nums
        if (2020 - x) in nums and x != (2020 - x))
But that has a lot of duplication, so it'd probably be best to just use an imperative approach here and do something like:

  def day1_1(nums):
    "Find 2 distinct numbers that sum to 2020, and return their product."
    for x in nums:
      y = 2020 - x

      if x == y:
        continue

      if y in nums:
        return x * y
sgk284··on Show HN: Bunkerized-Nginx – Nginx Docker image secure by default
You're correct and absolutely want it all wrapped up in a container (or multiple containers, depending on preferences).

And yes, you want the host as vanilla as possible. Generally just running the orchestration layer (Kubernetes, Swarm, Nomad) and maybe some logging / metrics stuff (and, depending on who you ask, sshd).

sgk284··on Show HN: Bunkerized-Nginx – Nginx Docker image secure by default
I think the assumption is that nginx is your frontend server / load balancer, so all external requests go through it.
sgk284··on An overview of the science on function length
There are so many compounding factors here that the conclusion seems unreliable. It also reminds me a lot of the streetlight effect[1], in that defects may simply be easier to detect in smaller functions so that's where we find them.

Many of the conclusions center around density and lines of code. This is weird because if smaller functions lead to less overall code, then if you have 2 bugs in a 1,000 sloc codebase it'll measure worse than 6 bugs in a 10,000 sloc codebase that does the exact same thing.

It might be more valuable to compute the defect rate per cyclomatic or kolmogorov complexity. Or some other measure that's independent of line length and then figure out how function size impacts those complexity measures.

[1] https://en.wikipedia.org/wiki/Streetlight_effect

sgk284··on A voice separation model that distinguishes multiple speakers simultaneously
If you've ever listened to a podcast or talk radio then you've done all of this without the physical component.
sgk284··on Disabling Google 2FA doesn't need 2FA if you're already logged in
I suspect there is a common use case where someone’s phone gets stolen so they lose the 2nd factor and have to disable it or add a new device because they don’t have the backup codes either.

As with all things security, there are trade offs.

sgk284··on One word in PostgreSQL unlocked a 9x performance improvement
The Postgres docs are some of the best reading you can do. Super digestible, great examples, and all around excellent for learning.
sgk284··on Emotionally Expressive Text to Speech
https://voice.mozilla.org/en

“Common Voice is Mozilla's initiative to help teach machines how real people speak.”

sgk284··on Trello handed over my personal account to my previous company
This is just laziness on Atlassian's part. They should simply remove access to the Trello boards associated with the SSO account.

See: Github - where you can SSO into your organization's repositories but this is completely separate from your personal repositories.

sgk284··on The EARN IT Act: how to ban end-to-end encryption without banning it
I'd argue the opposite. By having no term limits, lobbyists are able to build up connections over years and take advantage of them. It also means any dirt, corruption, or bribery has an unbounded time for leverage.

Term limits work really well for the Whitehouse. I don't see why they wouldn't work well for Congress. And forcing lobbyists to reestablish rapport, dig up dirt, etc... with new congresspeople every few years would do wonders.

There's a reason financial institutions force people to take holidays. It's good for rooting out theft.

sgk284··on Message DB: Event Store and Message Store for PostgreSQL
Please do!
sgk284··on Message DB: Event Store and Message Store for PostgreSQL
At my previous startup we put everything we could into the database (work queues and pup/sub included). It was magical.

It minimized complexity (moving parts, boundaries, etc...), everything was transactional, and a single dump of the database gave you a copy of the entire persistent state of your system at that moment (across all services).

We had several services running, but any notion of persistent state was stored in a single database. We didn't have particularly high demands, but processed ~140M jobs per month in addition to our normal query load.

Postgres handled this like a champ, had far lower p50 and p95 latency than SNS/SQS, and rarely went above single-digit percentage CPU usage on a fairly cheap DigitalOcean box.

I've worked at a lot of big tech companies (Google, Microsoft, Twitter, Salesforce) in many varieties of giant distributed systems and the most valuable lesson I've learned over and over again is: Distributed systems are hard, avoid them until you can't.

That's the best advice I can give to any startup. Until you're regularly sustaining 1,000's of TPS or have grown to dozens of TB of data, it is generally a distraction to even think about anything other than a single relational database.

sgk284··on PostgreSQL example of self-contained stored procedures
Salesforce is built (or at least was ~7 years ago) heavily on stored procedures. Some projects, exclusively so.

Working there as a software engineer introduced me to a lot of dysfunctional things (as is true of all big tech cos) but pushing as much into the database as possible is one thing that worked beautifully and I fell in love with it. Since leaving Salesforce, I've embraced that pattern in three other projects and I've never regretted it.

It turns out that the database is the best place to work with data. It's verbose but has primitives that your application server simply can't have. And it's beautiful how querying data vs reading a variable have the same amount of cognitive overhead.

That is, the lines between what's in memory and what's coming from disk start to disappear. You just work with data, insert it when you're ready, and don't think about it again.

And the performance gains of not having to serialize data back and forth across the wire unnecessarily is huge.

I'd also be remiss if I didn't point out that if you are a fan of pub/sub patterns then triggers should be your favorite feature to use. They're just transactional pub/sub.

sgk284··on Alloy is a language for describing structures and a tool for exploring them
Here’s a good intro from strangeloop: https://www.youtube.com/watch?v=FvNRlE4E9QQ
sgk284··on What ORMs have taught me: just learn SQL (2014)
What a weird statement. In many ways, SQL is a higher-level abstraction than an ORM. A better analogy might be functional versus imperative styles, but even that breaks down pretty quickly.

ORMs generally serve some subset of three purposes: 1) constrain the dynamic nature and expressiveness of SQL in such a way that it can work well in less expressive languages 2) serve as a bridge between a typed language and an untyped language and 3) a way to avoid your team needing to learn and work in two languages for backend dev (similar to arguments of using Node so that your frontend and backend can be the same language).

To claim one is superior to the other without context is just a very inexperienced statement to make. I'd highly encourage any team that is comfortable being a polyglot to consider avoiding ORMs and embracing the DB as much as possible.

sgk284··on GraphQL Performance Monitoring Is Hard
Hasura is the best example I know of a beautiful, well engineered, well documented product that solves the completely wrong problem.

It just converts a custom syntax represented in GraphQL into arbitrary SQL queries, which is absolutely absurd. They have mechanisms to restrict access, but the fundamental foundation of the idea is flawed.

GraphQL is great in that you define the exact queries that you know to be performant. Once you resolve your top-level payload, most of the nested fields will be non-parameterized relations. These are usually just tons of multi-gets.

So in practice, you have top-level queries that you know to be performant, followed by multi-gets that you know to be performant. If you do have a parameterized field, make sure it's fast.

sgk284··on Uber's Losses Reach Double Digits in IPO Debut
Ha! I read that three times and it didn't click. October 2018 is correct. Thank you for the clarification.
sgk284··on Uber's Losses Reach Double Digits in IPO Debut
The 409A valuation was $70B or whatever, but they were selling the equity as though it was already worth 70% more than the paper value. (Hence the distinction between their "internal valuation" and the 409A). It was super sketchy. Basically trying to argue that the offer they were giving me was already worth a ton more than it was.
sgk284··on Uber's Losses Reach Double Digits in IPO Debut
Nope. It was October 2019! The paper valuation was whatever their last raise was (~$70B or whatever), but they were sandbagging on the equity and framing it as being worth far more than it was on paper.
sgk284··on Uber's Losses Reach Double Digits in IPO Debut
Eh... Uber gave me a job offer in October 2019 claiming an internal valuation of $120B. I found it to be completely unjustified and passed on the job, but I'm certain many others bought it hook, line, and sinker.

There were some really incredulous claims around the TAM of Uber Eats (and other efforts) that were proven outrageous in the S-1 filing.

sgk284··on Kubernetes Is a Surprisingly Affordable Platform for Personal Projects
Docker ships with swarm, and swarm + a compose file does everything you just described.

Swarm is such a pleasant and easy alternative that comes out of the box with Docker, does 90% of what Kubernetes does, and does 100% of what anyone with less than 50 servers needs. The learning curve is also an order of magnitude easier.

sgk284··on Ask HN: What's the mission of your company and why does it matter?
Co-founder of Banter, https://banter.fm. We make podcasts easier to share and have conversations around.

We've basically built a BYOC (Bring-Your-Own-Content) social network. Publishers host an RSS feed and remain in full control of their content. We don't try to assert copyright or anything over it. We don't even host it. We just enable conversations and sharing of that content (we even generate videos for sharing on other platforms that don't support audio well: https://twitter.com/stevekrenzel/status/1040746982615076864)

Some of the best content being produced today is in podcasts. Everything from comedy to news reporting. They're a great way to help people stay informed, learn new things, or just get a laugh. So if that counts as "truly mattering", then that's why it truly matters.

sgk284··on Ask HN: How much did you, as an employee, make when your startup exited?
Pretty standard acquisition story. Shareholders with preferred shares (VCs) got paid first. By the time they were paid there was nothing left. It just means the company was sold for too little for the employees to benefit.
sgk284··on Show HN: Banter – Podcast Together
Hi all, I've created an app (https://banter.fm) for sharing podcasts, seeing what your friends are listening to, and having conversations around them. You can also clip arbitrary chunks of an episode (up to 2 minutes) and share it (e.g. https://twitter.com/stevekrenzel/status/1040746982615076864). We generate videos that can be shared on Twitter, Instagram, etc..

The apps (Android and iOS) still have a few rough edges, but if you're a podcast enthusiast I'd love to hear what you think! Tech stack is react-native / apollo-graphql / postgres.

sgk284··on Show HN: I'm 12, learning JS, and wrote Wolfram's cellular automaton in Node
Thanks, glad you enjoyed it! And like another person already responded, this is vim with a split pane where the right pane is a `:terminal` (a relatively new feature of vim... though prior to that I would have just used tmux).

Highlighting searches is enabled with `:set hlsearch`, and you can search for whatever word is under the cursor with ``. So I just type and it highlights all of the matching words. Nothing too magical!

sgk284··on Show HN: I'm 12, learning JS, and wrote Wolfram's cellular automaton in Node
Thanks for the edits! I can't change the video, but did mention that both of those lines are a little clunky. I did update the gist though! Much cleaner.
sgk284··on Show HN: I'm 12, learning JS, and wrote Wolfram's cellular automaton in Node
So glad to hear, Liam! Was a pleasure to put it together.

Good luck, and feel free to reach out if you get stuck on anything.

sgk284··on Show HN: I'm 12, learning JS, and wrote Wolfram's cellular automaton in Node
Thanks! I really enjoyed making it. HN has been such a huge part of my life over that last ~10 years that it's truly the least I could do.
sgk284··on Show HN: I'm 12, learning JS, and wrote Wolfram's cellular automaton in Node
Thank you, much appreciated!
sgk284··on Show HN: I'm 12, learning JS, and wrote Wolfram's cellular automaton in Node
Thanks for the kind words! Will definitely consider.
← PreviousPage 3 of 17Next →