@emattiza@hachyderm.io avatar

emattiza

@emattiza@hachyderm.io

Sr Software Engineer @ Axuall. Python, Typescript, Vue3, React, and any thing that lets me use FP. Spare time Rust and Purescript.

This profile is from a federated server and may be incomplete. Browse more on the original instance.

brianb, to python
@brianb@fosstodon.org avatar

Is there a better interface for interacting with the breakpoint() debugger in a script rather than use c/n to go line by line?

emattiza,
@emattiza@hachyderm.io avatar

@brianb I like pudb personally https://documen.tician.de/pudb/starting.html otherwise launching with debugpy listening on 5678 is another way, and then use a DAP client

simon, to random
@simon@simonwillison.net avatar

I find the etiquette of Calendly (and other appointment booking things) really interesting

I've heard some people are offended by the suggestion that they use that to book a slot rather than doing a back-and-forth to find the right time for both parties

I see it as respectful of my time when someone suggests Calendly rather than having us back-and-forth over several cycles

I'd love to understand this dynamic more

emattiza,
@emattiza@hachyderm.io avatar

@simon Ive got a former boss running a startup that goes after this with conversational ai. Pretty tough social problem to get at with tech tools.

dabeaz, to random
@dabeaz@mastodon.social avatar

A bit disappointed...

>>> exc = ValueError("Bad Value")
>>> match exc:
... case ValueError(msg):
... print("Failed:", msg)
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
TypeError: ValueError() accepts 0 positional sub-patterns (1 given)
>>>

emattiza,
@emattiza@hachyderm.io avatar

@dabeaz exc.args is right there too. Just a juicy match_args def on Exception away...

dabeaz, to random
@dabeaz@mastodon.social avatar

Welp, kid managed to get a drone stuck about 50ft up in a tree. Thus, further reconfirming my earlier claim (prior to him wasting his money on it) that drones are, in fact, the worst toy in the whole toy universe.

emattiza,
@emattiza@hachyderm.io avatar

@dabeaz Or just repurpose cat rescue into drone rescue https://youtu.be/venq2wwhlSY?si=4XurjxStJgoO9Nys

lpil, to random
@lpil@hachyderm.io avatar

If NixOS folks want to limit the access of some bit of software would they run it in an OCI/docker container or use some other approach?

emattiza,
@emattiza@hachyderm.io avatar

@lpil Theres quite a bit of systemd lockdown you can do? Containers are a good alternative as well

secana, to random
@secana@mastodon.social avatar

You should think that adding a local flake.nix with a package to home-manager and install the package is trivial. I'm trying for two hours but still no progress... Sometimes is frustrating.

emattiza,
@emattiza@hachyderm.io avatar

@secana Builtins has getFlake https://nixos.org/manual/nix/stable/language/builtins.html#builtins-getFlake, but youll have to get a handle on system too to grab the right package

aires, to NixOS
@aires@tiggi.es avatar

Question for the smarter and people: is there an easy way to pin a package to a specific version? All I want to do is downgrade hugo from v0.124 to v0.123.8.

Right now I've got like a dozen tabs open with a bunch of convoluted answers involving overrides and custom builds. The most "straightforward" method I've seen so far is using builtins.fetchGit to reference a specific commit, but it's apparently cloning the entire nixpkgs repo, which seems excessive. Any suggestions? Thanks in advance!

emattiza,
@emattiza@hachyderm.io avatar

@aires An overlay with a custom pinned pull is your best bet here

emattiza,
@emattiza@hachyderm.io avatar

@aires Heres the pr on nixpkgs that made the update. You could lock your total nixpkgs to the parent of this one https://github.com/NixOS/nixpkgs/commit/254540aaf5d51db806783953628d497cc622e0dd

emattiza,
@emattiza@hachyderm.io avatar

@aires To find this stuff, i usually use search.nixos.org, and then click on the source to go to the github url for the derivation, then git blame the version line to find a nixpkgs rev that gets the job done. An overlay though is the only way to keep the single package pinned while the rest of the repo is current

mgattozzi, to random
@mgattozzi@hachyderm.io avatar

After almost 9 years of Rust I've come to the conclusion that it's not just the way we write errors that's bad, it's also that Result guides us towards bad error handling and ? Makes it worse (handle my error? No just chuck it up the stack) I just need to write a post soon huh

I also think thiserror and anyhow are detrimental to good error handling as well and I'm guilty of doing this. The easy way to write error handling is the bad way to write good robust tools and programs

emattiza,
@emattiza@hachyderm.io avatar

@mgattozzi Validation monad on nightly when? Axum form handling and error return always bugs me around single valued errors

chrism, to NixOS
@chrism@chattingdarkly.org avatar

Is there some flake out there that will build a relatively recent NixOS ISO for a Raspberry Pi Zero W?

emattiza,
@emattiza@hachyderm.io avatar

@chrism https://github.com/pete3n/nix-pi/tree/main for the zero 2 w. most of the dtb's are in tree in nixpkgs, so you may need to swap some linuxPackages definitions.

webology, to random
@webology@mastodon.social avatar

🤔 CSS has always felt closer to Lisp or Haskell than Python or a non-functional language. Just me or has anyone else had these thoughts?

emattiza,
@emattiza@hachyderm.io avatar

@webology Definitely a declarative feel to it. Expression support is only growing that lisp-ness

mgattozzi, to random
@mgattozzi@hachyderm.io avatar

Let me into the compiler driver seat so I can impl Div on PathBuf you cowards

https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=c188dc2c778f624b5b74ed95f050586e

emattiza,
@emattiza@hachyderm.io avatar

@mgattozzi My Pathlib python brain enjoys this deeply

markwalker, to django
@markwalker@fosstodon.org avatar

