Folks, I made a thing – NYT Redirect

So, The New York Times provides a nice service where they put the day’s newspaper’s front page as a PDF up on an obscure URL for anyone to see

https://static01.nyt.com/images/2022/08/26/nytfrontpage/scan.pdf

If you’re a logged in user who wants to use their webapp instead, you can go to –

https://www.nytimes.com/section/todayspaper

If you’re like me, you can never remember how to get to these links.

So, using the power of Cloudflare Workers, I made a little URL redirector that takes you to these pages.

You can access it by going to these URLs –

https://nyt.nitinkhanna.com or https://nyt.nitinkhanna.com/front for the PDF version

https://nyt.nitinkhanna.com/today or https://nyt.nitinkhanna.com/todayspaper for the webapp version

https://nyt.nitinkhanna.com/about for my omg.lol profile which has all this information, including a link to the GitHub repo for this little thing 🙂

Cheers!

Some quality of life improvements on my iPhone

When iOS 15 dropped, I noticed that it added a feature that Shortcuts could run on their own, without user approval every time. This is a pretty major change to the way they were working before, and allows for some truly good automation.

A few months ago, I created a folder in my Photos app called Wallpapers and added subfolders called Morning and Evening. I created automation that runs at Sunrise and Sunset and sets a random wallpaper from the folders as the lockscreen wallpaper. It’s a nice way to update my lockscreen frequently.

Over time though, I got bored of the same few wallpapers, so I’ve created two more automations – these go out to source.unsplash.com and pull wallpapers using simple search terms.

Unsplash has run their free Source endpoint for a long time and even though it’s technically deprecated, they don’t prevent it’s use if you know what you’re doing. The search terms I use are –

https://source.unsplash.com/1080×1920/?Morning and

https://source.unsplash.com/1080×1920/?Sunset

Note that if you put the search term as “Evening”, it leads to some particularly Non-Family Friendly results.

So now, I’ve got 4 automations – on Mondays, Wednesdays, and Fridays, I set Morning and Evening wallpapers from my local folder. On the rest of the days, I let Unsplash send me some nice wallpapers for my phone twice a day.

The best part of this is that the wallpapers from Unsplash don’t get downloaded to my phone and clutter my photos. They directly get used as wallpapers.


The other quality of life improvement I’ve made is webapps!

At some point, I found this shortcut which lets you create a fullpage standalone browser app icon on your iOS homescreen for any URL or website you pass to it.

I had just installed Amazon Luna and rocketcrab as webapps using Safari’s Add to Homescreen feature some time before that, and really like how they come off almost as proper apps (as good an app as Amazon can make, and they make some spectacularly terrible apps).

When you try to turn a website into a webapp but it doesn’t support this feature, it opens in a new tab in Safari, which takes away from the feeling of a standalone app. But the shortcut above solves that problem!

It creates a webapp using a configuration profile, which you then have to go into the settings app to accept. It’s an unsigned profile, so the risk is all yours. But you can look at what the Shortcut is doing and let me know if there are any security concerns.

One caveat – the shortcut asks for an icon image. You better have one ready when you’re using the shortcut and it has to be more than 128×128 pixel. I tried an image that was 64×64 and the icon just turned out blank.

Since I discovered this, I’ve gone on somewhat of a binge. I made webapps (or Web Clips, as iOS calls them) of three webbooks I’m reading on and off (these aren’t available as ebooks in any way). I also often have to check up on my GitHub Actions runs of a particular secret project, so I made a webapp of that direct URL. I made one of my blog, so I can easily go into the admin section and make edits to my posts in the Gutenberg editor (which still doesn’t have proper support in WordPress iOS apps). The only one I haven’t made (and thus opens in Safari) is solitaired.com and that’s basically because I got lazy. I’ll make it one of these days.


From the time I started writing this post, I made another improvement.

I don’t really like Wallpapers cluttering my photos app. Over time, they make a mess, the good ones used to get lost when I moved phones, and overall, it’s a lot of pain to manage them in the Photos app, which needs a long overdue overhaul, Apple.

I figured out that I can make a shortcut that actually picks a random file from a folder in the Files app. So I moved both the Morning and Evening folders to the iCloud Drive and now I can add any good wallpapers I find on my desktop to my phone too! 🙂

I like when things fall into place nicely like this 😀

Cover art is from emoji.supply, which is a ridiculously awesome source of emoji based wallpapers!

Notes on setting up Freedbin

Here are some notes on how to setup Rachel Sharp‘s Freedbin, which is a docker version of the popular Feedbin RSS feed reader.

I had some trouble setting this up on my Windows 10 machine. A lot of issues I faced had to do with setup and environmental variables. I don’t think I faced any real issues due to my host being Windows, other than the terrible thing that Windows 10 itself is. Anyways.

First of all, I had an already running version of postgres for other docker images, so there was a conflict I was not able to resolve, since Rachel’s docker compose file calls its images directly from Docker Hub which are not easily configurable. If someone can guide me to using the same postgres instance for two docker projects, that would be great! Right now, I have two docker containers running postgres.

So, (real) first of all, I downloaded the repo to my own machine to make modifications.

To begin, in the docker-compose.yml, I changed the name of the service from postgres to postgresfeedbin and changed the port to 5433 instead of the 5432 which was already in use.

I also changed the app image from rachsharp/feedbin to a local name freedbin_app and added the build line, so I could build the changes I’m putting in.

