Better HN
topnewbestaskshowjobs
Log inSign up

BiteCode_dev

24,628 karma · joined Oct 21, 2019 (7y ago) · 5,512 submissions

I write to save you time and effort when dealing with Python:

https://www.bitecode.dev/

Email: contact at bitecode.dev

Submissions

comment 6y ago · link · parent

Anything that is not hardcoded is technically input.

But there is a reason we have a word for config.

It's a specific kind of input: it feeds the boostrapping state of your program, it's not the main data your program process.

The difference is important: structure, complexity and dynamism requirements are not the same.

comment 6y ago · link · parent

1 - you don't pipe config to stdin. If you use standard input, that's your main input.

2 - config sets your program boostrapping state. It's not the main data your program processes. That's your main input. IP addresses are what the script processes. It's not config.

comment 6y ago · link · parent

People keep confusing program configuration files and program stdin and are surprised that TOML is not a good fit for it.

If you are provisioning servers from a TOML files, you're doing it wrong. That's your program main input, not config.

If you have deeply nested values, chances are you are again confusing configuration vs main input.

JSON and CSV are great main input formats.

TOML is a great configuration format.

YAML and XML try to do both, and end up doing average on either, but being abused for all of them (looking at you Ansible and Solr).

So you should use each format for the correct purpose, as usual.

A config file looks like ~/.ssh/config or /etc/nginx/nginx.conf, not like ~/.ssh/authorized_keys or /etc/nginx/site-available/default.conf.

Just because we love to put a lot of data input in config folders (.config and /etc are full of input data) and call that configuration doesn't make it so.

How to know if something is configuration and something is input?

Conf data is usually only manually edited (authorized_keys changes with the life cycle of the program) and doesn't contain logic (default.conf if full of logic). Conf is also how the program is going to behave when performing its main task, the boostraping state, not the data used for it's main task (so not ip for provisioning servers, which is not meta, but the main course, or default.conf, which nginx uses to perform the main task). Conf rarely changes, main input often does. Conf is not piped or redirected to stdin.

comment 6y ago · link · parent

That's not config data that you have here, that's your program input (hint: you pipe it to stdin).

TOML is for config, config that users edit by hand, not input.

comment 6y ago · link · parent

I had to create a deb for a web app, it had to setup and populate a DB (from web sources), and manage updates for this db when you upgraded the deb. It had a build process of static files that couldn't be vendored. It has a lot of configuration to be entered prior those would happen, using debconf. It had to vendor a virtualenv. I had dependancies on 2 other web apps that had the same story, and they shared some config files.

I didn't chose this architecture. But I was tasked to package it so that people could just "apt get install stuff" and start using it.

It was HARD.

The tech is very old school, it doesn't give a lot of feedback, it's hard to debug, documentation is sparse and examples in the wild are not up to date, not to mention the state of tooling. And you do all that with shell scripting, the worst language for the job. Sure you can use anything else, if you like zero doc and example.

Then we had to distribute it.

Well, turns out creating an APT repo is not so easy, either.

Now, we did all that by cutting a lot of corners, zero red tape, and only us to please. Also, the consequences of not using best practices, or worst, breaking something, were few.

On a team of 6, only 2 were really understanding what was going on. The rest were lost, awaiting instructions from us because they just couldn't picture were their work would fit in this blob of bash workflow. Now that I'm gone, I have no idea how the team is going to maintain the thing.

I can't imagine doing the same thing with the level of road block working for something as sensitive as the official debian repo would bring.

If debian wants more contributors, they have to make this stuff way, way more accessible. And be friendlier with people telling them it's hard.

Every time I raised the topic, somebody came along to say I shouldn't be doing x or y. Or just that I shouldn't be packaging something and just publish it on the debian repo, letting the debian maintainers do the packaging. It's not going to bring me to work with the community if the first taste of it is the demonstration they completely ignore their shortcomings.

