How to disable notification (and location) requests in Firefox for Android

24 July 2019 by Lincoln Ramsay

The internet is awash in articles explaining how to disable notification requests in Firefox. But none of them bother to point out that the settings they mention don’t exist on Firefox for Android.

I eventually tracked down a config item that gives you the same effect.

Go to the URL bar and type about:config.

In the search box, type dom.webnotifications.enabled.

Click on the item and toggle it (to false).

Congratulations! You will no longer be prompted to enable notifications on Firefox for Android.

Location requests

Go to the URL bar and type about:config.

In the search box, type geo.enabled.

Click on the item and toggle it (to false).

Congratulations! You will no longer be prompted to share you location with websites on Firefox for Android.

The time my phone almost died

26 November 2018 by Lincoln Ramsay

I love my phone. It’s a Sony Z3 Compact. I can’t stand the way phones keep getting bigger, so my next phone will most likely also be a Sony Compact phone.

Apparently, the Z3C has a well-known design flaw. The frame flexes more than it should, and combined with the heat the system can generate, it loosens the adhesives and allows the front screen to lift up. This happened to me, but it was a small lift (top corner) that didn’t really impact on my use of the phone, so I put off doing anything about it.

About a year ago, I asked about it on XDA and someone gave me some pointers. Apparently it’s not very hard to replace a screen. Still, I’d never done this kind of thing before so I waited. I had noticed an occasional visual glitch that I took to be related to the lifting screen but it wasn’t a bit deal.

About 3 weeks ago, I managed to drop the phone onto the floor and the adhesive decided that it had had enough. The front screen practically came off the phone. It was time to do some fixing. more…

Remove the Jira notification badge

10 August 2018 by Lincoln Ramsay

I use Jira at work and there’s this really annoying thing…

That unassuming bell icon. As it appears here, it’s inoffensive and something I can happily ignore. But every time Jira sends me an email, it also puts a badge on this icon. Worse, making it go away mean clicking it, waiting for the page to load, then clicking on a tiny “mark as read” link.

I’m not the only one it has annoyed. There’s a Jira issue here: JRACLOUD-69724

Not being content to just ignore it, I went ahead and created my own workaround. It’s a userscript that removes the element from the page.

Get it here: remove_jira_notifications.user.js

I have only tested it on the specific, hosted Jira I use at work (not the same site being matched by the script – you’ll need to set that appropriately for your Jira), and only with Firefox 61 on Linux using Tampermonkey as the userscript manager.

Update Feb 2021

I probably haven’t noticed all the changes I’ve made over time (since Jira/Confluence are a moving target) but with any luck, that shouldn’t matter because Tampermonkey will auto-update the script when I push a new revision.

Update 20 Aug 2018

I found some pages that load elements after the page has finished loading so the script handles that now. And it removes the same element on Confluence pages (the link is slightly different).

Update 10 Oct 2018

JIRA changed from a link to a button element. The script now handles that (as well as the old link, just in case).

Update 17 Dec 2018

Confluence changed to a similar system to JIRA (but with a div instead of a button).

Update 10 Mar 2020

Confluence moved the navigation to the top and changed to a span, and it gets added twice now.

Update 13 Mar 2020

JIRA moved the navigation to the top and changed to a span, and it gets added twice now.

Update 21 Jul 2020

Confluence changes the location without reloading the page. The script now checks whenever this happens (mostly noticeable as editing a page causing the icon to appear).

Update 4 Aug 2020

When publishing a page, the icon appears 3 times! Handle this. The script was also changed to just pick up every site (removing the need to edit the script).

The time my computer almost died

04 August 2018 by Lincoln Ramsay

I have a 2011 MacBook Pro. It’s old, but it’s also good. Until very recently, no newer models could take more RAM (I have 16GB, mostly because the incremental cost over getting 8GB was so low). Newer models do have higher res screens, but I really don’t care. One place where newer models completely fail is in the storage department. The new 15″ MacBook Pros may finally be interesting to me but I currently have a 13″ system and those ones did not get the same upgrades.

