<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Chris Yau</title>
    <description>The latest articles on DEV Community by Chris Yau (@calculatornow).</description>
    <link>https://dev.to/calculatornow</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4235615%2F028c38e9-24a5-4edb-9f84-7a9ba7e96974.png</url>
      <title>DEV Community: Chris Yau</title>
      <link>https://dev.to/calculatornow</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/calculatornow"/>
    <language>en</language>
    <item>
      <title>Napkin math for engineers: SLAs, p99s, bits and RAID (with worked examples)</title>
      <dc:creator>Chris Yau</dc:creator>
      <pubDate>Mon, 16 Nov 2026 11:49:58 +0000</pubDate>
      <link>https://dev.to/calculatornow/napkin-math-for-engineers-slas-p99s-bits-and-raid-with-worked-examples-1a40</link>
      <guid>https://dev.to/calculatornow/napkin-math-for-engineers-slas-p99s-bits-and-raid-with-worked-examples-1a40</guid>
      <description>&lt;p&gt;Most of the maths in my working week isn't hard. It's the kind you do on a napkin in the middle of a design review or an incident call: how much downtime does this SLA actually allow, is the p99 really that bad, how many bits do these IDs need, how much of this disk array can I actually use?&lt;/p&gt;

&lt;p&gt;I build &lt;a href="https://calculator.now/" rel="noopener noreferrer"&gt;Calculator.now&lt;/a&gt;, so I'm biased. Still, these are five pages I genuinely keep open for that kind of quick sanity check, with a worked example for each. I checked every number below by hand or in Python.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Turning "three nines" into minutes
&lt;/h2&gt;

&lt;p&gt;An SLA percentage means nothing to me until I see it as time. When someone says "we promise 99.9%", the question that matters is how many minutes of outage that buys you before the credits kick in.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://calculator.now/uptime-calculator/" rel="noopener noreferrer"&gt;uptime and SLA downtime calculator&lt;/a&gt; works in both directions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Allowed downtime:&lt;/strong&gt; enter a target percentage and pick a period (hour, day, week, 30-day month, 90-day quarter, 365-day year, or a custom span).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Actual uptime:&lt;/strong&gt; enter how long you were down (days, hours, minutes, seconds) and it gives you the availability you really delivered.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The formula is simply &lt;code&gt;downtime = period × (1 − uptime/100)&lt;/code&gt;. Some numbers worth remembering:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Target&lt;/th&gt;
&lt;th&gt;Period&lt;/th&gt;
&lt;th&gt;Allowed downtime&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;99.9%&lt;/td&gt;
&lt;td&gt;30 days&lt;/td&gt;
&lt;td&gt;43 min 12 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;99.95%&lt;/td&gt;
&lt;td&gt;30 days&lt;/td&gt;
&lt;td&gt;21 min 36 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;99.99%&lt;/td&gt;
&lt;td&gt;30 days&lt;/td&gt;
&lt;td&gt;about 4 min 19 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;99.9%&lt;/td&gt;
&lt;td&gt;90 days&lt;/td&gt;
&lt;td&gt;2 h 9 min 36 s&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Going the other way, one hour of downtime in a 30-day month comes out at 99.86%. That's already below three nines.&lt;/p&gt;

&lt;p&gt;Two things catch people out. First, the "Month" option is exactly 30 days. If your contract counts calendar months, use the custom period. Second, availabilities multiply when services depend on each other. A service at 99.9% that relies on a database at 99.95% can't promise better than 0.999 × 0.9995 ≈ 99.85%, which is roughly 65 minutes a month. I work that part out separately and then feed the result back into the calculator to see it as minutes.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Why your p99 matters more than your average
&lt;/h2&gt;

&lt;p&gt;Averages hide the tail. Here are 20 response times (in ms) from a hypothetical endpoint:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;112 118 121 125 127 130 133 136 140 142
145 149 153 158 164 171 188 240 410 1250
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The mean is 215.6 ms, which suggests things are "fine-ish". But most requests finish in under 175 ms, and one user waited more than a second. No single average describes both of those facts.&lt;/p&gt;