Is there a way to count the number of queries in tests if you're using django's regular built in testcase?

I'm too used to pytest these days 🤔

emattiza,
@emattiza@hachyderm.io avatar

@markwalker You can import CaptureQueriesContext from django.test.utils (assertNumQueries uses this indirectly). Give it a grep on the django github repo and youll find some tests which show a bit how to use it over a connection import.

yosh, to random
@yosh@toot.yosh.is avatar

Is there anything resembling a universal hardware interface for like, industrial devices?

I’m thinking: I like the idea of the convenience networked appliances can provide far more than any actual implementation I’ve ever seen. And that’s usually because of the tight coupling between the appliance and its network components. Which means your internet-connected washer or whatever is destined to eventually become e-waste. I really dislike that!

emattiza,
@emattiza@hachyderm.io avatar

@yosh These are normally fieldbus technologies in the industrial space, and involve home runs of serial or parallel comms.

I only have bad news to report though in that a lot of fieldbus tech is modernizing on using ethernet for fieldbus connectivity (and even wifi).

grahamboree, to python
@grahamboree@mastodon.gamedev.place avatar

Super "fun" bug: groupby in itertools ostensibly groups items by the result of a key function, however it just groups similar sequential items in the input list. You can't safely use it directly to build a dictionary. It will silently drop some of your items.

>>> data = ['aa', 'bbb', 'cc']
>>> grouped = {k: list(v) for k, v in groupby(data, key=len)}
>>> print(grouped)
{2: ['cc'], 3: ['bbb']}

emattiza,
@emattiza@hachyderm.io avatar

@grahamboree Its documented in the 2nd paragraph of the docs for it, but definitely a watch out for folks. https://docs.python.org/3/library/itertools.html#itertools.groupby

pinkcreeper100, to NixOS
@pinkcreeper100@akko.wtf avatar

I don’t understand what I’m doing wrong :neofox_googly_shocked:

the code

emattiza,
@emattiza@hachyderm.io avatar

@pinkcreeper100 @novenary You can add this before the inputs to add to the flake any needed caches. https://github.com/emattiza/neovim-flake/blob/main/flake.nix#L3-L6

emattiza,
@emattiza@hachyderm.io avatar

@pinkcreeper100 @novenary I say that like order matters, it really just needs to be top level attr of the flake attr set along with inputs and outputs.

nobodyinperson, to vim
@nobodyinperson@fosstodon.org avatar

Idea: bundling your cli $EDITOR (:vim: :emacs: whatever) into a one-file static binary ( whatever) that you can take with you and will work everywhere, with all plugins and configs already set up. Alternatively as a :nixos: of course, though that's not so easily portable to systems where you don't have root access and the admins don't want to install

emattiza,
@emattiza@hachyderm.io avatar

@nobodyinperson I do something similar with an old fork of neovim-flake. Nix-portable is a great aid in this, and i even publish a docker image for that runtime option too. Happy to see if i can publish an appImage? https://github.com/emattiza/neovim-flake/

emattiza,
@emattiza@hachyderm.io avatar

@nobodyinperson And i just bundled an appimage with nix bundle --bundler github:ralismark/nix-appimage github:emattiza/neovim-flake/main. No idea if im doing it totally right though or how cross system it is.

beausimensen, to golang
@beausimensen@phpc.social avatar

Has anyone worked with , (with or without nix-shell), and GoLand?

My first passes at researching this doesn't show me many promising results. Some vscode discussion suggest launching vscode from the CLI after entering the shell.nix-enabled project directory, but not sure how I feel about that.

emattiza,
@emattiza@hachyderm.io avatar

@beausimensen preCheck is helpful for the pure environment nix runs checkPhase in (so doesnt have getent and some other standard linux cli tools), passthru is just for nixpkgs maintenance. here's the derivation in nixos/nixpkgs https://github.com/NixOS/nixpkgs/blob/nixos-23.11/pkgs/tools/misc/otel-cli/default.nix#L27

emattiza,
@emattiza@hachyderm.io avatar

@beausimensen honestly, i set vendorHash = pkgs.fakeSha256 a lot and do repeated builds to tell me what the hash should be. it should only change when the the sum file changes, the details are in the builder here https://github.com/NixOS/nixpkgs/blob/nixos-23.11/pkgs/build-support/go/module.nix

emattiza,
@emattiza@hachyderm.io avatar

@beausimensen also, nix repl is your friend for finding things out, and using :lf contrib/# will load all the attributes from the flake so you can look at them and see what is what

emattiza,
@emattiza@hachyderm.io avatar

@beausimensen there are ... oddities about how you would go about prefetching that info. i remember a couple years ago cmickens got it sorted, but that method above (faking hashes and setting it right while monitoring diffs of mods and sums for weird/malicious dep changes) is good enough and quick enough to not worry about getting fancy

emattiza,
@emattiza@hachyderm.io avatar

@beausimensen Nvm, see here. Just a custom fetcher provided you have a package derivation already. Thanks cole and friends! https://github.com/msteen/nix-prefetch/issues/3#issuecomment-876771025

  • All
  • Subscribed
  • Moderated
  • Favorites
  • anitta
  • mdbf
  • magazineikmin
  • Durango
  • Youngstown
  • vwfavf
  • slotface
  • ngwrru68w68
  • khanakhh
  • rosin
  • kavyap
  • thenastyranch
  • PowerRangers
  • DreamBathrooms
  • Leos
  • ethstaker
  • hgfsjryuu7
  • osvaldo12
  • cubers
  • GTA5RPClips
  • modclub
  • InstantRegret
  • everett
  • tacticalgear
  • normalnudes
  • tester
  • cisconetworking
  • provamag3
  • All magazines