And I say that while I've been typing apt commands for a decade now. I'm also french. Debian is, with VLC, Libre Office and Firefox, one of the 4 pillars of FOSS for me.

comment 6y ago · link · parent

In production systems, you don't use coroutines alone. You have several processes, some may contain several threads, some thread may contain an event loop.

In fact, it's already the case with WSGI setups: you may have async nginx on front, multi-process gunicorn behind, and a thread pool for you db connections. And asyncio already provides API for sending tasks to process pools and threads and getting them back as async Future as a convenience. It's turtles all the way down.

Bottom line, async, threads or processes are not silver bullets, and you should use the right tool for the right job.

Just like when Go users realized that spawning goroutines for everything actually didn't work at scale, throwing awaits everywhere is not a magical solution.

Having asyncio at your disposal make some tasks easier, like websockets, crawling your network, etc. It opened the door for new architectures, and maybe new features (live settings, task queues that feeds the results back to you, etc.).

But it's been oversold, as with anything new and shiny.

comment 6y ago · link · parent

I'm not talking about the times it take for selling as much as the absence of delay between buying and selling.

comment 6y ago · link · parent

But what good does it do to have such a instant information on speculative value outside of the world of making money with it ?

comment 6y ago · link · parent

I don't have the background to understand your answer, can you make it simpler with some examples ?

comment 6y ago · link · parent

Genuine question, what good does the ability to buy and sell stock on the short term do for humanity ? Does it have any specific vertue appart from allowing one to make make money by betting correctly ? Why are not all sales required to be long term ?

comment 6y ago · link · parent

Same, but I also do "shopt -s dotglob" so that * includes hidden files.

comment 6y ago · link · parent

Programming is using conventions. Lots and lots of it.

Conventions for syntax, names, logic, API, structure, vocabulary and so on.

Conventions are by nature arbitrary, influenced by culture, history, social behavior and a whole lot of human weirdness.

Don't try to learn all the conventions first, it comes faster with practice and exposure to it. Solve the problem, then find the conventions you need to apply the solution in your context.

The beginners paradox is that they need to learn a bit of specific conventions (E.G: part of a language, one paradigm and a few libs) to start working on solving a problem, so it's a frustrating experience.

There is no easy way to build the rest of the conventions based on your knowledge of what you know now, because it's artificial.

It's also what leads people to say "don't learn languages, learn to program". Which makes no sense to you at all, until, well, you finally know how to program. But you got there by learning conventions on the way.

comment 6y ago · link · parent

