Wednesday, November 30, 2022

Vim keybindings for CTLR+S save and CTRL+C copy all.

Turn CTLR + S into "save"

:noremap <C-s> :w


Turn CTRL+C into "select all + copy"

:nnoremap <C-c> :%y+


Now to save just press CTLR+S then enter.  Or CTRL+C then enter to select all and copy.

Sunday, August 14, 2022

Microsoft Edge browser add new search engine like Brave Search or Startpage

- Open Edge
- Open Settings
- In left menu click "Privacy, search, and services"
- Click "Address bar and search" at bottom
- Click "Manage search engines"
- Click Add button
- For name put in Brave
- For keyword put in search.brave.com - Put this in last box

https://search.brave.com/search?q=%s

- For keyword put in search.brave.com
- Click add button
- The search engine is now added, but not set to default yet!
- Find it in the list, click the 3 dots next to it and pick Make Default

Brave is now your default search engine in brave.

Here is the search string for Startpage

https://www.startpage.com/sp/search?query=%s

Here is the search string for Webcrawler

https://www.webcrawler.com/serp?q=%s

Thursday, August 04, 2022

Ubuntu LibreCalc freezes opening CSV file, max CPU

I've used LibreCalc to open CSV for a long time, but recently most of the time LibreCalc would not open CSV, LibreCalc would hang and CPU would max to 100% until I kill the program.

I tried to uninstall / reinstall but that didn't help. I tried to run from the terminal to see if there was any error message but there was not.

What fixed this problem of LibreCalc freezing was this :

- uninstall LibreOffice entirely
- go into File Manager
- go into hidden folder .config
- delete libreoffice folder
- then reinstall LibreCalc

After I did that LibreCalc opens CSV files again normally without always freezing.

Wednesday, March 23, 2022

Red Hat sluggish, CPU MHz wont increase with system load

Doesn't matter which CPU governor I use the CPU freq wont drop to idle (800mhz) and wont increase to max power. This problem not seen with Debian based systems on same laptop.

This is the CPU frequency under load:

#cat /proc/cpuinfo | grep MHz
cpu MHz : 1094.404
cpu MHz : 1094.400
CPU Governor is set to performance which should quickly scale to max MHz frequency (but isn't)

#cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
performance
performance

#lscpu | grep MHz
CPU MHz: 1094.055
CPU max MHz: 2800.0000
CPU min MHz: 800.0000

The fix for me was this command :

#tuned-adm profile desktop

After this the CPU frequency immediately started to go up and down with system load like normal.  The previous profile (default) was "throughput-performance" which for whatever reason wasn't working well.

Friday, March 11, 2022

Firefox hide "title bar" in Linux / Ubuntu

Chrome and browsers based on Chromium have a compact layout where the normal application top title bar is hidden. However Firefox by default shows this (useless) title bar. To disable this and have a more compact layout do this

- In firefox right click in a blank space where tabs go
- Pick customize toolbar
- In the bottom left uncheck the box "Title bar"

Sunday, February 20, 2022

Fedora install problems on Acer laptop

Trying to install Fedora 35 on my Acer laptop and ran into several error messages and it took a long time for the installer to boot. After waiting a while the installer bootup gave like 5 errors in a row including failing to start the window manager LXDM.

The simple fix for this was to go into the Bios and turn off Intel VTX and Intel VTD. After that the installer ran ok with no errors.


 

Friday, February 04, 2022

Get SHA1 using vanilla Javascript with no extra libraries

Searched this for a while and didn't find a good answer.  Then finally stumbled upon someone else who pointed out that Browsers have built in crypto functions.

Here is the example code.  Only works on HTTPS pages.

let message = "Test string for SHA1";
let msgUint8 = new TextEncoder().encode(message);
let hashBuffer = await crypto.subtle.digest('SHA-1', msgUint8);
let hashArray = Array.from(new Uint8Array(hashBuffer));
let sha1 = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');


I tested this against PHP sha() and get the same values.

PHP :

365525a324d3c73e01574500261d5642e1b8ea33

JS:

365525a324d3c73e01574500261d5642e1b8ea33

MDN page on this:

https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest

//]]>