HNHacker News
TopNewBestAskShowJobs

_paulc

208 karma · joined November 10, 2013

submissionscomments
_paulc··on Show HN: A Truly Modular Keyboard
Neat project, given how cheap the ch32v003 is there are lots of opportunities to do fun distributed things with them (assume you have seen bitluni’s projects [1]) - even if they aren’t really practical!

I didn’t see the ch32 firmware in the repository - the ch32v003 only has 1 i2c peripheral - assume you are bit-banging the others?

[1] https://www.youtube.com/@bitluni

_paulc··on The Rust on ESP Book
I’d completely agree - the transition to and instability of esp-hal has been a complete nightmare and I’ve also given up on trying to keep up with this.

I have transitioned to using the Nordic NRF chips (nrf52840) for my hobby projects which are very well supported by embassy-nrf and have been a pleasure to use and have great (and stable) BLE support. You can also get really cheap boards from AliExpress (search for nrf-micro).

_paulc··on Parsing semiconductor datasheets into structured register maps for under $0.25
Slightly strangely I did see that the .h export does contain temp / press registers (but not the trimming params) but they dont show up in the interactive display:

https://passtheaardvark-img.pgs.sh/screen.png

_paulc··on Parsing semiconductor datasheets into structured register maps for under $0.25
It shows the 0xD0, 0xD0, 0xF3, 0xF4, 0xF5 registers but misses 0xF7-F9 (pressure) and 0xFA-FC (temp) - which are the actual measurement registers - plus all the trimming parameters (0x88-xA1) which you need to calibrate the readings.

Temp (4.3.7) & Press (4.3.6) literally have their own sections in the datasheet.

_paulc··on Parsing semiconductor datasheets into structured register maps for under $0.25
This would be a good idea of it was reliable however browsing the parsed data for the BMP280 [1] (which in familiar with because I’ve written a driver for this) it looks like it misses a bunch of registers [2]

[1] https://regforge.dev/bmp280_xai_grok-4-1-fast-non-reasoning_... [2] https://www.bosch-sensortec.com/media/boschsensortec/downloa...

_paulc··on 1TB Raspberry Pi SSD on sale now for $70
If you need GPIO support on a mini-PC you can just use a cheap FT232H breakout [1] with either PyFTDI [2], which supports pretty much all the protocols you need (UART/GPIO/SPI/I2C), or alternatively use CircuitPython with Blinka [3] which gives you access to the CircuitPython drivers etc.

[1] https://www.adafruit.com/product/2264 [2] https://pypi.org/project/pyftdi/ [3] https://learn.adafruit.com/circuitpython-on-any-computer-wit...

_paulc··on Apple’s Darwin OS and XNU Kernel Deep Dive
> FreeBSD has committed the original sin of UNIX by deliberately dropping support for all non-Intel architectures, intending to focus on optimising FreeBSD for the Intel ISA and platforms.

FreeBSD supports amd64 and aarch64 as Tier 1 platforms and a number of others (RiscV, PowerPC, Arm7) as Tier 2

https://www.freebsd.org/platforms/

_paulc··on Pi Pico Rx – A crystal radio for the digital age?
It looks like it is a Direct Conversion (Zero IF) rather than a Direct Sampling Receiver [0] - ie. it uses does a quadrature LO to down convert to baseband I/Q (in this case a Taylor QSD as a mixer). The RP2040 ADC bandwidth is only 250KHz.

[0] https://www.analog.com/en/resources/technical-articles/a-rev...

_paulc··on Why laptop support, why now: FreeBSD's strategic move toward broader adoption
As a long term FreeBSD user (since 2.0) and advocate, my view is that FreeBSD should focus on its niche as a rock-solid server operating system. For most developers buying a MacBook and SSH-ing into a server is probably the right answer (or running a VM if you really need something local). The level of effort to match the MacBook user experience feels like a lost cause (Linux has been trying to do this for decades with significantly more resources) and it would feel more useful to use this funding to focus on the server side.
_paulc··on FreeBSD 14.0-Release
If you want to automate FreeBSD deployments on Hetzner Cloud you can try:

https://github.com/paulc/hcloud-freebsd

(Allows you to provision instances using either the hcloud utility/web uni with ssh key/user-data support)

_paulc··on Installing FreeBSD on Oracle Cloud
That's really useful (I was trying to work out how to do this without using a custom image) but I would just note that there actually is a FreeBSD 13.1 image available under Images -> Partner Images -> FreeBSD (from the FreeBSD Foundation).

