Powertoys are huge

These free utitilies are quite nice and helpful, as they have functionality missing in stock windows since Win95. The current incarnation includes useful features like:

  • Rename multiple files with regex
  • “keep on top” setting for windows
  • prevent standby
  • quick image resize

I read a couple of mentions which stated something like “it’s only 3MB”.

After the hefty 80MB download and install, this was the result:

371MB! Thats like 100x more than the articles mentioned. A quick check on the contents revealed the reason, DLLs multiple times included:

Since I like portable programs to be small and non-portables to include DLLs just once the old smaller freeware helpers not from MS will need to stay a bit longer.

Declaring arrays with sizes unknown

Recently, while skimming through udemy C-courses I learned something which never occured to me before, and also hadn’t read about:

It’s possible to declare an array of which the final size is not known at compile time, just by using the address of the *size*. Also, same course featured “a[i] can be written as i[a]”.

#include<stdio.h>
int main(){
	int size = 0;
	printf("Size of array: ");
	scanf("%d",&size);             //dynamically set size
	int arr[size];
	printf("ints one by one confirmed by ENTER:\n");
	for(int i = 0; i < size; i++)
	{
	    scanf("%d",&arr[i]);
	}
	printf("Entered values: ");
	for(int i = 0; i < size; i++)
	{
	    printf(" %d", i[arr]);  //i[arr] same as arr[i]!
	}

}

🤯

Pluralsight technically blind

I’m blocked from all access to pluralsight, cause: unusual behaviour

What exactly? No idea.

Interesting courses I might watch from start to finish, often at 1.4-1.6x speed. Already known basics I might skip in the 10s increments the UI allows or go to 2x.

Other courses only peripherelly interesting I usually read reviews, skim through the transcript and if there is a particularly interesting point in the table of contents I might watch that.

Bad behaviour in the eyes of pluralsight.

In the previous years free-weekends I got temporarily banned for that, support mails usually include something like “yes, can confirm, you’re unbanned, but be warned: Next time…”.

Pluralsight seems to have a huge fear of people ripping off their content.

They miss the point, people not only come to their site for content but for the badges. The content is really not that deep and detailed, as most courses I encountered are 2-3 hours, and could usually be one-upped by either some excellent 20+ hours course on udemy or youtube. But I get it, the content is not just content, it’s curated, there’s quality control. You can be sure to not get some low-quality stuff, even without looking at reviews. Huge timesaver in contrast to udemy where there are literally 1000s of 33min fake courses with less content then on the matching wikipedia entry.

Pluralsights advantage of quality, albeit at the level you can get with a 3 hour overview is in my opinion the best prerequisite for the badges. With the profile stats page one can show, that there is a knowledge of that specific content.

Embarrassing for a site specialized in technical content to seem so incompetent when it comes to distinguishing fraud from “unusual behaviour”.

Stackoverflow API key

To access stackoverflow in a meaningful automated way one needs an API key, it can be requested at:

https://stackapps.com/apps/oauth/register/submit

OAuth Domain: stackoverflow.com if there is no domain/webserver available

Application Website: for example this very post, or something like github

Application Icon: not mandatory

Smarter Firefox autocomplete

When starting to type in the address bar the shown list often holds too many unrelated items. With a few shortcuts it can be a much better experience.

They’re to be typed directly in the address bar (press F6) in front of the search terms:

These I find the most useful:

  • % search only open tabs
  • ^ search only history
  • * search only bookmarks

These are probably useful for other people:

  • + search only tagged bookmarks
  • # search only in titles and tags
  • $ search only in URL
  • ? show only (search engine) suggestions

It’s also possible to remove unwanted items in the list by selecting them and then press SHIFT+DELETE although it sometimes doesn’t work for me on FF82.

More details here.

Eclipse commandline option for workspace and settings

I have separate Eclipse packages installed and don’t want them to use the default .eclipse setting folder in Home.

Suppose following layout

#unpacked Eclipse archive
/opt/eclipseCdt

#chosen configuration folder
~/config/eclipseCdt

#chosen workspace folder
~/workspaceCdt

Then a call/script/menuitem of the following type (single line) will use those:

/opt/eclipseCdt/eclipse 
-vmargs -Dosgi.instance.area.default=~/workspaceCdt -Dosgi.configuration.area=~/config/eclipseCdt

Benefits:

  • use of any folders
  • clean updates by deleting old eclipse-folder and unpacking new version
  • no more fiddling and remembering to put entries in eclipse.ini

last.fm play favorite tag from every page

I like last.fm from since back when Pandora became geofenced. One thing, which is kind of annoying, is that you have to jump through hoops to get your favorite tag started. I exclusively want that one tag as station and instead of just setting a bookmark, I wanted to have a go with GreaseMonkey to have a seamless ‘built-in’ experience. And not just changing the window.location but having a button left of the ‘<<‘ (previous) at the always visible player.

With very little exposure to javascript before, I was pleasantly surprised about the ease of finding information. Sadly from multiple decades, different styles, versions, …

Right-click and “Inspect Element” on the player yielded:

developer console view of inspected player element

Aha, the player is an <ul> (unordered list) in HTML, and is of class ‘media-controls’. The button to play the tag is more interesting:

developer console view of inspected 'play alternative rock tag' button

Three classes, custom attributes.

