Disabling Waking up Computer via Mouse

My Linux machine keeps on waking up someone moves the mouse. Or kicks the table. While it’ll go back to sleep eventually, I’d rather not have it awake unless I want to use it.

Disabling mouse events to wake up your computer is surprisingly simple. The thing to know is /proc/acpi/wakeup:

❯ cat /proc/acpi/wakeup
Device  S-state   Status   Sysfs node
GPP0      S4    *disabled
GPP1      S4    *enabled   pci:0000:00:01.2
GPP2      S4    *disabled
GPP3      S4    *disabled
GPP4      S4    *enabled   pci:0000:00:01.5
GPP5      S4    *enabled   pci:0000:00:01.6
GPP6      S4    *disabled
GP17      S4    *enabled   pci:0000:00:08.1
XHC0      S3    *enabled   pci:0000:04:00.3
XHC1      S3    *enabled   pci:0000:04:00.4
GP18      S4    *enabled   pci:0000:00:08.2
SIO1      S3    *disabled  pnp:00:03

XHCx is the USB 3 controller which is where the mouse is connected to. Turn off via

echo "XHC0" >/proc/acpi/wakeup
echo "XHC1" >/proc/acpi/wakeup

and that’s it! To make it persistent put this into /etc/rc.local and make sure it runs during power-up.


Running the echo command again will simply change between disabled and enabled.

More Bicycle Fixing

The rear gear changing shift level I had broke partially. Downshifting was fine. Upshifting worked except I had to manually push the lever into its original position in order to change another gear up. Root cause was the steel spring to reset that lever rusted away.

Replacing it with a new one like this was surprisingly cheap and quick: 1900 Yen, about 15 minutes work.

I’m getting the hang of fixing my bike!

Summer in Japan

Summer in Japan has one drawback. Actually there are 3: it’s hot and humid. And cockroaches like that.

According to this article, there’s a new thing out which seems to work very well. Having studied chemistry, I was naturally curious what it’s active ingredient is.

Here is the product page from the manufacturer. The back of the product packaging shows the ingredients:

d.d-T Cyphenothrin it is.

Here the Wikipedia article. Very short. Has one reference to a PubMed.gov article. I knew cockroaches are pretty sturdy, but this was new to me:

Resistance to organophosphorous and carbamate insecticides amongst German cockroaches is widely reported.

Tilak, R; Agrawal, VK; Dutta, J (2005). “Field performance of cyphenothrin: An integrated insecticide strategy against German cockroaches (Dictyoptera: Blatellidae)”. Journal of Vector Borne Diseases. 42 (2): 68–73. PMID 16161703.

To get a lot more details, have a look here from PubChem.

Important data points:

  • Very toxic for aquatic life
  • LD50 (rat) via oral: 318mg/kg, so for an average human (70kg), eating 22g has 50% chance of killing your (assuming the toxicity is same for rats and humans)
  • LD50 via skin is way higher

And here I found the d.d-T part:

TL;DR: I’ll buy one to test it out. I won’t drink it and I’ll be careful to not get this into water.

Fixing my Bicycle

While riding my bike a while ago, the bottom bracket gear cable guide broke. I got a generic replacement which looked similar enough. Made by Shimano. For about 350 Yen. Awesome! What could go wrong?

Turns out a lot: the diameter it’s made for is smaller than the one needed for my bicycle. And the included screw has a different thread than the existing one. And there’s an extra plastic alignment knob. So it seems those bottom bracket gear cable guides are not all the same. Well, live and learn.

However not all is lost! I still have the original screw and it fits into the screw hole of the new cable guide. The alignment knob I could easily cut off with a chisel. The plastic used is thermoplastic, to heating it up a bit makes it bend enough to fit. The cable for the front derailleur would (just) rub against the aluminium frame, so a piece of UHMWPE adhesive tape fixes that.