I added the restart unless-stopped line to ensure my containers never stop! 🙂

There’s a discussion on the github repo about replacing Postlight’s Mercury service with our own open source version of the same. Postlight has sunset their own servers, so it makes sense to use our own. One alternative is to use Feedbin’s own extract service, but that is available only in the newer version of Feedbin, which Rachel’s docker container doesn’t use. Instead, I already had a docker image of Mercury from the docker hub that I’ve setup for tt-rss and other projects, which I just connected to, using the MERCURY_HOST environment variable. In this setup, the MERCURY_API_KEY doesn’t do anything. Mercury just ignores it and it seems that so does Feedbin.

All of the above are summarized here, as part of the docker-compose.yml file –

app:
    # image: rachsharp/feedbin
    image: freedbin_app
    build: .
    restart: unless-stopped
    environment:
      - MERCURY_HOST=http://192.168.99.100:3000
      - MERCURY_API_KEY=abcd
      - SECRET_KEY_BASE=abcd
      - POSTGRES=postgresfeedbin
      - POSTGRES_USERNAME=feedbiner
      - POSTGRES_PASSWORD=feedbiner
      - PGPASSWORD=feedbin
      - DATABASE_URL=postgres://feedbiner:[email protected]:5433/feedbin_production
[...]
  postgresfeedbin:
    image: postgres
    restart: unless-stopped
    command: -p 5433
    environment:
      - POSTGRES_USER=feedbiner
      - POSTGRES_PASSWORD=feedbiner
    ports:
      - 5433:5433
    expose:
      - 5433
    volumes:
      - postgres_data_feedbin:/var/lib/postgresql/data
volumes:
  redis_data:
  postgres_data_feedbin:

I further had to make changes to the startup_script.sh file as here –

if psql -h postgresfeedbin -p 5433 -U feedbin -lqt | cut -d \| -f 1 | grep -qw feedbin_production; then

As seen, I’ve just pointed it to the new service name and port.

At this point, the service was able to start. I was able to create an account and get in and add feeds. However, I follow a lot of feeds and importing an OPML file makes good sense for me. But, the import settings page was failing to import due to a failed AWS config. I looked up solutions and one way around is just to disable a connector called CarrierWave, which connects to AWS. Guess what gets disabled if you disable CarrierWave? The import/export page.

So, I went about creating an S3 bucket on AWS, getting credentials, and making the S3 bucket publicly accessible. I don’t know why this is the case. Perhaps if we use a newer version of Feedbin, these issues will not pop up, but in Rachel’s version, this is the case, so I went with it.

After I made my S3 bucket and got the AWS credentials, I added them to the Dockerfile as here. The variables are already there, just need to be filled up –

ENV FONT_STYLESHEET=https://fonts.googleapis.com/css?family=Crimson+Text|Domine|Fanwood+Text|Lora|Open+Sans RAILS_ENV=production RACK_ENV=production AWS_ACCESS_KEY_ID='my_key_id' AWS_S3_BUCKET='my_bucket_name' AWS_SECRET_ACCESS_KEY='sooooo_secret!' DEFAULT_URL_OPTIONS_HOST=http://localhost FEEDBIN_URL=http://localhost PUSH_URL=http://example.com RAILS_SERVE_STATIC_FILES=true

There’s one more catch. The Feedbin code uses its own version of CarrierWave called CarrierWave Direct, which defaults to try to use the ‘us-east-1’ region for AWS. If your bucket is there, you’re fine. Mine is in ‘us-west-1’, so I had to go into the /config/initializers/carrierwave.rb file and change the following to add my region –

config.fog_credentials = {
      provider: "AWS",
      aws_access_key_id: ENV["AWS_ACCESS_KEY_ID"],
      aws_secret_access_key: ENV["AWS_SECRET_ACCESS_KEY"],
      region: 'us-west-1',
}

Finally, I am ready to build and deploy. Running the following command –

docker-compose build

You’ll notice a new image in your docker images list –

$ docker images
REPOSITORY                    TAG                 IMAGE ID            CREATED             SIZE
freedbin_app                  latest              20a0334cd11c        30 minutes ago      1.27GB

and now you can deploy –

docker-compose up

It takes a while, as Rachel mentions somewhere, but all services come up perfectly, and I was able to import my OPML file. I noticed that the S3 bucket holds the lone OPML file, so perhaps it won’t cost me any money? Eventually, once I know that the import is done, I’ll go in and delete the bucket.

Big, big thanks to Rachel Sharp for creating Freedbin. It’s a great way to get started on Feedbin and while I was working on setting this up, I learnt how to use docker, created my first Docker container and uploaded my first project to Docker Hub. Hopefully, I’ll be able to build Freedbin from scratch using the latest Feedbin code and Feedbin’s extract service, and using the principles set down by Rachel.

Pythonista + Fever + Instapaper = Quick RSS Magic

I Love Python. It’s a simple, easy and quick to learn language. Before learning Python, the major language I knew was Java and believe me, that’s a pain! Seeing Python grow from a simple scripting language to a major platform is also a great feeling. The recent awesomeness about Python I discovered was Pythonista for iOS. It’s a wonderful app that allows you to run python scripts of varying complexity on your iPhone or iPad without worrying about silly things like Objective C. Of course, it’s not the perfect app, there are limitations to the libraries and you can’t easily transfer scripts to the app from your desktop. But hey, as long as it’s Python, right? Continue reading