ryanmjacobs
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} 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}I'd like know if `it` is merely an alias for `_1`, or if protects from this "arity issue" too.
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!How Much Is Lattice Ice40 FPGA
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.
Null Island
Is a Dataframe Just a Table? (2019) [pdf]
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...
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.
---
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 [email protected] '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".
Realistic Tom Cruise Deepfake – AI Tom Cruise
Year 5 School Bachelor's Degree (2020)
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!
Resume: https://notryan.com/resume.pdf
Anything *nix-related, infrastructure, and backend deployment.
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:
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...)
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.
https://github.com/rocky-linux/organization/wiki/Contributin...
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!
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.