My computer came with a 128GB SSD and a CD drive. Within days of getting the machine though, the optical drive was removed and an Optibay put in (with the optical drive relegated to an external enclosure). I put in an extra 500GB of storage for a tiny fraction of what SSDs cost at the time.

Over time, the amount of things I could fit on the 128GB boot volume seems to have gone down. There has been a gradual movement of things to the hard drive (besides the obvious long-term non-speed-dependent things that started there). The computer is still mostly snappy, but some things are slower just because they rely on files on the hard disk.

Anyway, everything has been great with my setup for a very long time. That all changed a month ago. more…

Random MAC address on an fake ASIX USB ethernet device

22 June 2017 by Lincoln Ramsay

I have 2 USB ethernet adapters at work. They are cheap chinese things. I’m pretty sure they are the same thing this guy examined in detail.

They had been working just fine for quite some time but today, one of them broke. I don’t know what happened, but I suspect there must be some NAND used to store configuration that has gone bad. The primary symptoms I can see are that some of the USB things are different (eg. serial number is now 1 instead of 2) and most annoyingly, the MAC address cannot be read.

The main problem this causes that on every insert, the device is given a random MAC address so I can’t associate permanent network settings with it anymore. But since it does show up slightly differently to the working adapter, I can fix it with a udev rule.

Before it broke, it came up with MAC address 00:90:9A:9A:A9:39 and (through a udev rule) was assigned the name eth4. That udev rule no longer works so I had to make this rule to set both things in one go.

# This fake ASIX USB ethernet device is broken and forgets its MAC address
ATTRS{idProduct}==”772a”, ATTRS{idVendor}==”0b95″, ATTRS{serial}==”000001″, NAME=”eth4″, RUN+=”/usr/bin/macchanger -m 00:90:9A:9A:A9:39 %k”

Let’s Encrypt, acme.sh and cpanel deployment

09 June 2017 by Lincoln Ramsay

This site was using a startssl certificate but… the certificate expired (I got an email mere hours before this happened) and when I went to update the certificate, startssl had somehow forgot all about me. It seems there was an ownership change and I found some things that made me decide a new certificate provider might be a good idea.

So I decided to get a Let’s Encrypt certificate instead. But I can’t run their suggested client (certbot) because I’m on a shared webhost without root access.

But I found acme.sh, which does the same thing certbot does without root or the heavy python dependencies. Apparently it will even handle auto-renewing my certificates for me.

New: This is the TL;DR version that just works.

ssh yasmar.net
curl https://get.acme.sh | sh
exit # probably could have just re-sourced .bashrc...
ssh yasmar.net
acme.sh --issue -d yasmar.net -w ~/public_html
acme.sh --deploy -d yasmar.net --deploy-hook cpanel_uapi

Back to the original story…

However, there was no cpanel_uapi deploy hook originally. So acme.sh could not deploy my new certificates to cpanel. Bummer. Luckily, I found a cpanel API reference to do just that and whipped up a bit of perl code (only slightly changed from the reference) that deploys certificates to cpanel. My change is here.

For the record, here’s how I got everything going.

ssh yasmar.net
curl https://get.acme.sh | sh
exit # probably could have just re-sourced .bashrc...
ssh yasmar.net
acme.sh --issue -d yasmar.net -w ~/public_html
acme.sh --deploy -d yasmar.net --deploy-hook cpanel

Though, the deploy step will do nothing without my modified cpanel.sh script. It has 3 important variables:

export DEPLOY_CPANEL_USER=myusername
export DEPLOY_CPANEL_HOSTNAME=localhost:2083

In my case, I had to use a real hostname instead of localhost to access cpanel.

My script is quick and dirty and doesn’t do any error checking. But it prints out the response so hopefully if there’s a problem it’ll be clear why.

