8,487 karma · joined Feb 1, 2017 (9y ago) · 2,549 submissions
comment 4y ago · link · parent
Source: had adhd long before smartphones. Still do.
- written on my smartphone
comment 4y ago · link · parent
Either way, anything relying on hashes for data integrity should at least be flexible to the option of multiple hash algos. But with git, it's going to be hard enough as is to change to SHA-256, and I don't know how parametric it'll be.
comment 4y ago · link · parent
You basically need NPM if you want to work with any kind of libraries, and I'd say the Anaconda system comes with way more ergonomics out of the box, so that's more or less a wash.
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
You need a certain tax base to keep services funded. Then at some point on the curve, you start running out of service workers for the care industry.
I think automation will help to a degree but healthcare services is right at that sweet spot of both physically intricate and nonroutine that is so hard to automate.
comment 4y ago · link · parent
I couldn't find any "listicle" style top N list, the closest was "top players in quantum computing"
> awful generic CGI backgrounds
That's pretty par for the course for this tier of channel. Arguably the "quirky room with nerd tchatckies backdrop" is more authentic, but both are just filler behind a talking head.
> give me your opinion in the comments
Necessary evil to drive engagement to appease The Algo.
Imho her work is a step above the lion's share of science reporting, but I can see how she might be polarizing.
comment 4y ago · link · parent
comment 4y ago · link · parent
Respectfully, this is pretty wrong. Pandas does vastly more out of the box than numpy. Off the top of my head: I/O from over a dozen of data formats, joins/merges, sql queries directly to dataframes, sql-like queries on dataframes, index slicing by time, multi-indexes, much more ergonomic grouping/aggregation functions, ergonomic wrappers around common graphing use-cases, rolling windows.
I'm not even really a power user of it, so there's probably a zillion more things it does that numpy can't out of the box, and I don't wanna spend time writing time and validating if an implementation exists.
comment 4y ago · link · parent
https://mobile.twitter.com/AaronBergman18/status/15273336157...
> 12oz Diet Coke contains 100mg phenylalanine, which is an indirect precursor to dopamine and norepinephrine in the brain.
If "leads to dopamine eventually via some pathway" were sufficient for dopamine, hoo boy, the field of psychopharmacology would look radically different. Would certainly make treating ADHD and Parkinson's way easier (and schizophrenia and mania way harder).
Or, y'know, it's the caffeine. Especially since it doesn't cause the sugar spike/crash like regular soft drinks.
comment 4y ago · link · parent
Likewise, ingress/egress is not quite the same as read/write. It gets its own terminology because it's distinct.
comment 4y ago · link · parent
How often are you actually relying on memory of an ID to troubleshoot a problem? I mean sure, if you are scanning visually, it's good to recognize the same ID over and over again, but my ability to do so caps around 4-6 characters. So I just look at the last 4 chars regardless when fast scanning.
I use copy-paste for any time I need to transport IDs between contexts (that isn't just scripted, which is best). Having a copy-paste stack (Alfred, Raycast and others have this feature) is a huge game changer here.
comment 4y ago · link · parent
At that point, it's basically just UUID7 with Crockford base32 encoding, more or less.
IMHO the in-process monotonically increasing feature of ULID is misguided. As you mention, distributed ids are a pain. The instant you start talking distributed, monotonic counters or orderable events (two threads count as distributed in this case), you need to talk things like Lamport clocks or other hybrid clock strategies. It's better to reach for the right tools in this case, vs half-baked monotonic-only-in-this-process vague guarantee.
comment 4y ago · link · parent
Currently if I want to use HTTP2/3, I have to fuss with openssl, self-signed certs (which never seems to work reliably for me), messing with /etc/hosts... it's always just painful for me for some reason.
comment 4y ago · link · parent
A map is not as easy of a concept in some ways (it's more abstract, you are taking N elements of X to N elements of Y). But a map is simpler than a for loop, because there is no state between steps: it's completely symmetrical.
The for-loop "complects" each iteration together, even if it's as little as incrementing an integer. It's a side effect, however trivial.
To kick it up a notch, now imagine a 2-D loop. Now we have 2 counters. If it's a 2-D array, each addressing operation interacts with 2 counters. But map just needs a second map chained on, and each map is completely "unaware" of the other map. You could map over N dimensions and each map is symmetrical, while the for loop needs an ever increasing number of counters. This slight difference in complexity shows how complexity compounds with other complexity.
comment 4y ago · link · parent
It's definitely a thing that exists, I've seen stackoverflow issues talking about working with containers that have these sorts of streams, but for some reason, I've scoured the net and haven't found almost anything about actually writing those streams.
comment 4y ago · link · parent
> if you telemetry isn't already packetized, you'll need to do that yourself. Converting your drone's telemetry into something that ffmpeg likes is generally non-trivial.
Yes, this is exactly the non-trivial step I'm struggling with. Let's say I have every time step a msgpack-encoded binary blob with a timestamp. I want to packetize it and pack it into a data stream of some timestamped/sequenced packet/page/atom structures. I might be able to build those packets myself manually if I can find a viable format (mkv and ogg seem the easiest to reason about).
And ultimately I do want to do this with real-time streams, but I'll definitely look at this Video Multiplexer to start with! That at least scratches the itch of archiving this data.
comment 4y ago · link · parent
comment 4y ago · link · parent
But `obj and obj.method()` really is not the same thing as `obj.map(method)`. "virtual Maybe container/box" is a nice idea, and does actually type-check with mypy (mostly), but you cannot actually compose it with other functions. The problem is, each time you do `obj and obj.method()`, you end up union-ing type(obj) and type(obj.method).
https://mypy-play.net/?gist=5b03d81a64453997984e448df9b889e7
main.py:40: note: Revealed type is "Union[__main__.User, None]"
main.py:41: note: Revealed type is "Union[__main__.User, None, builtins.float]"
main.py:42: note: Revealed type is "Union[__main__.User, None, builtins.float]"
main.py:43: note: Revealed type is "Union[__main__.User, None, builtins.float, builtins.str]"
True Maybe types are more precise. Maybe if the Mypy engine could be retooled to recognise the `obj and obj.method()` idiom as tantamount to `obj.map(method)`, this could be avoided.comment 4y ago · link · parent
It's really not the most compelling reason. I recently found a cleaner way that actually achieves identity-equality, which I think is a much better way of going about things. Not actually using it anywhere at the moment, but I think it's neat.
class Singleton(type):
def __init__(cls, name, bases, dict):
super(Singleton, cls).__init__(name, bases, dict)
cls.instance = None
def __call__(cls, *args, **kw):
if cls.instance is None:
cls.instance = super(Singleton, cls).__call__(*args, **kw)
return cls.instance
class MyClass(metaclass=Singleton):
...
class MySubclass(MyClass):
...
>>> MyClass() is MyClass()
True
>>> MySubclass() is MySubclass()
True
>>> MySubclass() is MyClass()
Falsecomment 4y ago · link · parent
How can I mux arbitrary data streams into a container? Let's say I have a drone and I want to stream audio, video, and some avionics telemetry.
I know FFMPEG can pass through data encoded, and it lists a few binary stream formats:
ffmpeg -codecs | grep '^ ..D' # shows all -c=d codecs
..D... bin_data binary data
..D... dvd_nav_packet DVD Nav packet
..D... epg Electronic Program Guide
..D... klv SMPTE 336M Key-Length-Value (KLV) metadata
..D... mpegts raw MPEG-TS stream
..D... otf OpenType font
..D... scte_35 SCTE 35 Message Queue
..D... timed_id3 timed ID3 metadata
..D... ttf TrueType font
But I have no idea how to pack some new data stream into the filtergraph.comment 4y ago · link · parent
Personally I'm a fan of dependency injection whenever possible. But borg pattern has gotten me out of a pinch (exactly) once.
comment 4y ago · link · parent
Optional[Foo] is same as Foo | None, meaning you can operate on foo with Foo's methods, except that if it's None, you get NoneType errors.
Maybe[Foo] is an actual container. You have to map over or unwrap it to operate on Foo.
The big difference is ergonomics/opinion. You can't actually map over Optional, so every time you wanna use it, you have to manually check if foo is not None. Whereas Maybe, you can operate generically over it. Some folks think "is not None" is better. Personally I hate NoneType errors in prod and find that much more painful than a bit of indirection.
comment 4y ago · link · parent
"How do you do it?"
"I read data sheets and a lot of wikipedia".
I already spend tons of time on wiki, so I started reading data sheets. And he was absolutely right, datasheets for components are often chock full of information on how to use them, often with recipe books for circuits that use them.
It's kinda bland and tedious but highly informative.
I think there is a bit more that goes into that (in particular a willingness to fry stuff, that's unavoidable in hardware, and MOUNTAINS of patience), but like software, it's pretty easy in today's day and age to teach yourself hardware stuff.
comment 4y ago · link · parent
>> this is a perfect example of how simpler code should be preferred _by default_ over complex code.
Extra emphasis on *by default*.
You are both on the same side of the coin. This is the essence of "premature optimization is the root of all evil". Simplicity should be the default. Once you know your implementation is solid, then you can go back and optimize.
TFA is quite contrived, but imagine a much more complex process. You see some code:
for i in loop:
foo[i] = myfunc(foo[i], bar[i])
You have to go in and dig into why exactly foo is being fed back in at every step. But if instead you saw: for i in loop:
foo[i] = myfunc(bar[i])
You immediately know you have more options at your disposal to optimize that loop. Further, the compiler immediately knows it has more options. Maybe this is a good option for automatic unrolling or Duff's device. Maybe you wanna send this to a gpu shader, or use a macro to parallelize the loop. But it's a lot harder to get to that point if your starting point is the complected, stateful one.