Better HN
topnewbestaskshowjobs
Log inSign up

physicles

1,822 karma · joined Feb 3, 2019 (7y ago) · 645 submissions

Submissions

comment 5y ago · link · parent

direnv is our magic sauce for this. We enforce that all devs store the current context in an environment variable (KUBECTL_CONTEXT), and define the appropriate kubectl alias to always use that variable as the current context. To do stuff in a cluster, cd into that cluster’s directory, and direnv will automatically set the correct context. I also change prompt colors based on the current context.

(This way, the worst you can do is re-apply some yaml that should’ve already been applied in that cluster anyway)

We also have a Makefile in every directory, where the default pseudo-target is the thing you want 99% of the time anyway: kustomize build | kubectl apply -f -

comment 5y ago · link · parent

What’s your threat model?

Is there anyone out there with $$$$ who will stop at nothing to part you, a rando, from your old data? Probably not. Are there sophisticated attackers who will burn a couple 0-days to build a botnet for the sole purpose of randsoming NASes AND attached cloud accounts AND the origin systems, accounting for tons of possible configurations? Still pretty unlikely — this is NotPetya level stuff with small payoff.

If you find yourself in the crosshairs of a sophisticated, dedicated attacker (perhaps one in possession of a 0-day), you’re pretty much done. Offline write-only backups stored offsite are the only defense.

However, is there a bug lurking in Hyper-backup that might accidentally wipe stuff from Azure storage, and the bug hits a month before your house gets struck by lightning? Maybe…

comment 5y ago · link · parent

Go doesn’t benefit as much from docker, but if you’re already living in a docker world (i.e. everything you deploy is a docker image, and it’s managed by compose or kubernetes) then it’s easier to use docker than not.

We build images (about 20, each with a Dockerfile) from a monorepo with a single go.mod. I have basically a full replica of prod running locally in k3s — letting k3s manage it all is easier than dealing with the pile of environment variables that would be needed to get everything hooked up properly. And with kustomize, we can reuse a bunch of yaml from prod.

Sometimes I’ll run go binaries locally on my machine for debugging (the builds still work because go’s packaging is finally stable). But the difference is minimal — using docker/k8s is more about streamlining deployment/config/rollback (and the occasional co-packaged asset) than anything else.

comment 5y ago · link · parent

Unfortunately, untangling it from internal assumptions and getting it ready for sharing would take too long (several hours I think), so it's not something I can do right now.

Next step would be to pitch the boss about the usefulness of open source as a recruiting tool, and get some time budget for this kind of stuff.

comment 5y ago · link · parent

I built something similar to this (for internal use) around Go, except instead of a local program, it turns the command line program into a web app which then runs in the cloud. So now, if we need a new internal tool it’s just a few lines of console code, and bam, the devs can run it on the cli and pipe to/from it, and customer support or whoever can use it on a (still pretty ugly) web UI.

I didn’t use direct capture of stdout because it’s useful to have first class support in the web UI for other types of data, like tables, where you want sort/filter/save to csv. Colors are simple if you interpret those ascii control codes. I did some long polling with incremental data fetch so huge and/or long-running commands work efficiently. Works a treat. Totally worth the investment.

comment 5y ago · link · parent

Porting my number to Google voice before moving abroad was one of the smartest things I’ve ever done (in hindsight), for this reason.

I sometimes wonder why Google has kept it running for so long, when they’re so keen to kill off boring, under-performing products.

comment 5y ago · link · parent

Carmack is such a great communicator of software development philosophy. He also wrote a classic article on "Functional programming in C++": https://www.gamasutra.com/view/news/169296/Indepth_Functiona...

comment 5y ago · link · parent

Not sure if there's a Sculpt clone out there, but I've been using a Natural Keyboard Elite for >20 years, and I'm pretty happy with the Kinesis Freestyle Pro I just picked up (brown switches because I don't want to make tons of noise in a coworking space). Key placement is close enough that there isn't much of a learning curve.

comment 5y ago · link · parent

No need to bring in effects to cognition, even. It just sucks to live in a place where “(tonight’s run|tomorrow’s hike) is canceled because the air quality is shit” is a thing.

comment 5y ago · link · parent

Whether targeted ads work well from a user perspective is irrelevant to Google and FB. These companies only care about whether their ad tech can drive user engagement in such a way that advertisers think targeted ads work well.

After all, the advertisers are paying the bills.

comment 5y ago · link · parent

In the last couple years I've come to realize that nearly all POSTs should actually be PUTs, sometimes with a client-provided uniqueness token in the URL (like a UUID) that becomes part of the newly-created resource's ID.

Now that I think about it, all the situations where I'm fine using POST are also idempotent, such as changing an object's metadata (technically PUT or PATCH), or sending a batch of HTTP requests to an endpoint bundled as a single request.

comment 5y ago · link · parent

Totally agree, drivers don't respect cyclists' right of way at all, and the bike lanes are often clogged with parked cars. But the bike lanes are still useful, and in places where a bike has to go into the road to go around a car, the cars _expect_ this. I don't have much good to say about the drivers around here, but they're definitely used to the road being filled with cyclists, e-bikes, and grandpas on their 三轮车.

comment 5y ago · link · parent

As an American who has been living in China for some years, I don’t miss the car-centric lifestyle one bit. But I don’t see a viable path to wide adoption in the US, especially since your choice of transportation is now part of the fucking culture wars.

For bikes to have real gains, you must somehow make cars less appealing. And while individual mindset is similar in China and the US — everybody really really wants cars now — the outcome has so far been different. Here’s my guess as to the reasons why, with the most important first:

- It’s super hard to buy a car here. The waiting time for a new number plate is something like 10 years (for the non-rich anyway). I’m so thankful for this — I can’t imagine this city with tons more cars. (You used to be able to jump the queue by buying an EV, but the waiting list for that has grown now too)

- Even after you buy a car, there are days when you can’t legally drive it, depending on the last digit of your number plate.

- It’s straight up annoying and expensive to drive to most places in the city. Traffic is terrible, and for short trips you’ll spend way more time and money parking than driving (its common for a 10 minute bike ride to be a 30-40 minute drive during rush hour). That said, the city does not seem interested in fixing this problem by widening roads, which I take as a win.

- There is bike infrastructure: not only are there decent bike lanes, but drivers are used to sharing the road with bikes. It’s not Scandinavia, but it’s way better than the US.

- There are shared bikes fucking everywhere, so it’s always an easy option. It’s super rare that I end up somewhere and cannot find a bike.

- There is zero tolerance for drunk driving. If you’re going somewhere to drink, that’s a trip you’re not driving.

All this said, even though there are so many bikes on the streets that they stack up at traffic lights like cars during rush hour, I feel like the number of bike commuters is 1-2 orders of magnitude less than the number of subway commuters. There’s a scale (population, and geographic size) at which you can’t just promote biking, you must invest in public transport.

comment 5y ago · link · parent

> Maybe finding a way to scale up good things like trust or good will? I want to find something where I'm making the world a better place but also working on something that makes me smile.

Have you made any progress finding something new to work on?

Maybe I'm projecting here, but I'd imagine this is the dream of most of HN, no? But I don't know which is harder: finding such a unicorn idea, or executing on it once you've found it.

comment 5y ago · link · parent

The experience of changing from someone who believes all aspects of the “orthodoxy”, to someone who accepts that there are flaws in it, can be strikingly similar.

A Chinese friend once described to me the week he discovered YouTube after going to study in America, when for the first time he saw videos of Chinese leaders (2000-era) behaving very rudely toward reporters. He found that shocking, and over the next few weeks and more research, accepted that much of what he’d been taught about his history was fabrication. The experience was pretty traumatizing for him. He’s back living in China now, but with a very different perspective.

I was what you might call a fundamentalist Christian for most of my life, until I was exposed to enough of the counter-arguments that some of them finally stuck. The deprogramming process took a year and a half and was the most difficult thing I’ve ever done.

In both cases, the in-group is well-protected from “improper information” (as the CCP calls it). In China they have the great firewall and the domestic censorship apparatus; in religion believers are inoculated against trusting information from “worldly” sources (though the motives of those involved in the actual suppression may differ). Neither system could survive in its current form if this information weren’t suppressed — that’s obvious by looking at what happens when individuals are exposed to alternate points of view and take them seriously.

comment 5y ago · link · parent

It is possible to build such reliable systems, but it is not economical for the vast majority of software that gets written — at least with current tools.

If getting something production-ready takes X time, making sure that thing doesn’t ever need to be restarted takes many times X, not to mention the huge investment in testing to ferret out those rare edge cases that cause hangs or inconsistent state.

Someday when software engineering comes into its own as an actual profession, maybe our tools will also achieve a higher level of consciousness, as it were. But nothing mainstream today comes close to enabling this.

comment 5y ago · link · parent