It took about 30 min. to patchwork something together by searching the web for things like “greasemonkey button insertion” “javascript select by class” and the like. Debugging seems a lot easier today with the browser console, if it were available at the start of this millenium maybe I could’ve had a more thorough dip into JS.

New button visible in player

Now, on all pages at last.fm I have an extra button for my alternative-rock-tag. Nice.

// ==UserScript==
// @namespace aoe
// @name lastfm play Alternative tag
// @version 1.0
// @description Add button to play Alternative-tag
// @include https://www.last.fm/*
// @include http://www.last.fm/*
// @run-at document-start
// @grant none
// ==/UserScript==

//the above comments are interpreted by Greasemonkey, the 
//@include https://www.last.fm/* enables the script on all pages 

(function(){
  'use strict'
   window.addEventListener('load', () => {
     addButton();
   })

   function addButton() {
//create new button as list element
     let liel = document.createElement('li');
     let btn = document.createElement('button');
//add the details learned from inspecting, classes and attributes
//exchange button class with 'player-bar-btn' otherwise it looks
//weird, try yourself to see
     btn.classList.add('player-bar-btn');
     btn.classList.add('stationlink');
     btn.classList.add('js-playlink-station');
//insert link of real button
     btn.setAttribute("data-station-url", "/player/station/tag/alternative+rock");
     btn.setAttribute("data-analytics-action", "StartStation");
     btn.setAttribute("data-analytics-label", "tag");
//grab the player element and put the created button first
     let controls = document.getElementsByClassName("media-controls")
     liel.appendChild(btn);
     controls[0].insertBefore(liel, controls[0].childNodes[0]);
   }
}())

Who has time for podcasts w/o transcriptions?

You’re in a field where it’s mandatory to keep up-to-date? Just subscribe to podcasts of some experts in the field. Most of those will churn out a 1 hour long audio once a week.

For those of us who have no long commutes it might be impossible to listen to all of them. It would really help if they had (even bad automatic) transcripts of the talks. Skimming over it is so much better.

Let’s be honest:

  • most topics are covered by multiple sources
  • most talks sacrifice considerable time for chitchat
  • most podcasters seemingly expect you to have a lot of time and a recurring interest in their favorite drink/keyboard(-mapping)/anecdotes of childhood

To the occasional listener that all might be not only ok, but even pleasant. Not for me.

Now to the “can’t believe that in this time and age …”: There are free services for al lot of (not) useful things. But apparently the big exception is transcriptions. There are quite a few services for the creators, which can be expensive, billed by words or time. The free options tend to enforce specific platforms. But literally no usable ones for listeners.

Of course you can always play back the podcast in realtime and “record” it with google docs, but how cumbersome is that?

Fun fact: Google transcribes all entries in https://podcasts.google.com/, so that they’re discoverable by content in the search. But not to be viewed. Argh!

Windows Batch Sudoku Downloader

It’s surprising how often I need this…

@ECHO OFF
IF [%1] == [/?] GOTO USAGE
IF [%1] == [/h] GOTO USAGE
IF %1 NEQ +%1 GOTO USAGE
GOTO PROCESSING

:USAGE
ECHO Sudoku (killer difficulty) downloader, loads from https://sudoku-drucken.de
ECHO and assembles to single file, ready to be printed.
ECHO Dependencies are wget and pdftk, those need to be available on the PATH.
ECHO.
ECHO usage: sudoku [N] 
ECHO N - Number of Sudoku pages, default 20 if omitted
GOTO END

:PROCESSING
SETLOCAL
SET FOLDER=%TEMP%\SUDOKU
MD %FOLDER%
CD /D %FOLDER%

SET PAGES=20
IF NOT %1==[] SET PAGES=%1

FOR /L %%N IN (1, 1, %PAGES%) DO (
	wget -q -O %%N.pdf "https://sudoku-drucken.de/component/sudoku/?task=print_sudoku&level=killer"
	ECHO Downloaded page %%N
)
ECHO Combining %PAGES% to a single PDF
pdftk *.pdf cat output sudoku.pdf
CALL sudoku.pdf
CD \
RMDIR /S /Q %FOLDER%
ENDLOCAL

:END

Linux system online only on working hours

E.g. you have a linux machine and want it online only MO-FR 07:00-19:00?

As root do the following:

1. create a new script (I used /opt/shutdownWakeUpNextWorkday7.sh)

#!/bin/bash
TOMORROW=$(date --date="tomorrow" +%A)
if [ $TOMORROW = "Saturday" ]
then
  TOMORROW="Monday"
fi
rtcwake -m off -t $(date --date="$TOMORROW 7" +%s)

2. make that script executable

chmod +x /opt/shutdownWakeUpNextWorkday7.sh

3. in /etc/crontab add

00 19   * * *   root    /opt/shutdownWakeUpNextWorkday7.sh

Done!

Notes:

The script checks whether the next day is Saturday, if yes it configures the rtcwake command to wake on Monday instead (skipping Sunday). On my systems computer time equals local time. If you have a different setup (rtc set to UTC) there are paramteters for both date and rtcwake to use either the one or the other so that your dates align.

rtcwake is used with powerstate off which equals ACPI S5, apparently some very old systems don’t support that. If you happen to be in that situation use something else like standby (S1), mem (S3) or disk (S4) and comment below I’d be interested to know.