Now, a team of researchers at MIT and in China has come up with a solution to the problem of salt accumulation — and in the process developed a desalination system that is both more efficient and less expensive than previous solar desalination methods. The process could also be used to treat contaminated wastewater or to generate steam for sterilizing medical instruments, all without requiring any power source other than sunlight itself.
We have all gotten so familiar with virtualization and abstractions between our software and the servers that run it. These days, “serverless” computing is all the rage, and even “bare metal” is a class of virtual machine. However, every piece of software runs on a server. Since we now live in a world of virtualization, most of these servers are a lot bigger and a lot cheaper than we actually think.
“I’m 51 and I’ve been active in this industry since I was 14. I watched it grow from computers with 4k of memory to having a supercomputer in my pocket. I was learning in the age of Apple II and the Commodore PET. When I realized that I could create an explosion of data with just a few lines of code, I was hooked forever. It was such a magical thing. I found some other guys in my high school that were also into computers and we started meeting regularly on Fridays and Saturdays to… Well, to do some things that were, perhaps, not allowed. Since then, I’ve started three companies, and I don’t think I could have found the same satisfaction in any other industry. I am mindful, these days, that I’m 51 because I know ageism is a thing in tech. There’s a moment when you walk into a room and people think, ‘Oh, he’s a greybeard.’ I don’t have a beard, but you know what I mean. But when I start to talk about things and find solutions, that disappears. I can’t change my age but I am in full control over what I do and what I read and how much time I carve out to write code. I can still see myself doing this when I’m 60, 70 years old. Even older. Because I want to keep doing meaningful things.”
Interesting thread, especially for those of us with an increasing amount of grey.
Relating to the previous link, I can’t believe I’ve never posted a link to this Dr. Drang classic about Donald Knuth and Doug McIlroy’s differing approaches to the word counting problem.
Knuth wrote his program in WEB, a literate programming system of his own devising that used Pascal as its programming language. His program used a clever, purpose-built data structure for keeping track of the words and frequency counts; and the article interleaved with it presented the program lucidly. McIlroy’s review started with an appreciation of Knuth’s presentation and the literate programming technique in general. He discussed the cleverness of the data structure and Knuth’s implementation, pointed out a bug or two, and made suggestions as to how the article could be improved.
And then he calmly and clearly eviscerated the very foundation of Knuth’s program.
A basic solution reads the file line-by-line, converts to lowercase, splits each line into words, and counts the frequencies in a hash table. When that’s done, it converts the hash table to a list of word-count pairs, sorts by count (largest first), and prints them out.
A fascinating read, and the results are surprising. For example, I honestly would have thought the pure Unix implementation would be faster than tested. It also surprises me that Swift is so slow. I wonder if someone who knows the language well could produce an optimized version for this sorting problem.
On my way towards completing another project I needed to setup gpg public key infrastructure. There are many tutorials and explanations about gpg on the web, so I won’t try to explain what it is here. My goal is to simply record how I went about setting it up for myself to securely sign my Git commits.
Most everything here I gathered from this tutorial on dev.to, but since I’m sure I’ll never be able to find it again after today, I’m going to document it here.
First, install gpg with Homebrew:
brew install gpg
Next, generate a new Ed25519 key:
gpg --full-generate-key --expert
We pick option (9) for the first prompt, Elliptic Curve Cryptography, and option (1) for the second, Curve 25519. Pick the defaults for the rest of the prompts, giving the key a descriptive name.
Once finished you should be able to see your key by running:
gpg --list-keys --keyid-format short
The tutorial recommends using a second subkey generated from the first key to actually do the signing. So, we edit the master key by running:
gpg --expert --edit-key XXXXXXX
Replacing XXXXX with the ID of your newly generated key. Once in the gpg command line, enter addkey, and again select ECC and Curve 25519 for the options. Finally, enter save to save the key and exit the command line.
Now when we run gpg --list-keys --keyid-format short we should be able to see a second key listed with the designation [S] after it. The ID will look similar to this:
sub ed25519/599D272D 2021-01-02 [S]
We will need the part after ed25519/, in this case 599D272D. Add that to your global Git configuration file by running:
git config --global user.signingkey 599D272D
If you’d like git to sign every commit, you can add this to your config file:
git config --global commit.gpgsign true
Otherwise, pass the -S flag to your git command to sign individual commits. I’d never remember to do that, so I just sign all of them.
Make sure that gpg is unlocked and ready to use by running:
echo "test" | gpg --clearsign
If that fails, run export GPG_TTY=$(tty) and try again. You should be prompted to unlock GPG with the passphrase set during creation of the key. Enter the export command in your ~/.zshrc to fix this issue.
Finally, Github has a simple way to add gpg keys, but first we’ll need to export the public key:
gpg --armor --export 599D272D
Copy the entire output of that command and enter it into the Github console under Settings, “SSH and GPG keys”, and click on “New GPG key”. Once that’s finished, you should start seeing nice green “Verified” icons next to your commits.