<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>til on Fernando Simões</title><link>https://frn.sh/til_/</link><description>Recent content in til on Fernando Simões</description><generator>Hugo</generator><language>en-US</language><copyright>Copyright © Fernando Simões.</copyright><lastBuildDate>Sun, 18 May 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://frn.sh/til_/index.xml" rel="self" type="application/rss+xml"/><item><title>writing to disk with O_SYNC</title><link>https://frn.sh/til_/osync/</link><pubDate>Sun, 18 May 2025 00:00:00 +0000</pubDate><guid>https://frn.sh/til_/osync/</guid><description>write(2) doesn&amp;rsquo;t actually write to disk imediatelly. Instead, it writes to a page cache and the OS periodically handles writes to disk. Using O_SYNC, though, write(2) returns only when it fully wrote the data to a data block. Linux exposes the actual timeframe for periodic writings:
➜ ~ cat /proc/sys/vm/dirty_writeback_centisecs 500</description></item><item><title>source and export diff</title><link>https://frn.sh/til_/source-and-export/</link><pubDate>Sun, 05 Jan 2025 00:00:00 +0000</pubDate><guid>https://frn.sh/til_/source-and-export/</guid><description>Non-interactive shells don&amp;rsquo;t load initialization files, so bash -c &amp;lsquo;declare -f&amp;rsquo; doesn&amp;rsquo;t output anything. But we can source it: bash -c &amp;lsquo;source ~/.bashrc; hello&amp;rsquo;. Or even: bash -c &amp;lsquo;hello() { echo &amp;ldquo;hi&amp;rdquo;; }; declare -f&amp;rsquo;. It&amp;rsquo;s all about memory share in shell modes: source changes only affect current shell memory. export marks variables to be passed to child processes. Subtile difference that can save us a lof of debugging time.</description></item></channel></rss>