&lt;p&gt;Paste the list into this &lt;a href="https://calculator.now/percentile-calculator/" rel="noopener noreferrer"&gt;percentile calculator for latency data&lt;/a&gt; (it accepts comma-, space- or line-separated input), ask for &lt;code&gt;50, 90, 95, 99&lt;/code&gt; all at once, and choose a method. That last step matters more than you might expect, because the page offers several definitions:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Percentile&lt;/th&gt;
&lt;th&gt;Nearest rank&lt;/th&gt;
&lt;th&gt;Linear interpolation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;p50&lt;/td&gt;
&lt;td&gt;142&lt;/td&gt;
&lt;td&gt;143.5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;p90&lt;/td&gt;
&lt;td&gt;240&lt;/td&gt;
&lt;td&gt;257&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;p95&lt;/td&gt;
&lt;td&gt;410&lt;/td&gt;
&lt;td&gt;452&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;p99&lt;/td&gt;
&lt;td&gt;1250&lt;/td&gt;
&lt;td&gt;1090.4&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Same data, different p99. With only 20 samples, "p99" really just means "the worst one or two requests", and the method you pick changes the answer by about 160 ms. So when two dashboards disagree, check which percentile definition each one uses before you blame the code. And collect more samples before you trust a tail percentile. The page can also show its working step by step, which is handy when you need to explain the number to someone else.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. log₂ is the developer's favourite logarithm
&lt;/h2&gt;

