Better HN
topnewbestaskshowjobs
Log inSign up

ryanmjacobs

582 karma · joined Jan 31, 2015 (11y ago) · 156 submissions

notryan.com webfpga.io
Submissions

comment 1y ago · link · parent

Oh that's embarrassing -- you're right, the first example doesn't make sense. Kinda pointless actually haha

I use it for code like this:

  raw = IO.popen(%W[gzip -d -c -- #{path}]){_1.read}
  raw = IO.popen(%W[gzip -d -c], in: pipe){_1.read}
  raw = IO.popen(%W[git status --porcelain -- #{path}]){_1.read}
Useful because it eliminates /bin/sh footguns (e.g. `md5sum hello&world` forking or `~john` expanding), plus you get kernel.spawn() options. `open("| ...)` only made sense for the second example.

Anyway, I find "_1" more eye-pleasing than:

  IO.popen(%W[gzip -d -c #{path}]){|io| io.read}

comment 1y ago · link · parent

FYI, one of my favorite Ruby idioms is to capture command output with `open(...){_1.read}`

  pp open("|ls -lh /usr/bin/ls"){_1.read}
  "-rwxr-xr-x 1 root root 135K Aug 30 04:57 /usr/bin/ls\n"
or to quickly print tabular data

  open("|column -t -s \\t", "w"){_1 << tsv_data}

comment 1y ago · link · parent

Oh damn. I have been using `_1`, `_2`, etc. extensively for years... I didn't know about that footgun.

I'd like know if `it` is merely an alias for `_1`, or if protects from this "arity issue" too.

comment 1y ago · link · parent

I'm pleasantly surprised to see this improvement:

  Tempfile.create(anonymous: true) removes the created temporary file
  immediately. So applications don’t need to remove the file.
  [Feature #20497]
I use a similar pattern a lot:

  file = Tempfile.new.tap(&:unlink)
  file << "... some really large data to pipe"
  system("md5sum", in: file.tap(&:rewind))
It's a neat trick to leverage the filesystem for large amounts of data (e.g. "psql \copy" generation), without littering tempfiles everywhere. Once the last fd disappears, the filesystem releases the data; so you don't have to "trap" signals and add cleanup routines. (Hint: you can also use these unlinked-tempfiles for command output, e.g. huge grep output, etc.)

On Linux systems, `open(..., O_TMPFILE)` is typically used, which provides additional safety. The created file is initially unnamed (no race condition between `open` and `unlink`).

When I needed safety, my non-portable solution was to use Ruby's syscall feature. (Btw, I love that you can do this.)

  require "fcntl"

  SYS_OPEN   = 2
  O_TMPFILE  = 0x00410000
  O_RDWR     = Fcntl::O_RDWR

  def tmpfile
    mode = O_RDWR | O_TMPFILE
    fd = syscall(SYS_OPEN, "/dev/shm", mode, 0644)
    IO.for_fd(fd)
  end
But... Another pleasant surprise from the PR (https://bugs.ruby-lang.org/issues/20497).

  Linux 3.11 has O_TMPFILE to create an unnamed file.
  The current implementation uses it.
Excellent to see :) Makes the PR even better!

5.

FreeBSD: Fix frequency calcuation for bell (2021)(cgit.freebsd.org ↗)

3 points · by ryanmjacobs · 3y ago · 1 comment

6.

How Much Is Lattice Ice40 FPGA(ebics.net ↗)

2 points · by ryanmjacobs · 3y ago · discuss

comment 3y ago · link · parent

Rest in peace, Bram. I was introduced to Vim by my father when I was a kid, and have been using it for the past 15 years. Your software has touched many lives.

comment 3y ago · link · parent

I tried Mint. AFAIK Apple CC doesn't allowing pulling live transactions.

comment 3y ago · link · parent

Oh nice. This is a very useful tip. I wish I knew that a month ago.

comment 3y ago · link · parent

I had the same exact situation. I used the Apple card almost exclusively in 2022 because of the 1% card + 2% apple pay rewards.

Doing taxes right now and I spent about 10 minutes manually exporting+emailing OFX/QFX files to myself for Quicken. Kind of a pain. Every other card I have supports automatic data pulling.

Probably will move my main card to something that has automatic integration.

comment 3y ago · link · parent

Well written story. Worth the read.

12.

Null Island(en.wikipedia.org ↗)

1 points · by ryanmjacobs · 4y ago · discuss

13.

Is a Dataframe Just a Table? (2019) [pdf](drops.dagstuhl.de ↗)

3 points · by ryanmjacobs · 5y ago · discuss

comment 5y ago · link · parent

https://pbs.twimg.com/media/FBkA6ZrWEAA9olm?format=jpg&name=...

comment 5y ago · link · parent

I found out because my CircleCI jobs were failing to `npm install`. Guess the deploy will have to wait...

comment 5y ago · link · parent

Ah. Yeah, that's what I have been doing. It took about an hour to send 100G initial ZFS seed over the network between different datacenters. Then I suspended all of the VMs and sent the remaining incremental.

The --raw/-w flag does send the compressed data.

It always feels brittle to me because of how manual the process is. Maybe it's time to create some decent scripts with safe logic and checks...

comment 5y ago · link · parent

I've been doing this with several production PostgreSQL instances.

PostgreSQL on ZFS is great.

I have zstd compression enabled and I average 3.50x compression ratios.

(Probably some pretty awful CPU tradeoffs in there, but system load and query times seem fine. My database is 50 GB before zstd compression, so enabling it helps a ton.)

I also have ZFS snapshots taken hourly and shipped offsite. It's awesome that I don't need to pause PostgreSQL or anything to take the snapshot. It's atomic and instant.

comment 5y ago · link · parent

This is fantastic. I am definitely going to look into the blktrace calls. They look useful.

---

I've been looking for a way to copy virtual machine disks over the network with minimal downtime.

I.e. Copy the entire 50 GB disk over. Suspend the VM. Do a quick pass that picks up the changed blocks. Resume the VM.

Does anyone have a tool for that? It would be similar to how QEMU/KVM does it for VM migrations. (They only support doing it for RAM though.)

---

Also related, you can use the sysrq feature on Linux to remount the root file system as read-only. Then run `dd if=/dev/sda | ssh user@destination.com 'cat > sda.img'` to transfer the root partition consistently.

I've used this twice to migrate VPSs off of Cloud providers and onto my physical servers to convert to .qcow2 images. Worked perfectly :)

I'm not sure if you are required to reboot afterwards, but I always do. It would be nice to "un sysrq remount".

19.

Realistic Tom Cruise Deepfake – AI Tom Cruise(youtube.com ↗)

4 points · by ryanmjacobs · 5y ago · discuss

20.

Year 5 School Bachelor's Degree (2020)(blainsmith.com ↗)

2 points · by ryanmjacobs · 5y ago · discuss

comment 5y ago · link · parent

I'm 30 minutes north of Sacramento and can only get 2.5 Mbps from AT&T :/

Most of the time, I choose to use my cell phone as a hotspot in order to reliability video chat for work.

We are a 10 minute walk away from I-80, where there is plenty of underground fiber pulls...

We pay $60/month... Yay, AT&T!

comment 5y ago · link · parent

SEEKING WORK | REMOTE

Resume: https://notryan.com/resume.pdf

Anything *nix-related, infrastructure, and backend deployment.

comment 5y ago · link · parent

Location: Sacramento, CA

Remote: PREFERRED

Willing to relocate: YES (to Bay Area)

Technologies: PostgreSQL, C, linux, Node.js/TypeScript/React.js

Resume: https://notryan.com/resume.pdf

Email: ryan [at] rmj.us

---

I'm looking for a full-time role centered on infrastructure and metrics. Firmware development would be cool too! I have experience in insurance + FinTech + major PMS systems (Entrata, RealPage, Yardi).

Notable works:

* https://zfs.rent

* https://webfpga.com

comment 5y ago · link · parent

Aside, I really enjoy the stock image. Gotta love "<plist version="VIRUS"> front and center :)

comment 5y ago · link · parent

> For example, I've had fewer headaches using the regular Java Kafka bindings or JeroMQ than by using the "Clojure-ified" versions of these libraries.

As someone who is trying to decide how to interop Clojure + ZeroMQ, do you have any pointers for working with JeroMQ within Clojure?

Yesterday, I was browsing/evaluating the Clojure libraries for ZeroMQ, and all them haven't seen git pushes in the last three years and have between 10 and 120 stars on GitHub -- but JeroMQ has recent activity and >1.8k stars, so I'd like to stick with that for sake of support/documentation/etc.

--

(Caveat: ... not that GitHub stars are the best metric for quality... but they're not a terrible one...)

comment 5y ago · link · parent

All FPGA synthesis runs for https://webfpga.com are on Arch Linux based containers. There isn't a lot of traffic. We get around 5-10 synthesis runs per day from .edu accounts. It's been reliable, lightweight, and stable.

When developing the platform, we tried Ubuntu/Debian/CentOS, and at the time (about 1.5 years ago), Arch Linux was the most reliable OS for getting the 32-bit deps to work with existing commercial chains, and new toolchain compiles (IceStorm, NextPnr, etc). I think this is because Arch typically includes the development headers by default.

As long as the regression tests continue to pass, we will likely continue to roll with Arch Linux. We only tend to rebuild images once a month or so, since our backend is fairly feature complete already.

--

I think the trick is:

* Use containers, e.g. dockerhub's archlinux

* Assume that you will never be able to run pacman on a live system. Instead, rebuild a new image with a Dockerfile with your new packages -- then deploy that.

comment 5y ago · link · parent

Looks like they've got a solid team put together already :)

https://github.com/rocky-linux/organization/wiki/Contributin...

comment 5y ago · link · parent

Yes! I'm bookmarking this repo. As soon as there is a more concrete plan, I will definitely pledge my time to help out.

I hope we all learned our lesson on this one -- let's not get acquired by RedHat/IBM this time around :)

Three cheers for Kurtzer!

123456