> As far as I can tell functools.partial has been implemented in C since it was added sixteen years ago ( https://github.com/python/cpython/commit/9c323f8de4910dfc0ba.... ), and it's faster than lambda ( https://gist.github.com/wrmsr/1e13eda3ed78288679c010acbe6d2b.... )

I tried to prove you wrong and run multiple tests that all shown you were right. Then I tried to run them on different python versions, down to Python 2.7, expecting that my knowledge was just dated.

No, I was just wrong.

Don't know why I was so convinced of this.

> Regarding docstrings you can access the underlying function via the __wrapped__ attribute,

This assumes one knows about that. A lot of people never even heard of partial(), and won't know about _ _wrapped_ _. Not to mention I never seen a tool using help() fetching _ _wrapped_ _._ _doc_ _ if it exists.

> and signature forwarding is too brittle and magical for stdlib.

@functools.wraps() does signature forwarding to great success, and is in the stdlib.

Nevertheless, I don't think it would be the right strategy for partial(), because you don't have the exact same signature. But at least having something like:

   This function is the result of x() being wrapped with partial(x, 1, foo='bar').

   Here is the original docstring of x():
   
    ....

comment 6y ago · link · parent

Just use ubuntu like you did before snaps. No change to make. It works as before. All the debs are still here. The ppa. The apt.

Let others figure out the snap debacle.

comment 6y ago · link · parent

Same.

But I think what they did with partial should be in the stdlib.

In fact partial should also be rewritten in C et promoted to built in.

Right now it's 10 times slower than lambda, and you have to know about and wish to import functools, yet still loose the docstring.

Shame for such a great feature.

comment 6y ago · link · parent

I run ubuntu 20.04 and don't have one single snap installed.

If you can switch distro, surely you have the skill to just ignore snaps and use ubuntu like a regular debian system. It required zero effort on my part at least.

comment 6y ago · link · parent

It this gets confirmed, we'll have a dilemna: confined people will become deficient in D vitamin by lack of sun exposure.

comment 6y ago · link · parent

Thanks, I didn't even know this list existed.

comment 6y ago · link · parent

Up to now we just delete it. We coded an admin for that. It takes time because we have to read the claim and assess the legitimity of it, not for the deletion.

Assessing said legitimity is tricky. Not because people lie, up to now they have been pretty decent, but because you really don't want to be tracked while following potentially child pron links, so it may take time.

Scaling moderation could become a problem if 0bin becomes more mainstream, but with so few reports, it's not a problem right now.

comment 6y ago · link · parent

That's the beauty of FOSS. 0bin is itself a python rewrite of the PHP zerobin, the later was also forked into privatebin.

Now a zero knowledge pastebin is kind of a category, thanks to the french blogger sebsauvage that started the trend.

comment 6y ago · link · parent

Dmca + pedo + dox reports are about a dozen a year. Pastes are a niche.

comment 6y ago · link · parent

Titles are rarely used, but I did receive emails of users saying "woops, can you delete this ?" with very personnal content.

Which is why we implemented the delete feature (creating a paste gives you a cookie that allows deletion) recently because we don't want to spend time on customer service for a free site.

comment 6y ago · link · parent

People post the full links (including the key) everywhere, so regularly, we google a bit to check what people use us for.

This allowed us to discover we were pretty popular on the crypto community and in specific fan fic subreddits. Which lead us to implement btc tipping and reader mode.

We also got reports, tickets, dmca, etc.

We cannot brute force our thousands of paste encrypted payloads, but for a sample, it's easy to follow the bread crumbs. And if we do it, others do it too.

comment 6y ago · link · parent

We have about 20k hits a day. Or do you talk about dmca ?

comment 6y ago · link · parent

And a good one too. I'm currently maintaining https://0bin.net, and because we encrypt everything client side, people feel like they can post anything they want. We get some pretty personnal stuff.

They really should not. It's a can of worms. We can get compromised. Bought. Receive a court order (we comply with dmca). Or they could be on the wrong URL (typo squatting, phishing...).

Don't trust random online services with your data. FOSS or not, the code we serve can only be trusted as far as you and I we can be. And you don't know us. And you will make mistakes.

Now I'm guilty of it too, I share passwords with 0bin sometimes. But at least it's my service, I can assess the level of threat.

comment 6y ago · link · parent

To be dead, it would have needed to be alive.

Sure, on HN, you will find sometimes some people that reports using it on real life projects.

But in the last 10 years, I did missions for about a 50 or so companies, and none of their team members, NONE, used TDD.

Few even had tests at all.

I've seen companies tried many things: agile, remote work, one team by micro-services, etc.

I've seen many videos of people saying they applied on TDD in their companies. I've even seen a few IRL of them in conferences or meet up.

But I've never worked with people using TDD in real life.

Not saying it doesn't happen, or that TDD is bad, just saying that I don't think it ever became a popular approach. Like Haskell or Nix, it's famous only in our bubble.

comment 6y ago · link · parent

It's definitly a lot faster than before on my one plus 6. Espacially pages with a lot of images, or when rendering a video. A welcome improvement.

comment 6y ago · link · parent

I'm seing more Firefox than before in my stats, not less. Not a lot more, but a few %.

"Not dead yet"

comment 6y ago · link · parent

Bitwarden, as an app, can fill password in any app, including web sites viewed in firefox.

It's not as well integrated as an extension, and has some bugs, but it's a decent workaround.

1
152153154
184