Hacker Newsnew | past | comments | ask | show | jobs | submit | abuckenheimer's commentslogin

excellent explanation, to add to this since I was curious about the composition, '%c' is an integer presentation type that tells python to format numbers as their corresponding unicode characters[1] so

'%c' * (length_of_string_to_format) % (number, number, ..., length_of_string_to_format_numbers_later)

is the expression being evaluated here after you collapse all of the 1s + math formatting each number in the tuple as a unicode char for each '%c' escape in the string corresponding to its place in the tuple.

[1] https://docs.python.org/3/library/string.html#format-specifi...


This is really nice! The context switching that comes from using the [official k8s reference](https://kubernetes.io/docs/reference/kubernetes-api/workload...) is a real pain. If your writing a deployment and need to check one thing about the pod spec all of a sudden you jump to a new page and lost where you were. Ontop of that this keeps track of the indentation level the spec your looking at within the context of whatever parent path your writing it for.

Maybe one nitpick would be to keep colon between the key and the type so one can copy paste multiple lines of relevant spec to be filled in your editor easily.


I find this hard-to-find official documentation so much easier to read: https://kubernetes.io/docs/reference/generated/kubernetes-ap...

In my opinion, it comes with better navigation, safe to open in new tabs to drill-deep and unwind when done, much better use of horizontal space. Even though it is generated, I looks to have much of the exact same text?


Official docs should really have a direct link to the specs from the main technical docs.


I've only skimmed the quickstart docs https://kargo.akuity.io/quickstart/ but this snippet immediately clicks for me as something that I'd want to try

    cat <<EOF | kubectl apply -f -
    apiVersion: kargo.akuity.io/v1alpha1
    kind: Promotion
    metadata:
      name: prod-to-${FREIGHT_ID}
      namespace: kargo-demo
    spec:
      stage: prod
      freight: ${FREIGHT_ID}
    EOF

Have enjoyed using argo in general in the past, its got a great model for k8s native workflows / events but never got to using it for CD.


I used Argo for some e2e test suites I wrote and it was a god send. Being able to trigger off of GitHub labels was so insanely powerful for building developer tooling.


Yeah we use argo workflows to power some e2e testing and rollouts for canary blue/green, and their notification server, but don't actually use their cd product.


This is clever, otherwise you have to coordinate your cache setter and your async function call between potentially many concurrent calls. There are ways to do this coordination though, one implementation I've borrowed in practice in python is modes stampede decorator: https://github.com/ask/mode/blob/master/mode/utils/futures.p...


> python3 -c 'while (1): print (1, end="")' | pv > /dev/null

python actually buffers its writes with print only flushing to stdout occasionally, you may want to try:

    python3 -c 'while (1): print (1, end="", flush=True)' | pv > /dev/null
which I find goes much slower (550Kib/s)


Very cool, py-spy[1] has been an invaluable tool in my development process since jvns blogged[2] about it. The power of being able to visualize where your code is spending its time is so obvious and I'm glad people are building tools to make that easier.

As a quick compare and contrast between py-spy and pyinstrument it looks like py-spy has the advantage of being able to attach to an already running process which is super useful when your program is stuck and you don't know why. I haven't used pyinstrument yet but I do like the fact that it can do its flame graph in the console, sometimes I find saving down an svg file and opening up the browser a bit arduous. Excited to give it a try.

[1] https://github.com/benfred/py-spy

[2] https://jvns.ca/blog/2018/09/08/an-awesome-new-python-profil...


Another relatively new addition to the python statistical sampler space is Austin[1], that has a lot of similar features to py-spy. I haven't made a direct comparison yet between the two.

[1] https://github.com/P403n1x87/austin


You can use https://github.com/4rtzel/tfg for an interactive console flamegraph. It supports opening pyspy files.


I see a lot of tracing and sampling profilers for Python, but are there any profilers for manual instrumentation (goes by a bunch of names, frame profiling, performance telemetry, APM etc.)?


As an example, https://github.com/score-p/scorep_binding_python#user-region... is the support in the HPC system https://score-p.org (though it focuses on parallel programs). http://apps.fz-juelich.de/scalasca/releases/cube/4.5/docs/gu... is the associated profile analysis tool.


py-spy seems also very interesting, thanks for linking it. I always found cPython to be quite difficult to work with, and usually reverted to line_profiler or some sort of UI for cprof files. The main added benefits of pyInstrument to me is the high signal vs noise ratio, as it is evidently clear what is taking the most time while retaining the option to dive deeper.

I am also curious to try out the on-demand profiling integration with Flask, seems like a cool thing to have running in the background for my side projects


py-spy is absolutely invaluable for the attach-to-process feature. also, nothing beats the adrenaline rush of attaching to a prod process and leaving it in a paused state after collecting a profile (true story! SIGCONT is your friend).


It's interesting to compare palantir's risk factor on open source vs pivotals[1]. Palantir takes a defensive posture saying basically that their ability to not contribute to open source without running afoul their licenses is important:

Our platforms contain “open source” software, and any failure to comply with the terms of one or more of these open source licenses could negatively affect our business.

Where as pivotal says that being an active part of a vibrant open source community is crucial:

If open-source software programmers, many of whom we do not employ, or our own internal programmers do not continue to use, contribute to and enhance the open-source technologies that we rely on, the market appeal of our offering may be reduced, which could harm our reputation, diminish our brand and result in decreased revenue.

Like this makes sense, palantir is a closed source first kinda company and obviously a different value to its customers than pivotal. Kinda interesting to see that manifestation in the risk factors though.

[1] https://www.sec.gov/Archives/edgar/data/1574135/000104746918...


Here is Palantir's Github presence, with almost 200 open-source projects: https://github.com/palantir


Just remembered the puck building[1] has these on the sidewalks surrounding the Houston street side, if you go into the Eastern Mountain Sports store and down the stairs you can see them from below.

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


Would highly suggest listening to the "How I built This" podcast[1] with the peleton founder John Foley, really great story with usual tech themes like doing things that don't scale and finding a niche but loyal customer base and expanding organically.

[1] https://play.google.com/music/m/Dmjr6m5i4h3j6gaysgjd47ryhci?...


I was shocked at how successful he described their mall marketing!

Rough quote from when I listened a week or two ago:

"If I could get someone to ride the bike, there was about a 50% chance I could get them to buy it"

Also rough quote:

"People would ask what would happen if we went out of business. Since it was a subscription, there was an annuity value in keeping the platform going. Whoever ended up with our assets after a bankruptcy could use those revenues to spin up an instance of AWS to host the videos. I had a whole line ready to go about it."


Yes HFT buys trade flow from robin hood because they make more money executing against it but that's not actually to the detriment of the people on the robin hood app. The main way HFT firms make money is by making a market, they offer to buy and sell stocks cheaper than anyone else and get paid by people crossing the spread and sometimes exchange fees. The reason robinhood trade flow is valuable to HFT firms Isn't because they are trading against "dumb" millennials but because they know millennials aren't likely to move the market playing around on their smartphone. HFT firms can collect a small rent sitting in between millenials trading with one another without the risk of being on the wrong side of a trade that materially moves the price of a stock.

Matt Levine does great write ups on this stuff, would highly recommend: https://www.bloomberg.com/opinion/articles/2018-10-16/carl-i...


The stock market is a zero sum game. If HFTs are making money then someone else's is losing it. The other traders who's trades are closest are the most likely losers. HFTs will tell you what a great liquidity service they provide but they are doing nothing more than using the equivalent of insider information to skim the cream off the top.


This is a facile analysis. If you believe HFT internalizers are taking money from retail traders, try to outline the series of orders that results in money from the retail trader's pocket going into the HFT's pocket, and precisely how the retail trader could have made that same money on their own.

The reality is that market makers price non-retail flow more conservatively (ie: costing traders more) because they have to anticipate informed large block trades wiping them out. Since they don't have to do that for retail flow, their cost basis for those trades is lower, and they can (and do) split the proceeds of that reduced cost with brokerages.

It's overwhelmingly likely that any other brokerage you use does the same thing, and simply doesn't tell you or pass any of those savings on to you.


>The stock market is a zero sum game. If HFTs are making money then someone else's is losing it.

But who's that "someone else"? It's not the robinhood customer, because they're getting at least the best price on NMS[1]. So what's the issue? Would you rather pay $10/trade so your trade gets posted directly to the exchange and the profit goes to some random investment bank or daytrader rather than the HFT firm?

[1] https://en.wikipedia.org/wiki/Payment_for_order_flow#Legalit...


NMS regulations do not apply to "odd lots" (orders <100 shares). This likely constitutes 99.9999999999% of trades done on Robinhood (and most retail trading, to be fair).


In 2018 people like to scream about “selling their data” way too much.


In 2018 I'm still not being paid for my data.


The stock market is not a zero sum game. I don't know where people get this idea that because every transaction involves two sides, the sum is therefore zero. Every transaction in the "real economy" also has two sides, and we all know that grows. The stock market grows too. There are even indexes to track how well it is growing.


The “real economy” runs on a fiat (inflating) currency system that is effectively not zero sum. The stock market is a closed system that currencies feed into - at the end of the day it’s still a measure of a fixed amount of value and thus zero sum.


> The stock market is a closed system that currencies feed into

Currencies feed into the stock market, but it's not a closed system. If you think a company is undervalued in the stock market, and you buy shares, that raises the price of shares for that company. With a higher share price, that company can borrow money (by issuing shares) at better terms, and spend that money on growing more than they could have if they had not borrowed that money.

If the stock price is too low, the company may buy back shares of its own stock (thus enabling future borrowing). Alternatively, investors may buy up a majority of the stock of that company, thus acquiring control of that company, and either try to force the company to do a thing they expect to be profitable, or liquidate the assets of the company (which will then be distributed to shareholders in proportion to how many shares they hold).

So basically the stock market moves money to the companies based on how effectively they could spend borrowed money / how valuable they would be if liquidated.


Currency is a tool for measuring economic value, it's not the basis of economic value.

This is why fiat currencies are so useful: you can change the length of the "ruler" to accommodate changes in the thing you're measuring, so the value of the increment remains stable.


No, companies create excess value and grow. Tesla pre Model 3 is a very different company than Tesla post Model 3. A drug company is very different if they've patented a new wonder drug. New companies come into existence and offer shares via an IPO.

Investing in the stock market is literally investing in the collective appreciation of the value of the companies that make up it.


But there's stocks on the other side that represent real things that increase in value. E.g, compare Google 20 years ago with Google today and see if you think it's more valuable.


Stocks are not zero sum. In theory, their value is based on future income. Information about the future is what most affects stock prices, because it changes expectations around future income. Even with no transactions in a stock, offer price can continue to rise because of these expectations, and it represents real increase in wealth to people who own the stock, no transactions necessary. When offer price rises enough to tempt someone to sell then you have an estimate of the market value.


But the zeroes that the HFTs are taking is from the old-line manual market makers, not sellers or buyers.


Here is my understanding. Let a<b<c be small numbers. Some investor thinks a stock is worth x+c. They put in a limit buy order at x. Some HFT firm sees this and thinks well if they want it at x, I want it at x, and puts in their own order at x (+a fees to robin hood). Millenial comes and wants to sell their stock.

Normally the investor would get the stock since they placed their order first. But since the HFT firm is paying for the order they get it instead. If things go well the HFT firm can sell to the investor at x+b, if things go poorly they cut their losses and sell at x.

The investor that didn't get the order and has to buy it from the HFT firm at x+b is the loser.

The money that funds this dance comes from the millennial who sold a stock worth x+c at x, but that would have happened regardless.


I can't speak to the accuracy of your claim, but Matt Levine recently wrote about another factor, payment for order flow [0]:

>They want to buy stock for $99.99 and sell it at $100.01 and clip two cents on each trade. If their orders are random—if sometimes people buy and sometimes they sell, with no pattern—then that works out well for the market makers. But their big risk is what they call “adverse selection”: Sometimes, when a customer buys 100 shares at $100.01, it then buys another 100 shares at $100.02, and another 100 shares at $100.03, and keeps going until it has bought 10,000 shares and pushed the price up dramatically. The market maker who sold it the first 100 shares—and who is probably now short and needs to go out and buy those shares at a higher price—has been run over.

>[...] [I]f a market maker can guarantee that it will only interact with retail customers—if it can filter out big orders from institutional investors—then its risk of adverse selection goes way down. The way the market maker does this is by paying retail brokers to send it their order flow, and promising those brokers that it will execute their orders better* than the public markets would. [...] It can offer a tighter spread than the public markets—and have money left over to pay the retail brokers—because it doesn’t have to worry about adverse selection. If the retail broker is, say, one designed to let young people day-trade for free on their phones, then those orders are probably particularly valuable, because they are probably particularly random.*

[0] https://www.bloomberg.com/opinion/articles/2018-10-16/carl-i...


Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: