Reblog via Nathan Wrigley
The book Pull Requests and Code Review: Best Practices for Developers has been pointed out to me by my colleague Paulo Pinto, and I liked it.
I always find it hard to express what a makes a good code review, this book attempts to describe it. There are probably lots of other opinions about and for better recommendations but I liked this one for it trying to give some advice that I can agree with.
You can buy the book for “name-your-price” or check out the Github repo and download or build the format you want to read it in.
It has been a somewhat interesting coincidence that I am currently without voice because of a cold, and OpenAI has just released some really good Text-to-Speech voices with their Create speech API. So in preparation for a meeting today, I created a little script that will output the spoke audio what I typed.
Since the voice will read exactly what’s there, I added a spell fixer that will (through ChatGPT) automatically fix typos before it’s sent to the audio API.
$ php talk.php Voice: echo Fix spelling: off Speed: 1.0 > hi everyone and welcoem to tis meetin > sc Fix spelling: on > hi everyone and welcoem to tis meetin Hi everyone and welcome to this meeting. > s2 Speed: 2 > my voice is gone because of a pretty string cold that iv pickd up My voice is gone because of a pretty strong cold that I've picked up. > s1.1 Speed: 1.1 > my voice is gone because of a pretty string cold that iv pickd up My voice is gone because of a pretty strong cold that I've picked up. > turns out, even suing the streaming audio aip, typing and then waiting for the srsult is too lsow for a conversation. but it's been interesting Turns out, even using the streaming audio API, typing and then waiting for the result is too slow for a conversation. But it's been interesting. > sc Fix spelling: off > without spell fixer it's faster but for good intonation it only makes sense to send full sentences, not single words as soon as they have been typed. maybe that can also be solved, but that's for the next experiment
In any case, it’s been fun. Thanks Simon for highlighting the API.
In my professional life on the web, I tend to visit lots of the same URLs frequently. While I have (most of) them bookmarked in my browser, I usually don’t navigate to the bookmark and click it.
I start typing in the URL field of my browser (Firefox) and since autosuggest also searches the bookmarks, those are often visible. I realized though that this is still often too slow and not straight forward enough: It happens that many URLs are very similar and have the same first part, such as on Github many repos are under the same organization.
So a while ago I started using Alfred’s snippets to expand URLs for me. By using
/ as a suffix1, this allows for speedy expansion of URLs I visit frequently. A bonus is that the same expansion works in other places where I need the URL, e.g. for linking it in blog posts.
So, for example, I have the snippet
g/a/ to expand to https://github.com/akirk/. If I then continue typing
fr, my browser can autocomplete much more precisely because I have already entered part of the URL to https://github.com/akirk/friends which I often visit.
Hope this can serve as an inspiration!
- Although I natively speak German, I have switched to US (Intl for the inverted-L Enter key, I cannot let got of that one) keyboards a long time ago to benefit from dedicated keys for square and curly brackets, this also means I have a dedicated key for slash ↩︎
With the new Completions function calling API you can actually enable ChatGPT to access the internet. I did a few quick experiments where I provided it with a function called
get_extracted_url_contents. See how it made use of it:
$ php get-news.php
Prompt: Get some news from a random US news website on the internet.
Fetching https://www.cnn.com by request of ChatGPT.
AI (239 tokens used):
According to CNN, the breaking news is that the former US president has been arraigned on 37 federal charges involving the alleged mishandling of highly classified military documents. This is a historic first.
Or from a German website:
Prompt: Get some news from a random German news website on the internet. Please only respond in English.
Fetching https://www.spiegel.de/international by request of ChatGPT.
AI (1363 tokens used):
Here are some news headlines from SPIEGEL International:
- “Ukraine’s President Calls on NATO to Set Clear ‘Red Lines’ for Russia” – Ukrainian President Volodymyr Zelensky has urged NATO to establish clear “red lines” to deter further aggression from Russia. Zelensky made these remarks during a visit to Brussels.
- “German Cabinet Approves New COVID-19 Restrictions, Including Nationwide Vaccination Mandate” – The German government has approved new measures to combat the spread of COVID-19, including a nationwide vaccination mandate for certain groups of people. These measures come as Germany faces a surge in COVID-19 cases.
- “Turkey Summons German Ambassador Over ‘AfD-Led’ Turkish Ship Inspection” – Turkey has summoned the German ambassador to protest against the inspection of a Turkish ship by a German frigate in the Mediterranean Sea. The inspection was led by a member of the far-right Alternative for Germany (AfD) party.
- “European Court of Justice Rules Hungary’s NGO Law Violates EU Law” – The European Court of Justice has ruled that Hungary’s controversial law that restricts the activities of non-governmental organizations (NGOs) violates EU law. The law required NGOs that receive funding from abroad to register as “foreign-funded organizations.”
Please note that these are just a few selected headlines. For more information, you can visit the SPIEGEL International website.
One more try for a specific site:
Prompt: Get some news from ORF. Please only respond in English.
Fetching https://orf.at/ by request of ChatGPT.
AI (1286 tokens used):
Here are some news headlines from ORF:
- Document affair: Trump declares “not guilty”
- Babler presents his new team
- Johnson vs. Sunak: Insults keeping the British on edge
- Slovenia wants to keep borders with Croatia open
- WKStA secures data in the Chancellor’s Office
- Alaba is about to reach the next milestone
- Alpine climate in winter is significantly too mild
- IAEA “very concerned” about fighting near Zaporizhia nuclear power plant
- NATO hopes Ukrainian successes will force Moscow to negotiate
Please note that these are only the headlines and more details can be found on the ORF website.
$ php summarize-url.php https://alex.kirk.at/2023/02/02/what-is-matrix/
Fetching https://alex.kirk.at/2023/02/02/what-is-matrix/ by request of ChatGPT.
AI (1340 tokens used):
Matrix is an open-source internet-based chat system that operates on a federated model similar to email. It allows users to send and receive messages through homeservers, which maintain up-to-date copies of chat rooms. Matrix rooms can be either unencrypted and openly discoverable or end-to-end encrypted and invite-only, with encryption keys shared between users’ client software. There is a wide selection of Matrix clients available for different platforms, and a WordPress plugin called Chatrix has been developed to embed Matrix into WordPress posts or pages.
Here it required several runs to get the right response since it tried to access a lot of invalid URLs. But it eventually managed.
$ php research.php
Prompt: Research on the internet who won the ATP French Open 2023 but don’t use a search engine.
Fetching https://en.wikipedia.org/wiki/2023_French_Open by request of ChatGPT.
AI (1085 tokens used):
According to the information on the Wikipedia page for the 2023 French Open, Novak Djokovic won the ATP Men’s Singles championship.
Things also worked out in the end when I gave it the ability to do multipel requests:
$ php research.php
Prompt: Research on wikipedia who won the (both men’s and women’s) ATP French Open 2023. If you cannot find a result, ask for a subsequent a function call.
Fetching https://en.wikipedia.org/wiki/2023_French_Open_%E2%80%93_Men%27s_Singles by request of ChatGPT.PHP Warning: file_get_contents(https://en.wikipedia.org/wiki/2023_French_Open_%E2%80%93_Men%27s_Singles): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
Fetching https://en.wikipedia.org/wiki/2023_French_Open_%E2%80%93_Women%27s_Singles by request of ChatGPT.PHP Warning: file_get_contents(https://en.wikipedia.org/wiki/2023_French_Open_%E2%80%93_Women%27s_Singles): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
Fetching https://en.wikipedia.org/wiki/2023_French_Open by request of ChatGPT.
AI (1630 tokens used):
The winner of the men’s singles ATP French Open 2023 is Novak Djokovic, and the winner of the women’s singles ATP French Open 2023 is Iga Świątek.
This has been just a quick exploration following OpenAI’s announcement. Curious how we’ll leverage this better in future!
Unfortunately, for larger responses it can feel very slow, whereas the web version feels quite fast. But this is perceived speed because it shows you each word as it arrives and not just the whole response when finished (after all it is a completion AI that generates the response word by word).
So now, I have added streaming support to it. It now feels almost too fast :) The CLI has a few nice things such as readline support (i.e. you can go back to old queries with the up key) and it keeps all of your conversation in a text file. All of this in only 100 lines of PHP.
Over the past year, I’ve been working on the side on a WordPress plugin that implements an idea that has been growing in me over the last couple of years. Decentralized Social Networking. The plugin that does it is called Friends.
Starting with the frustration that there are few alternatives for people who use Facebook: if you don’t want them to own your data but still want to privately keep your friends and family up to date about your live and discuss what interests you, where do you go?
I realize that many people just switched to instant messaging (like WhatApp) which does allow exchanging private messages (and photos) with your friends, but overall I do like the idea of having a more structured publishing platform. I just don’t like a single entity to control it all.
So I realized: We actually had an alternative all along: blogging.
Blogging is decentralized: you decide where you host, you decide which blogs you read and nobody really knows which ones you have subscribed to.
What disqualifies it as an alternative to my wish to keep friends and family up to date, is that it public by default. While there is the option to publish something as “private,” there is not a lot you can then do with a privately published post.
So what if you were easily able to give your friends access to your private posts?
Here comes the Friends plugin. And with it, the downside to the solution:
You need to have your own blog to become friends with each other.
Right now, this is only implemented on WordPress, the technology is framework agnostic, though.
When everyone involved has their own blogging platform and they’d decide where they want to host, we automatically get a decentralized platform.
The technological ingredients to this are actually pretty old:
- REST API
- Authentication via keys
After friendship has been established (this involves both parties accepting friendship and exchange private keys in the background), your server will use that key when requesting your friend’s RSS feed which will in turn (since you are friends) contain private posts. And vice versa.
For commenting, you’ll go to your friend’s blog, it’s a one-click-authentication away. This can also eliminate spam if you only allow friends to comment on your posts.
All of this is highly compatible with standard WordPress: if you want to accept a friend request on your mobile phone, use the WordPress iOS or Android app and change that user’s role to “Friend.”
Chicken-and-egg problem: I use a social network because all my friends are there.
So why use a social network that not all of your friends use (yet)? Because the Friends plugin is actually a pretty decent way to consume RSS feeds.
Since it is based on RSS, it means you can also subscribe any blog or website that offers this well-established way of distributing content.
As you are in control of the server, you can also decide what you’re interested in and tailor the feeds to your liking: you can define rules for incoming feed items and ignore posts you know you won’t be interested in.
I personally like to consume notifications via e-mail as it provides read/unread functionality and I can sort and categorize e-mails to my needs. You can now also read your friends’ posts (or subscriptions) via e-mail. But you don’t need to.
Another method to view your friend posts and subscriptions is the “Friends Page,” a timeline of friend posts and subscriptions. You can therefore scroll down the list of your friend’s posts and subcriptions, just as you see it people doing it all the time on Facebook.
There is quite a bit more to this, you can Emoji react to a post, recommend it specifically to friends, have sections in your posts for friends/not-friends, and more.
Overall, I see this as a way to take blogging to the next level: Choose your private audience. Choose where you host. Publish publically if it’s meant to be public.
It’s clear that setting up and having your own blog is not (yet) for everyone. It’s more work than just signing up for some social network. Often you’ll need to pay for hosting (and domain). But it also gives you the freedom to take your data somewhere else if you want to. Or delete it.
We’ll have to see who will use this. As of now, it’s for a technical audience but maybe someday there will be dedicated Friends-WordPress hosting?
The Friends Plugin is open source under GPL2. If you have a WordPress blog, try it out, and if you think this could be better, different, enhanced: create an issue, or better: create a patch and send a pull request.
Probably it’s not ready for prime time yet, we’re at version 0.14. But it’s getting there, at least I am already using it daily :) There are many ideas left to be implmented, and these are only mine so far.
Oh, if you happen to be in Vienna coming week, I’m going to talk about Decentralized Social Networking with WordPress at our WordPress meetup on November 7, 2018.
Recently I've had the issue to have a completely unsorted Photo Library in Android after migrating to a new phone. The reason is that WhatsApp images are copied into internal storage and end up with the last modification date when they were copied, thus conglomerating together when they should be spread out over time.
The problem is not that trivially to solve because you cannot mount internal storage into a computer and then modify the file dates. Thankfully, I was still able to create a viable solution using a bash script.
It all revolves around the Android Terminal Emulator Termux which allows you to execute scripts on your phone.
- Grant Termux access to your storage directories.
- Install core tools apt install
- Copy this script into your file tree (for example via Android File Transfer):
for f in IMG-20* VID-20* AUD-20*; do [ -e "$f" ] || continue NEWDATE=`echo $f | cut -c5-8`-`echo $f | cut -c9-10`-`echo $f | cut -c10-11` echo touch -d $NEWDATE "$f" touch -d $NEWDATE "$f" done
- Run the script in the directories you need to fix file dates (for example in /storage/emulated/0/WhatsApp/Media/WhatsApp Images)
- Delete the data of MediaStorage (and maybe reboot) to make Android re-index the files with the new file dates.
This year, 2016, the Vienna WordCamp team (which includes me) was able to get WordCamp Europe to come to Vienna. So may I present to you:
Unfortunately it is constantly sold out, but there is a waiting list, should you still decide to come.
Looking forward to the event in June!