Turning off search in the URL bar of browsers
#353 Henry, Monday, 28 August 2017 10:38 AM (Category: General)
(Tags: search browser firefox chrome)

I have old habits formed from long ago. I have strong likes and dislikes. I often feel out of step with modern computing and modern development and modern web practices.

Many years ago, the Firefox browser changed their URL bar to be both a place to type in a URL and a place where you could type in search terms. It irritated me a little, but I coped. I still have the search bar to the right of the URL bar. I type URLs in the URL bar and most of the time they autocomplete. I type search terms in the URL bar and they search. Lately, it's been bugging me that when I type some terms in the URL bar, the autocomplete doesn't work and it searches on it, and I end up with a Google page of search results. If it happens once in a while, I ignore. But lately, it started happening far more frequently. It started happening enough to trigger my "how can I turn this off" reflex.

Then I remembered that Chrome has a similar issue. They have a URL bar and it's a search bar and URL bar combined, and I have even more problems with this. I was backtracking frequently. And then there's the privacy issue. Sometimes I just want to go to a URL and not let Google know about it. Using Chrome, that's probably futile anyway.

So on the weekend I got triggered enough to do something about it. I searched for ways of turning it off. Yes, I used Google search to find out how to turn off search in the URL bar.

For Firefox, these are the steps.

  1. Bring up about:config
  2. Search on keyword.enabled
  3. Toggle that to False.
  4. Then use the URL bar for URLs and the search bar for search terms.

Chrome is more difficult. You only have one bar to serve both URLs and search. I ended up adding a new search engine, and then making it the default.

  1. Click on the three vertical dots at top right "Customize and control Chrome".
  2. Then choose Settings.
  3. Choose Manage search engines.
  4. To the right, below the default search engines, click on ADD.
  5. Add a new search engine, with Null for both Search engine and Keyword, and http://%s in the URL.
  6. Scroll down to the bottom, and click on the three vertical dots to the right of that entry, and then select Make default.

So now the URL bar is only for URLs. If I want to search, I have the home button turned on, and google.com set as my home page. I click on the home button, then search in there.

So that eases my irritation.

No comments
Blurays and makemkv on Linux
#352 Henry, Monday, 07 August 2017 2:43 PM (Category: Linux)
(Tags: bluray makemkv linux)

My workflow for Blurays has involved Macs for a long time.

I have a portable Bluray drive that I attach to an old MacBook, and I use makemkv to rip the main film to a mkv file, which I then transfer to my Linux desktop, where I process it. I've been doing it that way for quite some years. When I started this process, I don't think Linux handled Bluray, whereas Macs did.

Recently, I did a fresh install of Slackware on my Linux desktop and I noticed what I thought was Bluray support. And then I found that makemkv is available for Linux too, and even better, it's in sbopkg, and even better still, it downloaded and installed and actually worked. I used it to make mkvs from some DVDs.

This weekend, I attached the portable Bluray drive to my Linux desktop, inserted a Bluray and ran makemkv. And it just worked. It looks pretty much as it does on the Mac, and it sure works the same way.

makemkv on Linux

Only thing was, it warned me that it was a beta version and I had 30 days and I needed to register and pay for a license. I dug out my old license key from 2013, entered it, and that was that. I was licensed. It works. It created mkvs of the Bluray titles. Even better, the mkvs include the Bluray subtitles, which can be used by Handbrake. This does everything I want.

Now my Bluray workflow does not involve the Macs at all. It will be a lot faster from now on.

No comments
Fortnightly cron jobs
#351 Henry, Tuesday, 01 August 2017 3:22 PM (Category: Linux)
(Tags: linux cron)

In the League Website that I run, the players requested a fortnightly league - start and stop on Mondays and run for two weeks.

Up till now, I've only every had weekly events or monthly events. I stop and start the events by running scripts from cron. Weekly and monthly are very easy to set up in cron. Turns out fortnightly is not so easy.

Weekly events are easily started with a cron job like this:

59 16 * * 1 $HOME/wgl/bin/weekly_start.py -l15 >> $HOME/wgl/bin/weekly.log 2>&1

My first approach was to think about it and try a few things myself. I failed.

So I searched online for ideas from others. StackOverflow and ServerFault had plenty of ideas about running test in cron. I experimented with it, but found it hard to specify which Monday to start on. It kept starting on the Monday after the one I wanted to start on. The logic was difficult to understand, it was hard to restart and manually fiddle with it. So I kept looking for a simpler solution.

