summaryrefslogtreecommitdiff
path: root/content/html/gemfeed/atom.xml
diff options
context:
space:
mode:
Diffstat (limited to 'content/html/gemfeed/atom.xml')
-rw-r--r--content/html/gemfeed/atom.xml111
1 files changed, 110 insertions, 1 deletions
diff --git a/content/html/gemfeed/atom.xml b/content/html/gemfeed/atom.xml
index b87afe87..7f97acd0 100644
--- a/content/html/gemfeed/atom.xml
+++ b/content/html/gemfeed/atom.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
- <updated>2021-05-17T21:01:05+01:00</updated>
+ <updated>2021-05-18T21:32:49+01:00</updated>
<title>buetow.org feed</title>
<subtitle>Having fun with computers!</subtitle>
<link href="https://buetow.org/gemfeed/atom.xml" rel="self" />
@@ -976,6 +976,7 @@ apply Service "dig6" {
</pre>
<p class="quote"><i>Written by Paul Buetow 2016-04-09</i></p>
<p>Over the last couple of years I wrote quite a few Puppet modules in order to manage my personal server infrastructure. One of them manages FreeBSD Jails and another one ZFS file systems. I thought I would give a brief overview in how it looks and feels.</p>
+<a class="textlink" href="https://github.com/snonux/puppet-modules">https://github.com/snonux/puppet-modules</a><br />
<h2>ZFS</h2>
<p>The ZFS module is a pretty basic one. It does not manage ZFS pools yet as I am not creating them often enough which would justify implementing an automation. But let's see how we can create a ZFS file system (on an already given ZFS pool named ztank):</p>
<p>Puppet snippet:</p>
@@ -1527,6 +1528,114 @@ exit
</content>
</entry>
<entry>
+ <title>The fibonacci.pl.c Polyglot</title>
+ <link href="https://buetow.org/gemfeed/2014-03-24-the-fibonacci.pl.c-polyglot.html" />
+ <id>https://buetow.org/gemfeed/2014-03-24-the-fibonacci.pl.c-polyglot.html</id>
+ <updated>2014-03-24T21:32:53+00:00</updated>
+ <author>
+ <name>Paul Buetow</name>
+ <email>comments@mx.buetow.org</email>
+ </author>
+ <summary>In computing, a polyglot is a computer program or script written in a valid form of multiple programming languages, which performs the same operations or output independent of the programming language used to compile or interpret it. .....to read on please visit my site.</summary>
+ <content type="xhtml">
+ <div xmlns="http://www.w3.org/1999/xhtml">
+ <h1>The fibonacci.pl.c Polyglot</h1>
+<p class="quote"><i>Written by Paul Buetow 2014-03-24</i></p>
+<p>In computing, a polyglot is a computer program or script written in a valid form of multiple programming languages, which performs the same operations or output independent of the programming language used to compile or interpret it</p>
+<a class="textlink" href="https://en.wikipedia.org/wiki/Polyglot_(computing)">https://en.wikipedia.org/wiki/Polyglot_(computing)</a><br />
+<h2>The Fibonacci numbers</h2>
+<p>For fun, I programmed my own Polyglot, which is both, valid Perl and C code. The interesting part about C is, that $ is a valid character to start variable names with:</p>
+<pre>
+#include &lt;stdio.h&gt;
+
+#define $arg function_argument
+#define my int
+#define sub int
+#define BEGIN int main(void)
+
+my $arg;
+
+sub hello() {
+ printf("Hello, welcome to Perl-C!\n");
+ printf("This program is both, valid C and Perl code!\n");
+ printf("It calculates all fibonacci numbers from 0 to 9!\n\n");
+ return 0;
+}
+
+sub fibonacci() {
+ my $n = $arg;
+
+ if ($n &lt; 2) {
+ return $n;
+ }
+
+ $arg = $n - 1;
+ my $fib1 = fibonacci();
+ $arg = $n - 2;
+ my $fib2 = fibonacci();
+
+ return $fib1 + $fib2;
+}
+
+BEGIN {
+ hello();
+ my $i = 0;
+
+ for ($i = 0; $i &lt;= 10; ++$i) {
+ $arg = $i;
+ printf("fib(%d) = %d\n", $i, fibonacci());
+ }
+
+ return 0;
+}
+</pre>
+<p>You can find the whole source code at GitHub:</p>
+<a class="textlink" href="https://github.com/snonux/perl-c-fibonacci">https://github.com/snonux/perl-c-fibonacci</a><br />
+<h3>Let's run it with Perl:</h3>
+<pre>
+❯ perl fibonacci.pl.c
+Hello, welcome to Perl-C!
+This program is both, valid C and Perl code!
+It calculates all fibonacci numbers from 0 to 9!
+
+fib(0) = 0
+fib(1) = 1
+fib(2) = 1
+fib(3) = 2
+fib(4) = 3
+fib(5) = 5
+fib(6) = 8
+fib(7) = 13
+fib(8) = 21
+fib(9) = 34
+fib(10) = 55
+</pre>
+<h3>Let's compile it as C and run the binary:</h3>
+<pre>
+❯ gcc fibonacci.pl.c -o fibonacci
+❯ ./fibonacci
+Hello, welcome to Perl-C!
+This program is both, valid C and Perl code!
+It calculates all fibonacci numbers from 0 to 9!
+
+fib(0) = 0
+fib(1) = 1
+fib(2) = 1
+fib(3) = 2
+fib(4) = 3
+fib(5) = 5
+fib(6) = 8
+fib(7) = 13
+fib(8) = 21
+fib(9) = 34
+fib(10) = 55
+</pre>
+<p>It's really fun to play with :-).</p>
+<p>E-Mail me your thoughts at comments@mx.buetow.org!</p>
+ </div>
+ </content>
+ </entry>
+ <entry>
<title>Perl Daemon (Service Framework)</title>
<link href="https://buetow.org/gemfeed/2011-05-07-perl-daemon-service-framework.html" />
<id>https://buetow.org/gemfeed/2011-05-07-perl-daemon-service-framework.html</id>