I had written a Math paper which was not good enough to be published in a journal, yet I wanted to have proof of the date I wrote it on so I could post the paper on the web without other people later being able to question who first came up with the idea.
The way I thought was more correct to do this was to publish the paper's sha256 checksum on the Bitcoin blockchain. Posting the SHA on social media (such as x.com) was not enough, as paid members can edit their old posts.
I got in touch with BBRTJ, the maintainer of Bitcoin::Crypto, who was very helpful in teaching me how to use his module and achieving my aim.
The goal, he told me, was to include the SHA256 checksum as the comment (technically the 'NULLDATA') of a small bitcoin transaction.
I created a BTC address with Perl, using Bitcoin::Crypto
I transferred a very few dollars worth of BTC to this address
I found the transaction ID at mempool
I found the index number of the ouptut of the transaction that got crypto into my address, because this number together with the transaction ID are what form the UTXO
I used this UTXO as input (funds) in a new transaction that had two outputs: One output was the NULLDATA string (the "comment" that contains the SHA256 checksum of the PDF document), and the other was a "change" address of mine, which would receive the rest of the money from the UTXO (full amount minus transaction fee (around $1)).
Someone wanting to make a social media site (such as a Mastodon server & web client for example) will want to allow its users to post URLs, for which previews will be shown in their posts.
These posts will be visited by a UserAgent, but there is the risk that a private IP (disguised as a FQDN hostname that resolves to it) will be in the URL's host, and that might cause security issues.
I could use LWP::ParanoidAgent, but then I'd have to fork a process to make the whole thing async, like a good Mojolicious site will be, and too many processes running can be a problem. Also I'd…
The following script leaks memory in perl v5.40, and it did not in v5.38:
use Scalar::Util 'weaken';
my $z;
{
my $x;
my $y;
my sub my_sub {
$x = shift;
return sub { $y };
};
my $subscriber = {};
$subscriber->{foo} = my_sub($subscriber);
weaken($z = $subscriber);
}
say 'leak = ', int defined $z;
While Devel::Gladiator will tell you there’s a memory leak somewhere in your code, the tools I use to investigate leakage of individual objects (such as Devel::Cycle) pretend there’s no cycle in $subscriber.
While the perldelta of 5.40 does mention something changed in closure behavior, IMO it’s not clear what the new behavior exactly is, and what we should consider if we want to avoid leaks.
Is this a bug in v5.40? Does it look like a bug to you? Should it be reported in github?
Do Devel::Cycle and its brothers need to be updated to handle these cases too? Should issues be opened to those modules?
What’s the new “rule”? I can’t figure it out by experimentation no matter how much I tried. Can someone please explain to me?
I created a function in Perl called pg_dt, that will convert PostgreSQL’s datetime values into Perl’s DateTime values and vice versa. This is useful both when you want to store DateTime values into the database, or want to convert the pg datetime/timestamp value from the database into a DateTime object value that Perl can use.
I really can’t seem to include code blocks in my posts on this platform (tried Preview with Markdown and Markdown With SmartyPants without success), so you can read the rest of this article on my blog.