Eventually, I found the SysTutorials website that had a couple of methods of doing it. First, using test in the crontab again. The second way immediately interested me.

They called a shell script every week, and that script would test if it was the first or second week by the existence of a small dotfile. If it was not there, run the rest of the script and create the dotfile. If it was there, delete the dotfile and exit. Very neat, very elegant, and you could set which week to start it on by either changing the logic slightly or touching the dotfile. So I set up cron to do this:

59 16 * * 1 $HOME/wgl/bin/skyfall_start.sh

And the start script looked like this:

#!/bin/bash

# a file marking the state on disk
mark_file=$HOME/wgl/bin/.skyfall-start

# check whether the job run last time it is invoked
if [ -e $mark_file ] ; then
    rm -f $mark_file
else
    touch $mark_file
    exit 0
fi

# Run the league start
$HOME/wgl/bin/fortnight_start.py -l34 >> $HOME/wgl/bin/skyfall.log 2>&1

That worked and got me started. But I thought about it some more and decided I could simplify this a lot. I don't really need a shell script to go in-between cron and the Python fortnight_start.py script. I could build that logic directly into the Python script.

So I simplified cron to look like this:

59 16 * * 1 $HOME/wgl/bin/fortnight_start.py -l34 >> $HOME/wgl/bin/skyfall.log 2>&1

and added this code to the start of the fortnight_start.py Python script:

#!/usr/bin/env python

import sys
import os

home = os.getenv("HOME")
markfile = "%s/.skyfall_start" % (home)

if os.path.isfile(markfile):
    os.remove(markfile)
else:
    fh = open(markfile, 'a')
    fh.close()
    sys.exit(0)

# Rest of the Python to start the league event

That's the simple version without any error checking or exceptions. And for my purposes, I probably won't use any as I control the environment and it works well enough, and if anything goes wrong, my players will rapidly alert me to it.

Having done that, now I can see how to easily create three-week events or two-month events or five-day events or any sort of crazy event. This opens up a lot of possibilities.

I like how the control is a dotfile that I can touch to create, or rm to delete for manual fiddling. That lets me easily restart or switch around events. For non-binary events (example one week on, two weeks off), I could extend it by considering the contents of the dotfile.

No comments
Epub reader
#350 Henry, Sunday, 30 July 2017 2:20 PM (Category: Books)
(Tags: book epub)

I've been using FBReader as my Linux desktop epub reader for a few years. It's pretty neat, lets me test the epubs before I move them into Calibre. Recently, I did a clean Slackware install for my desktop, and now I can't install FBReader. Can't work it out.

This weekend, I've been sorting out a lot of books, cleaning them up, renaming them, removing duplicates, that sort of thing, and I need an epub reader.

I looked online for options and found things like CoolReader, Lucidor, even a command line program called 'epub', but couldn't find them for Slackware or couldn't install them.

It got awkward loading each book into Calibre, viewing it, and then deleting it. Then I remembered that Calibre's ebook reader is a stand-alone application. Found it in /opt/calibre and it's called ebook-viewer. Works just fine. I don't like typing that much each time on the command line so I set up an alias

alias ev='/opt/calibre/ebook-viewer'

and now it's really neat. I just type something like

ev norman_stone__turkey.epub

and I can check it easily. I don't need the other readers any more, I can just work with this one.

No comments
Cheatography
#349 Henry, Saturday, 22 July 2017 1:32 PM (Category: General)
(Tags: cmus cheatsheet)

I've been using cmus as my music player on Linux lately. It's neat, I love it, but I have trouble remembering some of the controls and commands. I went looking for a cheat sheet for it, and I found a couple on Cheatography.

Not only did they have cheat sheets, you can easily create your own. The existing cheat sheets for cmus probably suited their creators, but I have other needs. So I signed up and started building my own. This is a really neat site. I've got most of the info in my own cmus cheat sheet, but I'm not done yet, so I haven't published it. I'll probably have it done this weekend and I'll add it here.

In the meantime, it looks a bit like this:

cmus cheat sheet

EDIT

I finished it and published it. You can download the cmus Cheat Sheet from Cheatography. As time goes by, I will tweak it and maybe add some stuff to it.

No comments