The main lesson we can take is to design our software with the assumption that the machine can be turned off (or crash) at any time. That is obvious when you’re in a browser or running in a VM, but it was very far from engineers’ minds 20-30 years ago.

Most note taking software I’ve used doesn’t even have a save command. That’s a huge step forward.

comment 5y ago · link · parent

Yeah we’d use it as our LAN opener so as people arrived they could just jump in. For me this game is tied to those memories of hefting your 19” CRT on the corner of a ping pong table and trying to get set up ASAP so you wouldn’t miss another round.

The weapons are balanced and controls are tight. This might be the nostalgia, but it felt as polished as Starcraft, in its own way.

comment 5y ago · link · parent

I don’t have any sources, just another anecdote. I live in Beijing, and one of my friends gets a headache whenever the air gets close to 200 AQI. (That’s not the case for me or most people I know though. Me, I get a days-long sore throat once a quarter unless I have an air purifier at home and at work)

Why not buy an air purifier?

comment 5y ago · link · parent

I’m a Biden supporter but I would love to see some actual sources for this fraud.

comment 5y ago · link · parent

I had a case today where I was comparing two sets for equality. If the range of values is large, you could xor everything together as a O(1) space check for likely equality. Result is nonzero -> sets definitely aren’t equal; result is zero -> sets are probably equal, but you’ll need to check again some other way to make sure.

Of course this is absurd if you’re dealing with anything that already fits in ram, but it’s still neat to think about.

comment 5y ago · link · parent

If you only want to hold the lock for a portion of a function, pull that part out into its own function. Makes the code much easier to reason about. I consider .Unlock() without defer to be a code smell in nearly all cases.

comment 5y ago · link · parent

The book Designing Data-Intensive Applications talks about “schema on write” vs “schema on read”. In order to interpret your data, you must apply a schema, so your choice is whether you do that explicitly when the data is written, or implicitly when it’s read.

Or as Yoda would say, Schema read or schema write, there is no “no schema”.

comment 5y ago · link · parent

Really? For just that reason? I live and work full time in China and we use G Suite and Slack with a good VPN (there are some similar Chinese services but none are nearly as good).

Sometimes I can’t watch a YouTube link if I’m away from home and the VPN isn’t working on 4G, but that’s as bad as it ever gets these days.

comment 5y ago · link · parent

Yes! In uni I had this idea for a program that would triangulate where lightning struck by having multiple computers across campus listening for thunder, then measuring the difference in arrival times of the thunder. Like GPS in reverse.

Soon I realized I’d need the computers’ clocks to be as in-sync as possible, which in turn requires one-way latency calculations. I spent an hour diagramming with pencil and paper until I convinced myself it was mathematically impossible or I wasn’t clever enough to find the solution.

Looking back, I was more worried than I should’ve been about this (wired latencies are usually far less than 5ms, which for sound is ~1.5m) and less worried than I should’ve been about the fact that thunder isn’t anything close to a point source of sound.

comment 5y ago · link · parent

My bad, should’ve done the research.

In a mid December CBS news poll, “82% of Trump voters say they do not consider Mr. Biden[‘s win] legitimate.” The vast majority of trump voters isn’t the same thing as half the country.

https://www.cbsnews.com/news/cbs-news-poll-most-feel-electio...

comment 5y ago · link · parent

This isn’t about closeness at all. It’s about ~half the country actually believing that the election was rigged. That doesn’t have precedent as far as I know.

comment 5y ago · link · parent

> If it swings too far the other way I'll quickly switch my thoughts on the matter.

I’m also in group b, but the danger is that if it swings too far the other way, we may have already lost the ability to speak out against _that_ and restore balance.

comment 5y ago · link · parent

I had the same thing happen to me with Windows destroying my Linux boot loader. After that, I gave up dual booting and have been on Linux 100% ever since. I don’t see myself ever going back.

comment 6y ago · link · parent

I have a similar story, except I never made it past physics undergrad and joined a big tech firm right after graduation. That was my dream job since I was 10, prestigious or not, and I loved the first five years there.

But the prestige trap is real. My last career move was a big step down in prestige, but a huge step up in job satisfaction. I wish I didn’t, but I do miss working at a company that everyone knows.

For me I think the key has been that my friends have a random assortment of cool jobs and don’t care much about working somewhere prestigious. I just don’t click with people who do. Because as much fun as it would be to play the comparison game, I just couldn’t shake that existential angst that none of that stuff fucking matters, and the only thing that matters is to be happy and do good to those around you.

1
1819202122