Category: tech

Adding a search capability to a Hugo website

Today, I added a way to search for content in frankcontrepois.com simply by adding the following lines to my Hugo header. <div class="input-group"> <input id='search-input' type="text" class="form-control" placeholder="Search for..."> <span class="input-group-btn"> <button id='search-button' class="btn btn-default">Go!</button> </span> </div> <script type="text/javascript"> var button = document.getElementById('search-button'); var input = document.getElementById('search-input'); function performSearch() { var query = '?q=site%3Afrankcontrepois.com+' + encodeURIComponent(input.value); window.open('https://duckduckgo.com/' + query, '_blank'); } button.onclick = performSearch; input.addEventListener('keydown', function(event) { if (event.key === 'Enter') { performSearch(); } }); </script> Read more...

How do I get the number of days between two dates in AWS Athena

Looking around the web often gets me to non-Athena ways. So here we go. In AWS Athena you get the numbers of days between two dates like this: SELECT date_diff('day', FROM_ISO8601_DATE('2024-06-13'), FROM_ISO8601_DATE('2024-05-13')) AS diff The doc lies As of today, the documentation lies, you cannot have ‘second’ as first parameter. If you need the seconds multiply the result by 24 something like SELECT (date_diff('day', FROM_ISO8601_DATE('2024-06-13'), FROM_ISO8601_DATE('2024-05-13')))*24 AS diff_in_second Read more...

AWS Athena - how to make long numbers more human readable

It happens that you have calculations in your queries. And the numbers returned can be a little to long for a human-reading. I am working on some AWS CUR data, and I get a discount of 49.99999999999999%. No one will complain if I put that at 50%. The answer is to use either ROUND(YOUR_TOO_LONG_NUMBER) with only one parameter or ROUND(YOUR_TOO_LONG_NUMBER, A_SHORT_NUMBER) with two parameters Round, does what it says on the tin, it rounds the numnber to the closest integer) Read more...

How to get the plus minus symbol on mac

While writing Expressing forecasts in words I wanted to use the ± symbol and not something like +-; I find it ugly. So if you need the ± on a Mac the combination of keys is Option(alt) + Shift + = Here we go. Read more...

Validating a domain with Proton and Cloudflare

When setting up a personal domain in Proton mail you need to do quite a bit of DNS configurations: MX records, SPF records, DKIM records and DMARC records. When all is correct it looks like this And since moving my DNS to CloudFlare, mine was not OK, and I was getting email from proton telling me how my DNS config was incorrect! the solution Make sure that all DNS records in CloudFlare are not proxied (i. Read more...

AI and Education: Partnering for Creative Learning Adventures

AI is perfect for discovering kids’ (and adults’) talents and leveraging their amazing creativity. It works like this: We, as parents or teachers, pick a topic. We ask ChatGPT to write an essay on the topic, as a kid of that age would. Yes, you can ask ChatGPT to write as a 6-year-old or a 12-year-old. Print and share the content from ChatGPT with the kids and say, “Your task is to add value to this. Read more...

An AWS pricing website

In 2023 I created aws.frankcontrepois.com a website that generate graphs from AWS pricing data. The data is automatically updated every month. It was also my first time using ChatGPT to create CloudFormation scripts. note: the site is not encrypted because all the data is public and is a little greener by not requiring CPU cycles for useless encryption. Read more...

An AWS pricing investigation

In the last two years I have been playing with AWS pricing data, trying to answer questions like: What is the price of the Windows License on AWS? link What is the price of SQL server licenses on AWS? link Are there better price performance configurations to buy SQL server Licenses? link Don’t use 1 vcpu instance What is the price of RedHat licenses on AWS? link Are there better price performance configurations to buy RHEL ? Read more...

How to exclude running Google Analytics when running Hugo server

From: How to Exclude Google Analytics When Running Under Hugo Local Server from 2018 with love :) If you are not using a theme that already excludes Google Analytics, then you should use the following piece of hugo code. In my case, I added this code into layouts/partials/custom-header.html {{- if not .Site.IsServer -}} {{ template "_internal/google_analytics.html" . }} {{- end -}} Read more...