<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="/css/rss-browser.css" ?>
<rss version="2.0">
	<channel>
		<title>Perturb.org - Scott's Geek Stuff</title>
		<link>http://www.perturb.org/</link>
		<description>Just Geek Stuff</description>

		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/1454/</guid>
			<title>Perl: ULID generation</title>
			<link>http://www.perturb.org/display/entry/1454/</link>
			<description>&lt;p&gt;&lt;a href=&quot;https://github.com/ulid/spec&quot;&gt;ULID&#039;s&lt;/a&gt; are an interesting way to generate globally unique identifiers. Here is a quickie Perl implementation to generate ULIDs. This implementation does &lt;strong&gt;not&lt;/strong&gt; include the intra-millisecond monotonic increment however. If that feature is important to you consider checking out a more full-featured implementation like &lt;a href=&quot;https://github.com/scottchiefbaker/perl-ULID-Tiny&quot;&gt;ULID::Tiny&lt;/a&gt;.&lt;/p&gt;
		&lt;pre&gt;&lt;code class=&quot;language-perl&quot;&gt;for (1 .. 5) {
		    say(ulid());
		}&lt;/code&gt;&lt;/pre&gt;
		&lt;pre&gt;&lt;code class=&quot;language-perl&quot;&gt;sub ulid {
		    my $ts    = $_[0] || time() * 1000;
		    my $bytes = substr(pack(&quot;Q&amp;gt;&quot;, $ts), 2, 6);
		
		    # Append 10 random bytes
		    for (0 .. 9) { $bytes .= chr(int(rand(256))); }
		
		    # base32 encoding
		    my $bits  = unpack(&quot;B*&quot;, $bytes);
		    my $pad   = (5 - (length($bits) % 5)) % 5;
		    $bits    .= &#039;0&#039; x $pad;
		
		    # Chars to use for base32
		    my @CROCKFORD_CHARS = split //, &#039;0123456789ABCDEFGHJKMNPQRSTVWXYZ&#039;;
		
		    my $result  = &#039;&#039;;
		    for (my $i = 0; $i &amp;lt; length($bits); $i += 5) {
		        my $chunk = substr($bits, $i, 5);
		        my $index = 0;
		        for my $bit (split //, $chunk) {
		            $index = ($index &amp;lt;&amp;lt; 1) | $bit;
		        }
		
		        $result .= $CROCKFORD_CHARS[$index];
		    }
		
		    return $result;
		}&lt;/code&gt;&lt;/pre&gt;
		&lt;p&gt;&lt;strong&gt;See also:&lt;/strong&gt; &lt;a href=&quot;https://www.perturb.org/display/1398_Perl_UUIDv7.html&quot;&gt;UUIDv7&lt;/a&gt;&lt;/p&gt;</description>
			<pubDate>Sun, 26 Apr 2026 18:58:48 -0700</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/1453/</guid>
			<title>Perl: Using Inline::C to embed C functions in your Perl scripts</title>
			<link>http://www.perturb.org/display/entry/1453/</link>
			<description>&lt;p&gt;Perl allows &quot;inline&quot; code written in other languages. This is useful because you can have native C functions interact with your Perl code. By placing your C code in the &lt;code&gt;__DATA__&lt;/code&gt; section of your Perl script you get clean separation between the two languages.&lt;/p&gt;
		&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;code&gt;Inline::C&lt;/code&gt; does not understand &lt;code&gt;uint64_t&lt;/code&gt; in function definitions, so anything that interacts with Perl needs to use &lt;code&gt;UV&lt;/code&gt; instead. Internally C functions can use and interact with &lt;code&gt;uint64_t&lt;/code&gt; variables just fine.&lt;/p&gt;
		&lt;pre&gt;&lt;code class=&quot;language-perl&quot;&gt;use strict;
		use warnings;
		use v5.16;
		use Inline &#039;C&#039;;
		
		##############################################
		
		seed_splitmix64(time());
		
		for (1 .. 5) {
		    say splitmix64();
		}
		
		##############################################
		
		__DATA__
		__C__
		
		uint64_t x = 123456789;
		
		void seed_splitmix64(UV seed) {
		    x = seed;
		}
		
		UV splitmix64() {
		    uint64_t z = (x += 0x9e3779b97f4a7c15);
		    z = (z ^ (z &amp;gt;&amp;gt; 30)) * 0xbf58476d1ce4e5b9;
		    z = (z ^ (z &amp;gt;&amp;gt; 27)) * 0x94d049bb133111eb;
		
		    return z ^ (z &amp;gt;&amp;gt; 31);
		}&lt;/code&gt;&lt;/pre&gt;
		&lt;p&gt;This will compile the C code into a shared object in the &lt;code&gt;_Inline&lt;/code&gt; directory in whichever directory you instantiated your Perl script. Code is only compiled once (and where there are changes), so your script performance will be very high.&lt;/p&gt;</description>
			<pubDate>Thu, 23 Apr 2026 14:34:43 -0700</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/1452/</guid>
			<title>Comparison of markup languages</title>
			<link>http://www.perturb.org/display/entry/1452/</link>
			<description>&lt;p&gt;I&#039;ve been investigating &lt;a href=&quot;https://www.json.org/&quot;&gt;JSON&lt;/a&gt; vs &lt;a href=&quot;https://yaml.org/&quot;&gt;YAML&lt;/a&gt; vs &lt;a href=&quot;https://toml.io/&quot;&gt;TOML&lt;/a&gt; for various applications. After testing many variations I ended up writing a &lt;a href=&quot;https://www.perturb.org/code/serialize_test.php&quot;&gt;simple tool&lt;/a&gt; to compare all three live.&lt;/p&gt;</description>
			<pubDate>Thu, 09 Apr 2026 10:58:41 -0700</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/1451/</guid>
			<title>Linux: SFTP and SCP friendly login banners</title>
			<link>http://www.perturb.org/display/entry/1451/</link>
			<description>&lt;p&gt;To display a message when a user logs into your server, add the following to &lt;code&gt;~/.bashrc&lt;/code&gt;:&lt;/p&gt;
		&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;# If it&#039;s an interactive terminal show the banner
		if [[ $- == *i* ]]; then
		    echo &quot;Welcome to the monitoring server&quot;
		    echo &quot;Configuration is stored in /etc/myapp&quot;
		fi&lt;/code&gt;&lt;/pre&gt;
		&lt;p&gt;This runs &lt;em&gt;only&lt;/em&gt; for interactive sessions. Non-interactive connections such as SFTP and SCP remain unaffected, which prevents automated processes from breaking.&lt;/p&gt;
		&lt;p&gt;&lt;strong&gt;See also:&lt;/strong&gt; The &lt;a href=&quot;https://github.com/scottchiefbaker/text_color&quot;&gt;text_color&lt;/a&gt; project.&lt;/p&gt;</description>
			<pubDate>Thu, 26 Mar 2026 14:07:00 -0700</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/1450/</guid>
			<title>YAML is growing on me</title>
			<link>http://www.perturb.org/display/entry/1450/</link>
			<description>&lt;p&gt;The more I learn about YAML, the more I like it. JSON is great as a machine readable format, but it sucks at being human readable. Want to add an element, better make sure you have &lt;strong&gt;all&lt;/strong&gt; the commas and curly braces in the &lt;strong&gt;exact&lt;/strong&gt; right place or the whole thing will be unusable. YAML on the other hand is designed to be human readable and modifiable. It&#039;s a very simple key/value system using indentation to represent layers. &lt;/p&gt;
		&lt;p&gt;PHP has a &lt;a href=&quot;https://bd808.com/pecl-file_formats-yaml/&quot;&gt;PECL module&lt;/a&gt; with good YAML support. There are also pure PHP versions if you&#039;re unable to install PECL modules. &lt;a href=&quot;https://github.com/symfony/yaml&quot;&gt;Symfony&lt;/a&gt; provides one, and so does &lt;a href=&quot;https://github.com/mustangostang/spyc&quot;&gt;Spyc&lt;/a&gt;. I prefer the latter because it&#039;s a single file and very easy to install.&lt;/p&gt;
		&lt;p&gt;On the Perl side there is &lt;a href=&quot;https://metacpan.org/pod/YAML::XS&quot;&gt;YAML::XS&lt;/a&gt;, &lt;a href=&quot;https://metacpan.org/pod/YAML::PP&quot;&gt;YAML::PP&lt;/a&gt;, and &lt;a href=&quot;https://metacpan.org/search?size=20&amp;amp;q=yaml&quot;&gt;many&lt;/a&gt; others. &lt;/p&gt;
		&lt;p&gt;Parsing YAML is very easy in just about every language I can find. If you have a complex data structure that you need humans to interact with use YAML please.&lt;/p&gt;
		&lt;p&gt;Here is a &lt;a href=&quot;https://jsonlint.com/json-vs-yaml&quot;&gt;great breakdown&lt;/a&gt; of when to use YAML vs JSON:&lt;/p&gt;
		&lt;table&gt;
		&lt;thead&gt;
		&lt;tr&gt;
		&lt;th&gt;Use Case&lt;/th&gt;
		&lt;th&gt;Recommended&lt;/th&gt;
		&lt;th&gt;Why&lt;/th&gt;
		&lt;/tr&gt;
		&lt;/thead&gt;
		&lt;tbody&gt;
		&lt;tr&gt;
		&lt;td&gt;API request/response&lt;/td&gt;
		&lt;td&gt;JSON&lt;/td&gt;
		&lt;td&gt;Universal support, strict parsing&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
		&lt;td&gt;Configuration files&lt;/td&gt;
		&lt;td&gt;YAML&lt;/td&gt;
		&lt;td&gt;Comments, readability&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
		&lt;td&gt;Browser/JavaScript&lt;/td&gt;
		&lt;td&gt;JSON&lt;/td&gt;
		&lt;td&gt;Native parsing&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
		&lt;td&gt;Kubernetes/Docker&lt;/td&gt;
		&lt;td&gt;YAML&lt;/td&gt;
		&lt;td&gt;Industry standard&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
		&lt;td&gt;Data interchange&lt;/td&gt;
		&lt;td&gt;JSON&lt;/td&gt;
		&lt;td&gt;Unambiguous, fast&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
		&lt;td&gt;Human-edited files&lt;/td&gt;
		&lt;td&gt;YAML&lt;/td&gt;
		&lt;td&gt;Less punctuation&lt;/td&gt;
		&lt;/tr&gt;
		&lt;/tbody&gt;
		&lt;/table&gt;
		&lt;p&gt;&lt;a href=&quot;https://perlpunk.github.io/yaml-test-schema/schemas.html&quot;&gt;YAML spec&lt;/a&gt; differences.&lt;/p&gt;</description>
			<pubDate>Wed, 25 Mar 2026 10:04:29 -0700</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/1449/</guid>
			<title>C: Fill an array of unsigned integers with random data using getentropy()</title>
			<link>http://www.perturb.org/display/entry/1449/</link>
			<description>&lt;p&gt;Often I need to generate random unsigned integers for seeding PRNGs. The best way is using the &lt;code&gt;getentropy()&lt;/code&gt; system function to read OS level randomness into your array.&lt;/p&gt;
		&lt;pre&gt;&lt;code class=&quot;language-c&quot;&gt;#include &amp;lt;sys/random.h&amp;gt;
		
		// Read from system random to fill up data structure
		int8_t fill_urandom(void *buf, size_t bytes) {
		    int8_t ok = getentropy(buf, bytes);
		
		    return (ok == 0);
		}&lt;/code&gt;&lt;/pre&gt;
		&lt;p&gt;Declare your array of integers, and then pass it as a pointer to this function to fill with random bytes from your OS. This will get you a bunch of random integers you can use for seeding PRNGs.&lt;/p&gt;
		&lt;pre&gt;&lt;code class=&quot;language-c&quot;&gt;uint64_t seed[4];
		fill_urandom(seed, sizeof(seed));&lt;/code&gt;&lt;/pre&gt;</description>
			<pubDate>Sun, 11 Jan 2026 12:32:42 -0800</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/1448/</guid>
			<title>Books of 2026</title>
			<link>http://www.perturb.org/display/entry/1448/</link>
			<description>&lt;p&gt;List of books I read in 2026. Also see the list of &lt;a href=&quot;/display/1412_Books_of_2025.html&quot;&gt;2025&lt;/a&gt;. The date indicated denotes the date I started reading the book.&lt;/p&gt;
		&lt;p&gt;2026-01-01 - &lt;a href=&quot;//www.google.com/search?tbo=p&amp;amp;q=isbn+9781453080054&quot;&gt;White Fang&lt;/a&gt; by Jack London - 180 pages&lt;br /&gt;
		2026-01-03 - &lt;a href=&quot;//www.google.com/search?tbo=p&amp;amp;q=isbn+9781409146322&quot;&gt;Hollow Man&lt;/a&gt; by John Dickson Carr - 213 pages&lt;br /&gt;
		2026-01-06 - &lt;a href=&quot;//www.google.com/search?tbo=p&amp;amp;q=isbn+9780765382030&quot;&gt;The Three-body Problem&lt;/a&gt; by Cixin Liu - 400 pages&lt;br /&gt;
		2026-01-12 - &lt;a href=&quot;//www.google.com/search?tbo=p&amp;amp;q=isbn+9780345477576&quot;&gt;Star Wars: Revelation&lt;/a&gt; by Karen Traviss - 410 pages&lt;br /&gt;
		2026-01-19 - &lt;a href=&quot;//www.google.com/search?tbo=p&amp;amp;q=isbn+9780345376596&quot;&gt;Pale Blue Dot&lt;/a&gt; by Carl Sagan - 342 pages&lt;br /&gt;
		2026-01-25 - &lt;a href=&quot;//www.google.com/search?tbo=p&amp;amp;q=isbn+9780593820254&quot;&gt;Dungeon Crawler Carl&lt;/a&gt; by Matt Dinniman - 450 pages&lt;br /&gt;
		2026-02-01 - &lt;a href=&quot;//www.google.com/search?tbo=p&amp;amp;q=isbn+9780593135228&quot;&gt;Project Hail Mary&lt;/a&gt; by Andy Weir - 478 pages&lt;br /&gt;
		2026-02-09 - &lt;a href=&quot;//www.google.com/search?tbo=p&amp;amp;q=isbn+9780765386694&quot;&gt;The Dark Forest&lt;/a&gt; by Cixin Liu - 512 pages&lt;br /&gt;
		2026-02-18 - &lt;a href=&quot;//www.google.com/search?tbo=p&amp;amp;q=isbn+9780399563874&quot;&gt;The Hike&lt;/a&gt; by Drew Magary - 278 pages&lt;br /&gt;
		2026-02-22 - &lt;a href=&quot;//www.google.com/search?tbo=p&amp;amp;q=isbn+9781538541920&quot;&gt;Fletch&lt;/a&gt; by Gregory Mcdonald - 249 pages&lt;br /&gt;
		2026-02-26 - &lt;a href=&quot;//www.google.com/search?tbo=p&amp;amp;q=isbn+9780060589462&quot;&gt;Zen And The Art Of Motorcycle Maintenance&lt;/a&gt; by Robert M. Pirsig - 540 pages&lt;br /&gt;
		2026-03-06 - &lt;a href=&quot;//www.google.com/search?tbo=p&amp;amp;q=isbn+9781783299010&quot;&gt;Aliens: The Female War&lt;/a&gt; by Steve Perry - 258 pages&lt;br /&gt;
		2026-03-11 - &lt;a href=&quot;//www.google.com/search?tbo=p&amp;amp;q=isbn+9780060548254&quot;&gt;The Crystal Cave&lt;/a&gt; by Mary Stewart - 522 pages&lt;br /&gt;
		2026-03-20 - &lt;a href=&quot;//www.google.com/search?tbo=p&amp;amp;q=isbn+9780593734223&quot;&gt;Nexus&lt;/a&gt; by Yuval Noah Harari - 420 pages&lt;br /&gt;
		2026-03-26 - &lt;a href=&quot;//www.google.com/search?tbo=p&amp;amp;q=isbn+0345428544&quot;&gt;Star Wars: Onslaught&lt;/a&gt; by Michael A. Stackpole - 292 pages&lt;br /&gt;
		2026-03-31 - &lt;a href=&quot;//www.google.com/search?tbo=p&amp;amp;q=isbn+9780765386632&quot;&gt;Death&#039;s End&lt;/a&gt; by Cixin Liu - 590 pages&lt;br /&gt;
		2026-04-09 - &lt;a href=&quot;//www.google.com/search?tbo=p&amp;amp;q=isbn+9780141321059&quot;&gt;The Call Of The Wild&lt;/a&gt; by Jack London - 160 pages&lt;br /&gt;
		2026-04-11 - &lt;a href=&quot;//www.google.com/search?tbo=p&amp;amp;q=isbn+9780786915743&quot;&gt;Dragons Of Autumn Twilight&lt;/a&gt; by Margaret Weis - 444 pages&lt;br /&gt;
		2026-04-19 - &lt;a href=&quot;//www.google.com/search?tbo=p&amp;amp;q=isbn+9780062074201&quot;&gt;Wayne Of Gotham&lt;/a&gt; by Tracy Hickman - 296 pages&lt;br /&gt;
		2026-04-23 - &lt;a href=&quot;//www.google.com/search?tbo=p&amp;amp;q=isbn+9780765332035&quot;&gt;Unwept&lt;/a&gt; by Tracy Hickman - 268 pages&lt;br /&gt;
		2026-04-27 - &lt;a href=&quot;//www.google.com/search?tbo=p&amp;amp;q=isbn+0345428560&quot;&gt;Star Wars: Ruin&lt;/a&gt; by Michael A. Stackpole - 292 pages&lt;br /&gt;
		2026-05-02 - &lt;a href=&quot;//www.google.com/search?tbo=p&amp;amp;q=isbn+9780375826696&quot;&gt;Eragon&lt;/a&gt; by Christopher Paolini - 503 pages  &lt;/p&gt;
		&lt;p&gt;2026-xx-xx - &lt;a href=&quot;//www.google.com/search?tbo=p&amp;amp;q=isbn+0786918071&quot;&gt;Dragons Of A Fallen Sun&lt;/a&gt; by Margaret Weis - 627 pages&lt;br /&gt;
		2026-xx-xx - &lt;a href=&quot;//www.google.com/search?tbo=p&amp;amp;q=isbn+0786927062&quot;&gt;Dragons Of A Lost Star&lt;/a&gt; by Margaret Weis - 550 pages&lt;br /&gt;
		2026-xx-xx - &lt;a href=&quot;//www.google.com/search?tbo=p&amp;amp;q=isbn+0786929502&quot;&gt;Dragons Of A Vanished Moon&lt;/a&gt; by Margaret Weis - 629 pages  &lt;/p&gt;
		&lt;p&gt;2026-xx-xx - &lt;a href=&quot;//www.google.com/search?tbo=p&amp;amp;q=isbn+9780375840401&quot;&gt;Eldest&lt;/a&gt; by Christopher Paolini - 679 pages&lt;br /&gt;
		2026-xx-xx - &lt;a href=&quot;//www.google.com/search?tbo=p&amp;amp;q=isbn+9780375826740&quot;&gt;Brisingr&lt;/a&gt; by Christopher Paolini - 763 pages&lt;br /&gt;
		2026-xx-xx - &lt;a href=&quot;//www.google.com/search?tbo=p&amp;amp;q=isbn+9780375846311&quot;&gt;Inheritance&lt;/a&gt; by Christopher Paolini - 849 pages&lt;/p&gt;</description>
			<pubDate>Thu, 01 Jan 2026 10:50:29 -0800</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/1447/</guid>
			<title>How far does Gandalf fall when fighting the Balrog in Khazad Dum?</title>
			<link>http://www.perturb.org/display/entry/1447/</link>
			<description>&lt;p&gt;In the extended edition of Fellowship of the Ring Gandalf fights the Balrog and then falls for about 70 seconds.&lt;/p&gt;
		&lt;p&gt;It takes about 12 seconds to reach terminal velocity: 0.5 * g * t^2 = 0.5 * 9.81 * 12^2 ~ 706m&lt;/p&gt;
		&lt;p&gt;The remaining 58 seconds Gandalf is at terminal velocity (not speeding up) of 53m/s which is v * t = 53 * 58 ~ 3074m. For a total of 3780 meters, or about 2.35 miles.&lt;/p&gt;
		&lt;p&gt;Pretty impressive free-fall considering they were ALREADY under ground.&lt;/p&gt;</description>
			<pubDate>Wed, 24 Dec 2025 21:16:09 -0800</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/1446/</guid>
			<title>Perl: biski64 and sfc64 PRNG</title>
			<link>http://www.perturb.org/display/entry/1446/</link>
			<description>&lt;p&gt;&lt;a href=&quot;https://github.com/danielcota/biski64&quot;&gt;Biski64&lt;/a&gt; is a new PRNG there is extremely fast and also very simple. This one was pretty simple so I ported it to Perl in &lt;a href=&quot;https://www.perturb.org/code/syntax_highlight.php?file=biski64.pl&quot;&gt;biski64.pl&lt;/a&gt;.&lt;/p&gt;
		&lt;p&gt;SFC64 is also largely considered on of the better PRNGs so I ported it also in &lt;a href=&quot;https://www.perturb.org/code/syntax_highlight.php?file=sfc64.pl&quot;&gt;sfc64.pl&lt;/a&gt;.&lt;/p&gt;</description>
			<pubDate>Tue, 23 Dec 2025 10:08:47 -0800</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/1445/</guid>
			<title>PRNG: PCG64 in Perl</title>
			<link>http://www.perturb.org/display/entry/1445/</link>
			<description>&lt;p&gt;I found a &lt;a href=&quot;https://github.com/alvoskov/SmokeRand/blob/main/generators/pcg64_64.c&quot;&gt;PCG64 implementation&lt;/a&gt; that I was able to borrow and convert to pure Perl:&lt;/p&gt;
		&lt;pre&gt;&lt;code class=&quot;language-perl&quot;&gt;# PCG64 RXS-M-XS &quot;simple&quot; variant
		#my $seeds = [12, 34];
		#my $rand  = pcg64_perl($seeds);
		sub pcg64_perl {
		    my $seeds = $_[0];
		    my $ret   = (($seeds-&amp;gt;[0] &amp;gt;&amp;gt; (($seeds-&amp;gt;[0] &amp;gt;&amp;gt; 59) + 5)) ^ $seeds-&amp;gt;[0]);
		
		    use integer;
		    $ret *= 12605985483714917081;
		    $seeds-&amp;gt;[0] = $seeds-&amp;gt;[0] * 6364136223846793005 + $seeds-&amp;gt;[1];
		    no integer;
		
		    $ret = ($ret &amp;gt;&amp;gt; 43) ^ $ret;
		
		    return $ret;
		}&lt;/code&gt;&lt;/pre&gt;
		&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; Bonus points because it&#039;s &lt;a href=&quot;https://www.perturb.org/code/prng-bench.pl&quot;&gt;really fast&lt;/a&gt;:&lt;/p&gt;
		&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;*               Rate xosh256**  biski64     sfc64     PCG32 Splitmix64     PCG64
		xosh256**  1589825/s        --     -26%      -48%      -52%       -58%      -65%
		biski64    2145923/s       35%       --      -30%      -35%       -43%      -53%
		sfc64      3058104/s       92%      43%        --       -8%       -19%      -33%
		PCG32      3311258/s      108%      54%        8%        --       -13%      -28%
		Splitmix64 3787879/s      138%      77%       24%       14%         --      -17%
		PCG64      4587156/s      189%     114%       50%       39%        21%        --&lt;/code&gt;&lt;/pre&gt;</description>
			<pubDate>Fri, 12 Dec 2025 18:33:07 -0800</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/1444/</guid>
			<title>PHP: Serve large audio/video files outside of the webroot</title>
			<link>http://www.perturb.org/display/entry/1444/</link>
			<description>&lt;p&gt;I have some large audio files that I need to serve via HTTPs. They need to be protected by my PHP login system so they cannot live &lt;em&gt;inside&lt;/em&gt; of the webroot. Fortunately there is a nifty Apache module named &lt;a href=&quot;https://github.com/nmaier/mod_xsendfile&quot;&gt;X-sendfile&lt;/a&gt;, that lets you serve files outside of the webroot.&lt;/p&gt;
		&lt;p&gt;Credential checking is done in PHP, and then you set a special HTTP header that Apache watches for. When Apaches sees the &lt;code&gt;X-Sendfile&lt;/code&gt; header it serves the file directly. This gets you all the advantages of a full-blown HTTP server handling your files, but the convenience and simplicity of PHP for handling authentication.&lt;/p&gt;
		&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;if ($authorized) {
		    $mime_type = mime_from_filename($filepath);
		
		    header(&quot;Content-Type: $mime_type&quot;);
		    header(&quot;X-Sendfile: $filepath&quot;);
		    exit;
		}&lt;/code&gt;&lt;/pre&gt;
		&lt;p&gt;&lt;strong&gt;See also:&lt;/strong&gt; &lt;a href=&quot;https://www.perturb.org/display/1443_PHP_Get_the_mime_type_for_a_file.html&quot;&gt;Get mime type for file&lt;/a&gt;&lt;/p&gt;</description>
			<pubDate>Tue, 02 Dec 2025 11:57:04 -0800</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/1443/</guid>
			<title>PHP: Get the mime type for a file</title>
			<link>http://www.perturb.org/display/entry/1443/</link>
			<description>&lt;p&gt;If you need to get the mime type for a file in PHP you can use this function which wrappers the &lt;code&gt;finfo_open()&lt;/code&gt; function.&lt;/p&gt;
		&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;function mime_from_filename($filename) {
		    $finfo = finfo_open(FILEINFO_MIME_TYPE);
		    $mime  = finfo_file($finfo, $filename);
		    finfo_close($finfo);
		
		    return $mine;
		}&lt;/code&gt;&lt;/pre&gt;
		&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This function requires the file to exist on the disk.&lt;/p&gt;</description>
			<pubDate>Mon, 01 Dec 2025 19:48:54 -0800</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/1442/</guid>
			<title>Perl: Get terminal width</title>
			<link>http://www.perturb.org/display/entry/1442/</link>
			<description>&lt;p&gt;If you need a fast and simple way to get the terminal width in Perl core use &lt;code&gt;Term::ReadKey&lt;/code&gt;. This is almost certainly faster and better than shelling out to &lt;code&gt;tput cols&lt;/code&gt;.&lt;/p&gt;
		&lt;pre&gt;&lt;code class=&quot;language-perl&quot;&gt;sub get_terminal_width {
		    my @x      = Term::ReadKey::GetTerminalSize();
		    my $width  = $x[0] || 0;
		
		    return $width;
		}&lt;/code&gt;&lt;/pre&gt;</description>
			<pubDate>Wed, 19 Nov 2025 14:41:22 -0800</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/1441/</guid>
			<title>NIST Password Recommedations for 2025</title>
			<link>http://www.perturb.org/display/entry/1441/</link>
			<description>&lt;p&gt;Current NIST &lt;a href=&quot;https://pages.nist.gov/800-63-4/sp800-63b.html&quot;&gt;Password Requirements&lt;/a&gt; for 2025 (SP800-63b).&lt;/p&gt;
		&lt;p&gt;What&rsquo;s gone:&lt;/p&gt;
		&lt;p&gt;❌ Required uppercase, numbers, and symbols&lt;br /&gt;
		❌ Mandatory password resets every 90 days&lt;br /&gt;
		❌ Arbitrary complexity policies  &lt;/p&gt;
		&lt;p&gt;What&rsquo;s required now:&lt;/p&gt;
		&lt;p&gt;✅ Minimum 8-character passwords (15+ for privileged accounts)&lt;br /&gt;
		✅ Password screening against compromised credential databases&lt;br /&gt;
		✅ Support for passwordless authentication and passkeys&lt;/p&gt;
		&lt;blockquote&gt;
		&lt;p&gt;Minimum Password Length Requirements&lt;/p&gt;
		&lt;p&gt;Password length serves as the cornerstone of NIST&#039;s updated authentication framework. While the baseline requirement mandates a minimum of 8 characters, security research reveals that passwords under 8 characters can be cracked within hours using modern computing power.&lt;/p&gt;
		&lt;/blockquote&gt;
		&lt;p&gt;StrongDM has a good &lt;a href=&quot;https://www.strongdm.com/blog/nist-password-guidelines&quot;&gt;summary&lt;/a&gt;.&lt;/p&gt;</description>
			<pubDate>Tue, 04 Nov 2025 14:44:15 -0800</pubDate>
		</item>
		
		<item>
			<guid isPermaLink="true">http://www.perturb.org/display/entry/1440/</guid>
			<title>Two more PRNGs implemented in Perl</title>
			<link>http://www.perturb.org/display/entry/1440/</link>
			<description>&lt;p&gt;In my &lt;a href=&quot;https://www.perturb.org/display/1418_Implmenting_PRNGs_in_Perl.html&quot;&gt;ongoing quest&lt;/a&gt; to implement PRNGs in pure Perl I&#039;m adding the &lt;a href=&quot;https://www.perturb.org/code/syntax_highlight.php?file=mwc.pl&quot;&gt;Marsaglia multiply-with-carry&lt;/a&gt; family to my collection. These were a little difficult because the math is all done in 128bits which requires a special emulation layer in Perl. The Perl version is &lt;em&gt;much&lt;/em&gt; slower than the C version, but that&#039;s to be expected without native 128bit variable types.&lt;/p&gt;
		&lt;p&gt;I also implemented &lt;a href=&quot;https://www.perturb.org/code/syntax_highlight.php?file=squares.pl&quot;&gt;squares64&lt;/a&gt; PRNG which was a little more straight forward. I learned that bitwise shifts are normally unsigned, but if we&#039;re in a &lt;code&gt;use integer&lt;/code&gt; block bitwise shifts change to signed. This is not what we want so I ended doing a lot of &lt;code&gt;use integer&lt;/code&gt; followed almost immediately by a &lt;code&gt;no integer&lt;/code&gt; to make sure we&#039;re doing the math in the correct mode.&lt;/p&gt;</description>
			<pubDate>Wed, 29 Oct 2025 09:41:54 -0700</pubDate>
		</item>
		
	</channel>
</rss>