I replaced the complete gear cables. They were rusty although that seems to not matter much. The new cable with the new housing is smoother though. Without a dedicated cable cutter, I used my Dremel to cut the housing. That’s a tough piece of housing!

Adjusting the derailleurs was easier than I expected. It’s smoother now than it was before, although I cannot say why: could be the cleaning of the chain and other moving parts, or the adjusted derailleurs, or the new cables.

I also replaced the front break pads. I guess 14 years is a good time to replace them. The new ones I got work very well. Quieter and breaking better. I’ll replace the one in the back too, and maybe the complete brakes as they are rusty enough to worry me a bit.

Summary: Total costs of parts: about 4000 Yen. Tools I had to buy: mainly a bicycle stand (3500 Yen). Got a torque wrench, although I did not need it in the end.

Cloudflare Workers and Backblaze’s S3 API

I use CF Worker to deliver the static copy of my old blogs. Files are stored in Backblaze’ B2. Here is how this works:

import { AwsClient } from 'aws4fetch'

// Those come from Workers secrets

const aws = new AwsClient({
    "accessKeyId": ACCESSKEYID,
    "secretAccessKey": SECRETACCESSKEY

// Hosting static web files on BackBlaze's B2
// Bucket: blog
// Directory inside bucket: static/

const B2BaseUrl = 'https://s3.us-west-000.backblazeb2.com/blog/static/';

addEventListener('fetch', event => {

async function handleRequest(request) {
  let response;

  if (request.method !== 'GET') {
    response = new Response('Expect only GET requests', { status: 400 })
  } else {
    let b2Url = request.url.split('/').slice(3).join('/');
    if (b2Url == "" || b2Url == "/") {
	    b2Url = "index.html";
    b2Url = B2BaseUrl + b2Url;

    let signedRequest = await aws.sign(b2Url);

    response = await fetch(signedRequest);
    // Make the headers mutable by re-constructing the Response.
    response = new Response(response.body, response);
    response.headers.set('Cache-Control', 'max-age=7200')
  return response;

To set up the 2 secrets (repeat with SECRETACCESSKEY):

❯ wrangler secret put ACCESSKEYID
Enter the secret text you'd like assigned to the variable ACCESSKEYID on the script named blog-static:

I used the native B2 API before, but there’s no way (I found) to not constantly refresh the download key as the max lifetime for such a key was 1 week. The S3 API is much easier as it’s fixed (inside the secrets).

My Bicycle

Long time ago, around 2007, I bought a bike: Specialized Crossrider XC Sport. Maintenance free except a dab of oil for the gears and chain. I recently replaced the wheel’s tire recently. And the inner tubes have been replaced I think a total of 3 times.

And with “maintenance free” I mean: not maintained.

Last weekend a small plastic piece (bottom bracket cable guide) broke and it rendered the gear mechanism useless. With no tension on that cable anymore, it changed to the 8th gear. I was able to use Velcro to change to 3rd gear, but it’s effectively a single speed bicycle now.

That needs to be fixed.

Turns out that I know next to nothing about this bicycle. Or bicycles in general. Bottom bracket didn’t mean anything to me 3 days ago. And I had no idea that you can have 12 gears now in the back and it’s very smooth to change.

Time for an update!

But first I had to know what I had at my hands. Only now I found the specs of my bicycle (from here):

定価(税込) \71,400
カラー ルートビア
サイズ 49、52、55
フレーム A1プレミアムアルミ
フォーク SPECIALIZED TCR-043D、63mm
リアショック NA
ヘッドセット 1-1/8″ Threadless、フルインテグレート、
ハンドルバー A1アルミ、フラット、600mm幅
ステム 3D 鍛造アルミ、15゜ライズ
グリップ BG Comfort、トリプルデンシティ
ブレーキ Vブレーキ
ブレーキレバー SHIMANO Alivio
フロントディレーラー SHIMANO Nexave、31.8クランプ、ボトムプル
リアディレーラー SHIMANO Deore、ロングケージ
シフター SHIMANO Alivio ラピッドファイアー
フリー SHIMANO HG40、8スピード、11-32T
チェーン SHIMANO HG53(違う?) 114リンク
クランクセット Sugino RD Comp
チェーンリング 48A/38S/28S
ボトムブラッケト SHIMANO UN25、68×113mm
ペダル アロイ
リム Alex DH-19、700c、ダブルウォール
フロントハブ SPECIALIZED、鍛造、32H、QR
リアハブ SHIMANO Paralax、鍛造、32H、QR
スポーク 2.0mm(#14)、ステンレス、真鍮ニップル、293mm(291でも可能だった)
フロントタイヤ 700×38c、アラミドビード
リアタイヤ 700×38c、SPECIALIZED クロスロード
チューブ SPECIALIZED シュレッダーバルブ
サドル BG Indie
シートポスト 鍛造6061 アロイ、27.2φ×350mm
ウェイト 12.7Kg

What I was looking for were the gears for the gear ratio (most popular for me is about 1:1.7) and the bottom bracket bearing type and size as I think I need a replacement. There’s enough rust there to indicate old age.

Update: According to this common single speed gear ratio are:

  • 700c off-road: 1.75:1
  • 700c on road: 2.3:1

Firebase Real Time Updates

Firebase Cloud Firestore has the nice feature of being able to tell you about changes to its data. Here’s how this looks like using Node.js:


A Firebase Cloud Firestore DB, named ‘messages’. Has 2 entries per document: sender and text, both being strings.

The sample Firebase Cloud Firestore DB

Service Account Key

Get your service account secret from

Service account: Generate your private key

Get your private key in JSON format.

Watching the DB

const admin = require('firebase-admin');

const serviceAccount = require('./chat-53a8e-firebase.json');

  credential: admin.credential.cert(serviceAccount),
  databaseURL: "https://chat-53a8e.firebaseio.com"

const db = admin.firestore();

async function dumpDB() {
  const dbRef = db.collection('messages');
  const doc = await dbRef.get();
  if (doc.exists) {
  } else {
    doc.forEach(doc => {
      console.log(`${doc.id} -> ${doc.data().sender}, ${doc.data().text}`);

async function watchDB() {
  // const observer = db.collection('messages').where('sender', '==', 'someone@else.com')
  // .onSnapshot(querySnapshot => {
  const observer = db.collection('messages')
    .onSnapshot(querySnapshot => {
      querySnapshot.docChanges().forEach(change => {
        if (change.type === 'added') {
          console.log('Added ', change.doc.data());
        if (change.type === 'modified') {
          console.log('Modified ', change.doc.data());
        if (change.type === 'removed') {
          console.log('Removed ', change.doc.data());


When changing entries (via any application incl. the Firebase DB UI), you’ll get entries like

Updates coming in!

Update 2020-07-11: Tested on my Orange Pi Zero (256MB RAM version) with Armbian and Node.js 14.5.0, and not only does it work fine (as expected), it used only about 16MB RAM while running and listening for events from the Firebase Cloud Firestore. For comparison: Linux itself uses about 100MB.

vmware Horizon Client on Ubuntu with Firefox

Sometimes things “just” work on Linux, and sometimes it’s a bit more fiddling. It’s the latter when running vmware Horizon client with Firefox. But as so often, there’s a fix here.

Copy&pasted the answer here:

  1. Download the client from the VMWare Horizon Client for 64-bit Linux
  2. In Firefox, open about:config and click through the warning.
  3. Add a new boolean entry called network.protocol-handler.expose.vmware-view and set the value to false
  4. Create a file called ‘test.html’ somewhere on your computer and put the following in it:
    <html><a href=’vmware-view://example.com’>test</a></html>
  5. Open the file in Firefox and click on the link, which should prompt you for a path to open the link.
  6. Select /usr/bin/vmware-view and it should work for future uses!
Create your website at WordPress.com
Get started