&lt;p&gt;A lot of "how big / how many" questions are really base-2 logarithms in disguise. The &lt;a href="https://calculator.now/log-base-2-calculator/" rel="noopener noreferrer"&gt;log base 2 tool&lt;/a&gt; gives the decimal value and can show its steps. It also lists a few computing interpretations, including the maximum number of comparisons a binary search needs (&lt;code&gt;floor(log₂ n) + 1&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Quick examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Binary search over 1,000,000 sorted items:&lt;/strong&gt; log₂(1,000,000) ≈ 19.93, so at most &lt;strong&gt;20 comparisons&lt;/strong&gt;. A billion items? log₂ ≈ 29.9, so &lt;strong&gt;30&lt;/strong&gt;. That's why I'm happy to binary search almost anything.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;How many bits for 50,000 distinct IDs?&lt;/strong&gt; log₂(50,000) ≈ 15.61. Round up and you need &lt;strong&gt;16 bits&lt;/strong&gt;, which fits in a &lt;code&gt;uint16&lt;/code&gt; (65,536 values).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Exact powers come out clean:&lt;/strong&gt; log₂(65,536) is exactly 16. That's a handy check that a buffer or table size really is a power of two.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Seeing flags and masks bit by bit
&lt;/h2&gt;

&lt;p&gt;Bit flags are compact and fast, and easy to get subtly wrong. When I'm debugging a mask, I want to see the bits lined up, not juggle them in my head. The &lt;a href="https://calculator.now/bitwise-calculator/" rel="noopener noreferrer"&gt;AND/OR/XOR bitwise playground&lt;/a&gt; takes two inputs in decimal, binary, hex or octal and runs AND, OR, XOR, NOT, left shift, right shift or unsigned right shift. It shows the result in every base, with an optional bit-by-bit table.&lt;/p&gt;

&lt;p&gt;Say a status byte is &lt;code&gt;10110110&lt;/code&gt; (182 in decimal) and bit 3 (value 8, &lt;code&gt;00001000&lt;/code&gt;) means "cache enabled":&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Test it:&lt;/strong&gt; &lt;code&gt;10110110 AND 00001000&lt;/code&gt; = &lt;code&gt;00000000&lt;/code&gt;, so the flag is &lt;strong&gt;off&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Set it:&lt;/strong&gt; &lt;code&gt;10110110 OR 00001000&lt;/code&gt; = &lt;code&gt;10111110&lt;/code&gt; = 190 = &lt;code&gt;0xBE&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grab the low nibble:&lt;/strong&gt; &lt;code&gt;182 AND 0x0F&lt;/code&gt; = &lt;code&gt;0110&lt;/code&gt; = 6.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Build a mask:&lt;/strong&gt; &lt;code&gt;1 &amp;lt;&amp;lt; 5&lt;/code&gt; = &lt;code&gt;00100000&lt;/code&gt; = 32.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A practical tip: choose 8- or 16-bit width for this kind of work. The width setting truncates results, which is exactly what you want when you're modelling a byte or a 16-bit register.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. How much of that array can I actually use?
&lt;/h2&gt;

&lt;p&gt;"Six 8 TB drives" sounds like 48 TB until you choose a RAID level. The &lt;a href="https://calculator.now/raid-calculator/" rel="noopener noreferrer"&gt;RAID capacity planner&lt;/a&gt; covers RAID 0, 1, 5, 6, 10 and JBOD. You give it the drive count and size (GB or TB), plus optional per-drive read/write speed and IOPS, and it reports usable capacity, fault tolerance, space efficiency and estimated performance. There's also a file-system overhead field, which defaults to 5%.&lt;/p&gt;

&lt;p&gt;For 6 × 8 TB:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Level&lt;/th&gt;
&lt;th&gt;Usable (before overhead)&lt;/th&gt;
&lt;th&gt;After 5% overhead&lt;/th&gt;
&lt;th&gt;Survives&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;RAID 5&lt;/td&gt;
&lt;td&gt;40 TB&lt;/td&gt;
&lt;td&gt;38 TB&lt;/td&gt;
&lt;td&gt;1 drive failure&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RAID 6&lt;/td&gt;
&lt;td&gt;32 TB&lt;/td&gt;
&lt;td&gt;30.4 TB&lt;/td&gt;
&lt;td&gt;2 drive failures&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RAID 10&lt;/td&gt;
&lt;td&gt;24 TB&lt;/td&gt;
&lt;td&gt;22.8 TB&lt;/td&gt;
&lt;td&gt;1 drive per mirror pair&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Two caveats. The performance figures are simple multiples of your single-drive numbers, so treat them as a rough ceiling, not a benchmark. And drive makers sell decimal terabytes, while many operating systems report binary units: an "8 TB" drive is about 7.28 TiB. The page makes the point I'd make too: RAID protects you from a dead disk, not from &lt;code&gt;rm -rf&lt;/code&gt; or ransomware. Keep backups.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping up
&lt;/h2&gt;

&lt;p&gt;None of this is hard maths. It's just maths that's easy to fumble at 2 a.m. or halfway through a meeting. What I like about having these as bookmarks is that they show their working, so I can check the answer instead of just trusting it.&lt;/p&gt;

&lt;p&gt;If there's an engineering calculation you keep redoing by hand, tell me in the comments. I'd like to know what to build next.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Chris Yau, founder of Calculator.now&lt;/em&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>sre</category>
      <category>programming</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Handy calculators for developers: chmod, CIDR, hex, Unix time and more</title>
      <dc:creator>Chris Yau</dc:creator>
      <pubDate>Mon, 09 Nov 2026 17:31:09 +0000</pubDate>
      <link>https://dev.to/calculatornow/handy-calculators-for-developers-chmod-cidr-hex-unix-time-and-more-3f7h</link>
      <guid>https://dev.to/calculatornow/handy-calculators-for-developers-chmod-cidr-hex-unix-time-and-more-3f7h</guid>
      <description>&lt;p&gt;I'm Chris Yau, and I built &lt;a href="https://calculator.now/" rel="noopener noreferrer"&gt;Calculator.now&lt;/a&gt;, a free site with a large collection of online calculators. Most of the site is personal finance, health and school maths, but there's a corner of it I use every week as a developer: the tech calculators.&lt;/p&gt;

&lt;p&gt;None of these do anything you couldn't do with a shell one-liner. When I'm on a deploy call, reviewing a Terraform plan or answering "why is this file 403-ing?", I just want the answer &lt;em&gt;and&lt;/em&gt; the working on one screen, so I can paste it into a ticket. Here are six I use most, with a worked example for each and a snippet you can use to check the result yourself.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. chmod: octal ⇄ symbolic ⇄ binary
&lt;/h2&gt;

&lt;p&gt;Every permission digit is just three bits: read = 4, write = 2, execute = 1. Add them up per class (owner, group, others) and you've got the octal mode.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Worked example:&lt;/strong&gt; a config file the app user can edit, its group can read, and nobody else can touch.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Class&lt;/th&gt;
&lt;th&gt;r&lt;/th&gt;
&lt;th&gt;w&lt;/th&gt;
&lt;th&gt;x&lt;/th&gt;
&lt;th&gt;Sum&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Owner&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Group&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Others&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;So it's &lt;code&gt;640&lt;/code&gt;, or &lt;code&gt;rw-r-----&lt;/code&gt;, or &lt;code&gt;u=rw,g=r,o=&lt;/code&gt; in symbolic form.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;640 config/app.env
&lt;span class="nb"&gt;stat&lt;/span&gt; &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s1"&gt;'%a %A'&lt;/span&gt; config/app.env   &lt;span class="c"&gt;# 640 -rw-r-----&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;a href="https://calculator.now/chmod-calculator/" rel="noopener noreferrer"&gt;chmod calculator&lt;/a&gt; lets you work from checkboxes, symbolic notation (&lt;code&gt;u=rwx,g=rx,o=r&lt;/code&gt;) or a 3- or 4-digit octal number. It gives you the &lt;code&gt;chmod&lt;/code&gt; command ready to copy, plus the binary form (&lt;code&gt;110 100 000&lt;/code&gt;) and an &lt;code&gt;rwx&lt;/code&gt; visual. It also handles SUID, SGID and the sticky bit, and has one-click presets for 755, 644, 700, 600 and the rest. The binary view helps when you're explaining to a junior dev why &lt;code&gt;777&lt;/code&gt; is a bad idea.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. CIDR blocks and subnets
&lt;/h2&gt;

&lt;p&gt;Every time I have to size a VPC subnet I end up re-deriving the same formula:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;total addresses = 2^(32 − prefix)
usable hosts    = 2^(32 − prefix) − 2   (except /31 and /32)
network         = IP AND mask
broadcast       = network OR wildcard
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Worked example:&lt;/strong&gt; &lt;code&gt;10.20.0.0/22&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Subnet mask: &lt;code&gt;255.255.252.0&lt;/code&gt; (wildcard &lt;code&gt;0.0.3.255&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Total addresses: 2^10 = &lt;strong&gt;1,024&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Usable hosts: &lt;strong&gt;1,022&lt;/strong&gt; (&lt;code&gt;10.20.0.1&lt;/code&gt; to &lt;code&gt;10.20.3.254&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Broadcast: &lt;code&gt;10.20.3.255&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can sanity-check that in Python's standard library:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ipaddress&lt;/span&gt;

&lt;span class="n"&gt;net&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ipaddress&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ip_network&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;10.20.0.0/22&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;net&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;netmask&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;net&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;hostmask&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;net&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;broadcast_address&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# 255.255.252.0 0.0.3.255 10.20.3.255
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;net&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;num_addresses&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;net&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;num_addresses&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;          &lt;span class="c1"&gt;# 1024 1022
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(Cloud providers usually reserve a few more addresses in each subnet, so check your provider's docs before you plan right up to the limit.)&lt;/p&gt;

&lt;p&gt;If you'd rather not open a REPL, the &lt;a href="https://calculator.now/cidr-calculator/" rel="noopener noreferrer"&gt;CIDR subnet calculator&lt;/a&gt; takes an IP plus either a prefix or a dotted mask. It returns the network and broadcast addresses, the usable range, the wildcard mask and the address class, and tells you whether the address is private. You can also tick boxes to show every octet in binary or hex, which is the clearest way I know to &lt;em&gt;see&lt;/em&gt; why &lt;code&gt;/22&lt;/code&gt; cuts the third octet in half. There's also a separate IP Subnet Calculator on the site with a handy &lt;code&gt;/24&lt;/code&gt; to &lt;code&gt;/32&lt;/code&gt; cheat-sheet table.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Unix timestamps
&lt;/h2&gt;

&lt;p&gt;Logs, JWT &lt;code&gt;exp&lt;/code&gt; claims and API payloads all speak in epoch seconds. Humans don't.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Worked example:&lt;/strong&gt; what is &lt;code&gt;1714822400&lt;/code&gt;?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;date&lt;/span&gt; &lt;span class="nt"&gt;-u&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; @1714822400        &lt;span class="c"&gt;# Sat May  4 11:33:20 UTC 2024&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1714822400&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toISOString&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// '2024-05-04T11:33:20.000Z'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two things trip people up again and again:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Seconds vs milliseconds.&lt;/strong&gt; JavaScript's &lt;code&gt;Date.now()&lt;/code&gt; returns milliseconds, while most backends store seconds. If your date lands in the year 56,000-something, you forgot to divide by 1,000.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Y2038.&lt;/strong&gt; The largest signed 32-bit value, &lt;code&gt;2147483647&lt;/code&gt;, is &lt;code&gt;2038-01-19 03:14:07 UTC&lt;/code&gt;. Anything still storing time in a 32-bit &lt;code&gt;int&lt;/code&gt; overflows one second later.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The &lt;a href="https://calculator.now/unix-time-calculator/" rel="noopener noreferrer"&gt;Unix timestamp converter&lt;/a&gt; converts both ways (always in UTC) and shows a live current-epoch clock. It also does timestamp arithmetic: add or subtract seconds, minutes, hours, days, weeks, months or years from a base timestamp. That's the bit I use most, for questions like "if this token was issued at X with a 7-day TTL, when does it expire?"&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Hex, binary and octal (plus bitwise ops)
&lt;/h2&gt;

&lt;p&gt;Colour codes, memory addresses, flag fields and byte dumps all need quick base conversions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Worked example:&lt;/strong&gt; the CSS colour &lt;code&gt;#1E90FF&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;1E90FF&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# 30 144 255
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And going the other way: &lt;code&gt;0xFF&lt;/code&gt; = &lt;code&gt;255&lt;/code&gt; = &lt;code&gt;0b11111111&lt;/code&gt;, and octal &lt;code&gt;755&lt;/code&gt; = &lt;code&gt;0b111101101&lt;/code&gt;. That's the same number &lt;code&gt;chmod&lt;/code&gt; uses in section 1.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://calculator.now/hex-calculator/" rel="noopener noreferrer"&gt;hex calculator&lt;/a&gt; converts between decimal, hex, binary and octal. It can also run shift-left, shift-right, NOT, AND, OR and XOR against a second value. You can choose the bit width (8, 16, 32 or 64 bits), group digits in fours or eights, add &lt;code&gt;0x&lt;/code&gt;/&lt;code&gt;0b&lt;/code&gt;/&lt;code&gt;0o&lt;/code&gt; prefixes, and show the conversion steps. If you're debugging bit masks specifically, the site also has a dedicated Bitwise Calculator with a bit-by-bit operation table and unsigned right shift (&lt;code&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/code&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  5. "How long will this download take?"
&lt;/h2&gt;

&lt;p&gt;This one is mostly about bits vs bytes. Network speeds are quoted in &lt;strong&gt;bits&lt;/strong&gt; per second, while file sizes are in &lt;strong&gt;bytes&lt;/strong&gt;, so you multiply by 8 before you divide.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;time (s) = (file size in bytes × 8) / (link speed in bits/s × efficiency)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Worked example:&lt;/strong&gt; pulling a 50 GB dataset over a 300 Mbps line at 90% efficiency:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;size_bits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;50e9&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;
&lt;span class="n"&gt;rate&lt;/span&gt;      &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;300e6&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;0.9&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;size_bits&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;rate&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;# ≈ 24.7 minutes
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;a href="https://calculator.now/download-time-calculator/" rel="noopener noreferrer"&gt;download time calculator&lt;/a&gt; takes KB/MB/GB/TB and Kbps/Mbps/Gbps, lets you set an efficiency (overhead) percentage, and can show the result in seconds, minutes, hours and days at once. I find it useful for setting expectations before a big backup restore or a container registry migration.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. GB vs GiB: storage units
&lt;/h2&gt;

&lt;p&gt;Your "500 GB" disk shows up as about 465 GiB in the OS, and nothing went missing. Drive makers use decimal units (1 GB = 1,000,000,000 bytes), while many tools report binary units (1 GiB = 1,073,741,824 bytes).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;500e9&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;# 465.66 GiB
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;a href="https://calculator.now/computer-storage/" rel="noopener noreferrer"&gt;storage unit converter&lt;/a&gt; on Calculator.now converts between bits, bytes and every unit up to petabytes, and can show binary units (KiB, MiB…) alongside. It also has two extras I didn't expect to use as much as I do. One estimates file sizes by type (text, images, audio, video or database records). The other works out how many files of a given size fit on a drive, and what percentage of it they'd use.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why bother with a web calculator?
&lt;/h2&gt;

&lt;p&gt;Honestly, for a lot of this a REPL is faster &lt;em&gt;if you already remember the formula&lt;/em&gt;. I reach for the calculators when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I'm explaining something to someone else and want them to see the working, not just my answer;&lt;/li&gt;
&lt;li&gt;I want a second opinion on a value I'm about to put into a firewall rule or a &lt;code&gt;chmod -R&lt;/code&gt;;&lt;/li&gt;
&lt;li&gt;I'm on a machine (or a phone) where I don't have my usual shell set up.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Everything runs in the browser with no sign-up. If something's wrong, or there's a dev calculator you wish existed, tell me in the comments. I read them, and requests help me decide what to build next.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Disclosure: I'm the founder of Calculator.now, so I'm biased. All the snippets above are plain standard-library code, so you can check every number without using my site at all.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>devtools</category>
      <category>linux</category>
      <category>networking</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
