HNHacker News
TopNewBestAskShowJobs

ryanmjacobs

582 karma · joined January 31, 2015

notryan.com webfpga.io
submissionscomments
ryanmjacobs··on Ruby 3.4 Highlights
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}
ryanmjacobs··on Ruby 3.4 Highlights
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}
ryanmjacobs··on Ruby 3.4 Highlights
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.

ryanmjacobs··on Ruby 3.4 Highlights
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!
ryanmjacobs··on Bram Moolenaar has died
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.
ryanmjacobs··on Apple, Goldman Sachs Debut Savings Account with 4.15% Annual Yield
I tried Mint. AFAIK Apple CC doesn't allowing pulling live transactions.
ryanmjacobs··on Apple, Goldman Sachs Debut Savings Account with 4.15% Annual Yield
Oh nice. This is a very useful tip. I wish I knew that a month ago.
ryanmjacobs··on Apple, Goldman Sachs Debut Savings Account with 4.15% Annual Yield
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.

ryanmjacobs··on Human_fallback
Well written story. Worth the read.
ryanmjacobs··on OVH is down along with its status page
https://pbs.twimg.com/media/FBkA6ZrWEAA9olm?format=jpg&name=...
ryanmjacobs··on [dead]
I found out because my CircleCI jobs were failing to `npm install`. Guess the deploy will have to wait...
ryanmjacobs··on Imaging mounted disk volumes under duress
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...

ryanmjacobs··on Imaging mounted disk volumes under duress
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.

ryanmjacobs··on Imaging mounted disk volumes under duress
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".

ryanmjacobs··on 90-year-old man spends $10k on 2 ads in WSJ to tell AT&T CEO about slow internet
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!

ryanmjacobs··on Ask HN: Freelancer? Seeking freelancer? (January 2021)
SEEKING WORK | REMOTE

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

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

ryanmjacobs··on Ask HN: Who wants to be hired? (January 2021)
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

ryanmjacobs··on Chef cofounder on CentOS: It’s time to open source everything
Aside, I really enjoy the stock image. Gotta love "<plist version="VIRUS"> front and center :)
ryanmjacobs··on The Future of Clojure
> 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...)

ryanmjacobs··on Ask HN: Is anyone using ArchLinux for server production environments?
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.

ryanmjacobs··on Rocky Linux: Community enterprise OS compatible with RHEL
Looks like they've got a solid team put together already :)

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

ryanmjacobs··on Rocky Linux: Community enterprise OS compatible with RHEL
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!

ryanmjacobs··on CentOS Project shifts focus to CentOS Stream
Well this sucks... IBM/RedHat is really shooting themselves in the foot here. Stable CentOS versions have always been my go-to for VPS services. Install it once and you're good -- plus no Ubuntu snap stuff... I have 5+ CentOS 8 installs and I was really banking on the LTS timeline. I wish they would have kept that going alongside their CentOS 7 support.

I'm debating whether or not to downgrade to CentOS 7 to at least keep going until 2024, instead of 2021 with CentOS 8.

Hopefully, some other player steps up and creates a similar offering.

Also, I've been irked lately about them deprecating virt-manager and pushing podman. I don't mind alternatives, just keep the feature parity when you switch. Cockpit is fairly limited compared to virt-manager.

ryanmjacobs··on Show HN: Zfs.rent
Hahaha no I have several sites running with that Let's Encrypt cert. I'm working on separating them out, but until I get my DNS Let's Encrypt process automated, I'm just extending the cert via certbot.sh :/
ryanmjacobs··on Achieving 100Gbps intrusion prevention on a single server
shameless plug... https://webfpga.com isn't bad if you're looking to get your feet wet with FPGA dev
ryanmjacobs··on Show HN: Please-unsubscribe.com – fwd emails to unsubscribe from marketing
That's a fair point. I added an update to the Privacy section. I really don't care about these spam emails, plus Gsuite only offers 30 GB for the plan I purchased. After processing, the emails will be sent to Gmail's trash, which is cleared every 30 days.
ryanmjacobs··on Show HN: Please-unsubscribe.com – fwd emails to unsubscribe from marketing
Yeah, Gmail is nice because it shows a little gray unsubscribe link that they pluck out. I use Thunderbird with Protonmail and it doesn't have that... and I really don't want to go back to Gmail :/
ryanmjacobs··on Show HN: Please-unsubscribe.com – fwd emails to unsubscribe from marketing
Whoops. I didn't realize that "Launch HN" indicated it originated from YC. I'd change it, but I don't think I can.
ryanmjacobs··on Show HN: Please-unsubscribe.com – fwd emails to unsubscribe from marketing
That's a fair point. I didn't realize they embedded login links, unless you explicitly do something.

For example with now.sh/Vercel: https://vercel.com/login?with-email=1

I'll probably create rules that sends a blacklist of emails to the trash and warns the user.

ryanmjacobs··on Show HN: Please-unsubscribe.com – fwd emails to unsubscribe from marketing
Yeah it's done on a virtual machine that logs screenshots once a second for auditing purposes.
Page 1 of 4Next →