Oracle Cloud have a very generous free-tier for the arm64 boxes and I'm running 2 x arm64 instances (2 CPU / 12GB RAM each) - been really reliable so far though I'm not doing that much on them.

_paulc··on Ask HN: CLI Tool for File Encryption?
If you want a simple lightweight symmetric crypt CLI utility try ccrypt:

http://ccrypt.sourceforge.net/

_paulc··on Self-calibrating USB Paper Tape Reader
The Colossus tape reader could read at c.5000 cps (with the tape running at 27mph [1]) - which is 2.5 x faster (and 20 years before). Worth seeing the replica Colossus at Bletchley if you get a chance.

[1] https://www.flickr.com/photos/martintomes/8751941628

_paulc··on What the Russian Invasion Has Done to Ukraine
Keep trying apparatchik - we’re not all as weak and stupid as you think.
_paulc··on What the Russian Invasion Has Done to Ukraine
6 day old account that has only posted Russian talking points - hmmmm
_paulc··on A toy DNS resolver
Simple python version which does a bit more validation (checks response matches query) and also supports CNAMEs and different record types (37 lines - using dnslib library) - though there is still a lot of logic missing (handling failed NSs, IPv6 only NSs, cycles etc)

    from dnslib import DNSRecord,DNSError,QTYPE
    
    ROOT_NS='198.41.0.4'
    
    def find_cname(a,qtype,cname):
        for r in a.rr:
            if QTYPE[r.rtype] == qtype and r.rname == cname:
                return str(r.rdata)
            elif QTYPE[r.rtype] == 'CNAME' and r.rname == cname:
                return find_cname(a,qtype,str(r.rdata))
        return resolve(str(r.rdata),qtype,ROOT_NS)
    
    def resolve(name,qtype='A',ns=ROOT_NS):
        print(f"dig -r @{ns} {name} {qtype}")
        q = DNSRecord.question(name,qtype)
        a = DNSRecord.parse(q.send(ns))
        if q.header.id != a.header.id:
            raise DNSError('Response transaction id does not match query transaction id')
        for r in a.rr:
            if QTYPE[r.rtype] == qtype and r.rname == name:
                return str(r.rdata)
            elif QTYPE[r.rtype] == 'CNAME' and r.rname == name:
                return find_cname(a,qtype,str(r.rdata))
        for r in a.ar:
            if QTYPE[r.rtype] == 'A':
                return resolve(name,qtype,str(r.rdata))
        for r in a.auth:
            if QTYPE[r.rtype] == 'NS':
                return resolve(name,qtype,resolve(str(r.rdata),'A',ROOT_NS))
        raise ValueError("Cant resolve domain")
    
    if __name__ == '__main__':
        import sys
        def get_arg(i,d):
            try: return sys.argv[i]
            except IndexError: return d
        print(resolve(get_arg(1,"google.com"), get_arg(2,"A"), get_arg(3,ROOT_NS)))
