web

Extracting title title of a web page from the command line

I was using a REST API at https://textance.herokuapp.com/title but it seems awfully fragile. Sure enough this morning, the entire application is down. It’s also not open-source and I have no idea who actually runs this thing. Here’s the solution: #!/bin/bash url=$(pbpaste) curl $url -so - | pup 'meta[property=og:title] attr{content}' It does require pup. On macOS, you can install via brew install pup. There are other ways using regular expressions but no dependency on pup but parsing HTML with regex is not such a good idea.

My favourite Cyrillic font

I’ve tried a lot of fonts for Cyrillic. My favourite is Georgia. As a non-native Russian speaker, there’s something about serif fonts, either on-screen or in print, that makes the text so much more legible.

Saturday, September 15, 2018

Interestingly, Fox News rejects requests from the Tor Browser. The New York Times loads perfectly normally via Tor. I don’t often visit Fox News but an article title caught my attention.

Using lynx to bypass ad block detection

web
Organizing works as playlists and folders It turns out that command line text web browers like lynx can bypass AdBlock detection. On macOS, I installed lynx using Homebrew. Then from the Terminal, it’s just lynx your-url. It’s actually quite pleasant to read text without all of the images and fluff.

How to disable links opening in a new tab

web
One of the most infuriating UX choices on the web is the developer’s choice to open every single link in a new tab. There are a few sites I interact with, including Aliexpress, where the designers have inflicted this on the users. Fortunately, I found a solution. The Chrome extension target="_blank"-toggler works well. When you hover over a link which would open in a new tab, it superimposes a visual signal.

Using Python and AppleScript to get notified if a site is down

I manage a handful of websites, like this one. Having built a few on other platforms, such as Drupal, I’m familiar with the dreaded error “The website encountered an unexpected error. Please try again later." On sites that I don’t check on frequently, it can be an embarrassment when people begin emailing you with questions about the site being down. I wrote the following Python script to deal with the problem:

Using AdBlock Plus to block YouTube comments

web
YouTube comments are some of the most offensive on the web. Even serious videos attract trolls bent on inscribing their offensiveness and cruelness on the web. Here’s one method of dealing with YouTube comments. Treat the comments block as an advertisement and block it.^[There are other ways of avoiding YouTube comments. I’ve used ViewPure but it’s hard to find content that way even though they seem to be working on making it more seamless to get from YouTube to ViewPure.