It looks like the deploy hook is saved so when my certificate auto-renews, it should auto-deploy. I’ll know for sure in 60 days time.

Update: It did automatically renew and deploy 🙂

Update (June, 2018)

So my hosting company decided to seriously break perl. LWP was removed and there’s no compiler so I can’t install any equivalent CPAN modules. However, PHP is present and works just fine, so I have updated the deployment script. The new code is here.

With PHP, I can use the expected localhost:2083 to access cpanel, which is nice.

Update (again)

However, while looking at pushing this to the upstream project, I noticed that someone else has implemented support for the cpanel uapi command (which my hosting provider has). This has the advantage that you don’t need to put your credentials into a file and since it’s a cpanel thing, it probably won’t break in the future.

   acme.sh --deploy -d yasmar.net --deploy-hook cpanel_uapi

Rogue for Android

21 February 2017 by Lincoln Ramsay

This is the story of how I came to find myself porting rogue to Android.

I’ve played various roguelikes on a number of occasions over the years. One in particular stands out for me though. It was called PocketRogue and it was a straight port of rogue for PalmOS. I played it on a Treo, where the keyboard came in handy. I even got the source code but it was a CodeWarrior project that I never managed to port to the prc-tools environment.

When I got an Android phone I looked for roguelikes but was sorely disappointed in what I found. There were lots of apps available but most of them just didn’t work on my phone. I get the feeling most of them were designed to run on larger tablets with a physical keyboard attached or something. Luckily though, I found the excellent Pixel Dungeon (and later, its many forks) to satisfy my roguelike cravings. However, despite being an excellent roguelike that actually plays well on a phone, I find myself sometimes missing the simple charms of the classic ASCII interface and the simpler gameplay that rogue has.

So I did some experimenting… more…

Pina Colada

09 November 2016 by Lincoln Ramsay

Here is the Pina Colada recipe I’ve been working on. I’ve been wanting to put this together for ages and finally got around to it.

Pina Colada

1 measure of coconut cream
2 measures of pineapple juice
1 measure of rum
5 large ice cubes
half a measure of simple syrup (or 2 teaspoons icing sugar)

Put all the ingredients into a Thermomix (blender)
Mix on speed 6 until smooth
Pour into a glass
Put on Escape (The Pina Colada Song) and contemplate the lyrics while you enjoy the drink

I use a 1/3 cup measure which happens to make exactly the right amount to fill up my cup.
Simple syrup (1:1 sugar to water) doesn’t have to dissolve. Icing sugar is better at dissolving than regular sugar if you don’t have syrup.
If you start with colder ingredients (eg. store in the fridge or freezer), you’ll get a nice slushy texture. But really, as long as the drink ends up cold, it’ll be fine.
The official standards say to use white rum but I have made this with Bundaberg rum and it’s just as good, if not better (but then I do like the taste of rum).

How to factory reset a Brother HL-2170W printer

13 July 2016 by Lincoln Ramsay

I have a Brother HL-2170W printer. It’s great, and has been quietly getting on with it’s job for years.

But yesterday, I went to print something and it didn’t work. The printer has been running wirelessly because even though it now sits near the router, it used to be half a house away and I never bothered to change the configuration. But now it didn’t show up on the network at all.

I upgraded my router on the weekend… so I figured maybe it got confused and just needed some kind of reset to be able to connect again. I plugged in an ethernet cable but it quietly ignored it. Hmm…

I searched and found a guide to get the wireless going. The first thing it suggested was to do a factory reset. That sounded like a good idea. But it had no effect. Hmm…

So I started trying ever-more desperate options. I confirmed the printer was still operational by printing over USB. I confirmed the ethernet wasn’t burned out by running tcpdump (the printer sent a BOOTP probe at boot, but then it turned off the ethernet port).