Disclaimer: I am author of dnslib [https://github.com/paulc/dnslib]

Edit: Better CNAME support

_paulc··on Why might you run your own DNS server?
dnslib author here - wasn’t expecting to see this so thanks for the reference.

Key thing I learnt writing dnslib (which was originally to provide a DNS API for an application) is that DNS is actually a very dynamic protocol but the complexity of mainstream servers like BIND makes it hard to do a lot of the things that you can actually do. There are a lot of problems (in particular in the service discovery space) which can be solved much more easily using DNS rather than inventing something separate.

As an aside if you want an authoritative DNS server I would look at KnotDNS [1] - you can avoid all the zone file cruft and interact with it using a sensible API. If you want to write a dynamic DNS app I would look at @miekg’s excellent Go library [2]

[1] https://www.knot-dns.cz/

[2] https://github.com/miekg/dns

_paulc··on A love letter to ISC bind
If you are looking for an authoritative DNS server with a sane API try KnotDNS [1]. Really easy to automate dynamic updates using `knotc` [2] without worrying about manually updating zone files.

[1] https://www.knot-dns.cz

[2] https://www.knot-dns.cz/docs/3.0/html/man_knotc.html

_paulc··on Tunnels in the US cost more than anywhere else
The more surprising point was the disparity in staffing levels which multiplies the cost differences:

“For example, in New York, the number of workers at the face of the tunnel can be up to four times the number of workers required in Germany or Austria for similar projects.”

_paulc··on Technical reasons to choose FreeBSD over GNU/Linux
I've been a FreeBSD user since 2.05 (1995) and a strong supporter - FreeBSD still excels as an ultra-stable 'old-school' UNIX server OS (which to be honest meets a lot of use-cases more simply than a lot of modern alternatives). That being said this sort of post isn't helpful as advocacy - as others have notes it is pretty shallow and to be honest most people are probably better off running Linux if this is what they are used to.
_paulc··on FreeBSD is an amazing operating system
To be honest it’s probably not worth running FreeBSD on a laptop/desktop - it’s really a server operating system. If you are looking for a well engineered, stable, ‘traditional’ UNIX system sitting in a rack and happy with a terminal interface it’s an amazing OS. Lots of people however seem to be trying out on laptops/desktops and being disappointed which isn't a huge surprise.

(FreeBSD user since 2.0.5 - 1995)

_paulc··on Hello World
As it's not on Drew's list:

Nim:

  $ cat hello.nim
  stdout.write("hello, world!\n")
Static (musl):

  $ nim --gcc.exe:musl-gcc --gcc.linkerexe:musl-gcc --passL:-static c -d:release hello.nim
  $ ldd ./hello
  not a dynamic executable

  Execution Time: 0m0.002s (real)
  Total Syscalls: 16
  Unique Syscalls: 8
  Size (KiB): 95K (78K stripped)
Dynamic (glibc):

  $ nim c -d:release hello.nim
  $ ldd ./hello
  linux-vdso.so.1 =>  (0x00007ffc994b6000)
  libdl.so.2 => /lib64/libdl.so.2 (0x00007f7c88785000)
  libc.so.6 => /lib64/libc.so.6 (0x00007f7c883b8000)
  /lib64/ld-linux-x86-64.so.2 (0x00007f7c88989000)

  Execution Time: 0m0.002s (real)
  Total Syscalls: 42
  Unique Syscalls: 13
  Size (KiB): 91K (79K stripped)
Which I think is actually pretty reasonable for a high-level GC'd language.
_paulc··on Age: A simple, modern and secure file encryption tool
This looks really good, I've used ccrypt (#1) for years as a simple Unix-y encryption tool to avoid the complexity of GPG (though this is symmetric encryption only so you need to have a secure way to exchange keys).

I just added a pull-request to allow the recipients flag to also be specified as a https:// or file:// URL - this is mostly useful to use the GitHub <user>.keys endpoint to grab user keys eg.

  ./age -a -r https://github.com/<user>.keys < secret
will encrypt using <user>'s GitHub SSH public keys.

#1 http://ccrypt.sourceforge.net

#2 https://github.com/FiloSottile/age/pull/43

_paulc··on The Adafruit PyGamer, a New Maker-Friendly Handheld Console
Also see the 32blit by Pimoroni:

https://www.kickstarter.com/projects/pimoroni/32blit-retro-i...

_paulc··on Debian developer revisits FreeBSD after 20 years (2015)
> I couldn’t get networking working

Try using the e1000 network adapter emulation - Win10/Server 2016 work fine with this.

_paulc··on Always start with simple solution
Actually this is pretty simple if you use ConfigParser properly:

  # test.ini
  [host1]
  ip = 1.2.3.4
  [host2]
  ip = 5.6.7.8
  [host3]
  ip = 9.10.11.12

  # config.py
  import configparser

  c = configparser.ConfigParser()
  c.read("test.ini")
  ips = [ c[host]['ip'] for host in c.sections() ]
_paulc··on Life in Unix V7: an attempt at a simple task
ed(1) is actually quite usable, I remember editing lots of documents using ed/troff at university in the early 80s as still occasionally drop into ed if I wasn't to do a small change to a simple txt file (I remember that using vi was frowned on as an egregious waste of memory)
_paulc··on Porting a historic Python2 module to Python3
This lines up with my experience. Strangely I had someone submit a bunch of slightly passive-aggressive "Py3 support" pull requests to a couple of my repos which were basically the result of running 2to3 on the code. They hadn't even bothered to run the unit tests (which obviously failed spectacularly). It did however prompt me to get Py3 support working properly which was actually a good thing.
_paulc··on Show HN: Alter – convert text/code to an image
http://acme.com/labelmaker/
_paulc··on Show HN: Dply – Free temporary Linux servers
Was just about to ask for this - thanks for supporting. Very cool service btw.
Page 1 of 3Next →