Better HN
topnewbestaskshowjobs
Log inSign up

azkae

32 karma · joined Mar 9, 2015 (11y ago) · 8 submissions

Submissions

1.

Why Collaborate with XAI?(github.com ↗)

10 points · by azkae · 1y ago · discuss

comment 1y ago · link · parent

I am using macher for small edits on a codebase with gptel: https://github.com/kmontag/macher

The package define a list of tools that gptel can use to inspect and edit a project. The tools are packaged as a preset so all you have to do is add "@macher" to your prompt to include the tools & update the system directive.

comment 5y ago · link · parent

You can already do this without pattern matching:

  from typing import Union, NoReturn
  
  class Foo:
      name: str
  
  class Bar:
      size: int
 
  Variant = Union[Foo, Bar]       # or `Foo | Bar` in Python 3.10
  
  def assert_never(x: NoReturn) -> NoReturn:
      # runtime error, should not happen
      raise Exception(f'Unhandled value: {x}')
  
  def tell(x: Variant):
      if isinstance(x, Foo):
          print(f'name is {x.name}')
      elif isinstance(x, Bar):
          print(f'name is {x.size}')
      else:
          assert_never(x)
mypy returns an error if you don't handle all cases.

comment 5y ago · link · parent

Yes this wraps subprocess.Popen in a nice API.

comment 5y ago · link · parent

Somewhat related, if you are looking to do scripts in Python you should take a look at `sh`:

  import sh
  print(sh.ifconfig("eth0"))
https://amoffat.github.io/sh/

comment 5y ago · link · parent

I use icecream [1] for the same purpose while debugging. It's really handy.

[1] https://github.com/gruns/icecream

7.

In PostgreSQL, as in life, don’t wait too long to commit (2015)(lerner.co.il ↗)

6 points · by azkae · 7y ago · discuss

comment 8y ago · link · parent

Scrolling with the trackpad seems way better by default, no more mouse-wheel-scroll-amount/mouse-wheel-progressive-speed hacks !