Just as I was starting to feel hopeless, I stumbled onto a page telling me how to factory reset the printer. It was different to the instructions on the other page. Here is how you factory reset a Brother HL-2170W printer.

  1. Turn the printer off
  2. Hold the Go button
  3. Turn the printer on
  4. Wait for the LEDS to come on (this was near-instant for me)
  5. Release the Go button
  6. Press the Go button 7 times

The incorrect instructions told me to press it 10 times, which caused the printer to reboot and then print a test page. But crucially, the settings did not reset.

Of course after doing a factory reset, the ethernet came up properly so I could connect to the printer and configure the wireless again. I found a setting where you could set the ethernet or wireless as the only interface. I may have disabled ethernet back when I first setup the printer (explaining why it turned the port off).

As a bonus, I noticed the plethora of (probably insecure) services the printer was offering to the world. I turned them all off because nobody even accesses the printer directly anymore. The iOS devices need AirPrint and the Windows 10 devices need to be rebooted (!) if the printer runs out of paper during a job. So everybody connects to CUPS on my server now.

How I found a bug in a USB Ethernet driver

02 April 2016 by Lincoln Ramsay

I have an old USB ethernet device. It’s an ADMtek ADM8511 “Pegasus II”. Apparently I am the only person left on the planet with this device because it has been causing kernel panics since Linux 3.10 (released around 3 years ago).

I had been using this device at work (to connect things to my computer without letting them access the office network) but when we finally upgraded from Ubuntu 10.04 (to Ubuntu 14.04), it started locking up the machine. Since it was work and time is money, I just bought a USB ethernet adapter that used a different chipset and put this one in a drawer.

At home, I have a machine that I’d like to dual home for… reasons. It’s also running Ubuntu 14.04. I got out the adapter and tried it out and sure enough, it caused lockups. But this time, I was willing to put a bit of time into investigating it since having it work was not critical.

I raised a bug and included as much information I could get from the system. One of the more interesting things I found out was netconsole, where a Linux system sends its logs out via UDP (and another machine captures this to a file). This is handy when the machine is kernel panicking because you don’t need to take a photo of the message and things that don’t fit on one screen can also be reported.

One annoying thing was that the bug triage person insisted I update my BIOS and re-test. Which meant I had to get Windows on the machine. I ended up making a “portable Windows” USB stick on an old (slow) SD card so that I could run the BIOS update program.

Next up was running a current kernel, v4.5 to verify that the issue had not been fixed yet. Then I had to establish roughly when the bug was introduced. I did a manual bisect of the releases (downloading 33 kernels in the process) to establish that it was a Saucy kernel that introduced the bug. Specifically, kernel 3.9.0-7.15 was good while the next kernel 3.10.0-0.6 was bad.

Then, I had to download a git repo and bisect the code. I was a bit shocked to find there was around 14,000 commits between those two tags! Thankfully, I only had to do 11 builds to identify the problem (though my poor machine could only manage one build every 2 hours and I had to be physically at the machine for the test so I could only get in 2 or 3 tests per day).

Interestingly, there were 3 commits in a row specifically for the pegasus driver. But it was the first one that caused the bug, or was it? Upon inspection, the commit looked ok (it was replacing an apparently unnecessary pool of buffers with demand-allocated buffers). It did look like the new code would consistently allocate 2 bytes less than the old code but I think that was more or less a padding/alignment thing that should have ended up equivalent. The real problem was elsewhere in the driver where the code was reading PEGASUS_MTU + 8 bytes into the buffer, which had been allocated to PEGASUS_MTU bytes. WTF?! I can only guess the pool allocation pattern meant that the overflow did not clobber important memory but once it switched to demand allocation, it started doing so. I did try git blame to see how this code got this way but apparently, it happened before Linux was in git.

I wonder if my proposed fix (changing the read to use PEGASUS_MTU bytes) can make it into the kernel with my name still on it? That would be cool. I have never pushed code to the upstream Linux kernel before.


It got in. And my name is there 🙂


← Older posts

Newer posts →