Categories
Snippets

Configure Python on Windows

All right, I have a Windows machine. It’s a PITA, but it’s here. And for some reason I started doing some Python testing on it. So this is how I managed to do it:

Preparation:

  • Install python with choco (choco install -y python)
  • Run PowerShell as Administrator
    • Execute Set-ExecutionPolicy -ExecutionPolicy Unrestricted (we’ll see why in a very short time)

Now to code it’s pretty similar to *NIX:

  • Create your code folder
  • Set up a python venv (python -m venv .env)
  • In VS Code, choose this interpreter

So why the PowerShell stuff? Cause to activate the environment VS Code needs to execute a .ps1 script. Which it can’t, cause “executing scripts is disabled on this machine”, which seems to be the default setting.

All in all, surprisingly straightforward. And I just noticed even the *NIX keyboard shortcuts (CTRL-A, CTRL-K, for example) work in the terminal window now. Crazy.

Categories
Snippets

autohotkey

Under macOS I use TextExpander, under Windows there’s the fantastic AutoHotkey. One of the few softwares I can’t live without.

This is my default configuration:

; ---------- "auto reload" ----------

FileGetTime ScriptStartModTime, %A_ScriptFullPath%
SetTimer CheckReload, 1000, 0x7FFFFFFF ; ms & priority

; from here: https://stackoverflow.com/a/45488494
CheckReload() {
    global ScriptStartModTime
    FileGetTime curModTime, %A_ScriptFullPath%
    If (curModTime <> ScriptStartModTime) {
        Loop
        {
            reload
            Sleep 300 ; ms
            MsgBox 0x2, %A_ScriptName%, Reload failed. ; 0x2 = Abort/Retry/Ignore
            IfMsgBox Abort
                ExitApp
            IfMsgBox Ignore
                break
        } ; loops reload on "Retry"
    }
}


; ---------- actual content here ----------

; removed all my email address shortcuts ...

:*:-dt::
  ; from here: https://is.gd/3u6MKQ
  Send, %A_YYYY%-%A_MM%-%A_DD%
  Return

:*://ts::
  Send, %A_YYYY%%A_MM%%A_DD%_%A_Hour%%A_Min%%A_Sec%
  Return

 

Categories
Desktop shit

Win10 & Veracrypt & systemd-boot

There are some things seemingly nobody does. For example, …

  • double-booting Win10 and Linux
  • on an UEFI System
  • while the Win10 Partition is encrypted using VeraCrypt.

Yes, it’s a complex scenario, but since MS in all of his (money-grabbing) wisdom does not include BitLocker in Win10 Home, this is a necessary precaution. I’ll not go over the installation of both systems (pretty straightforward, and Arch Linux has – as always – a nice Wiki entry about it).

Unfortunately, Win10 likes to break its own boot manager on updates, which is very scary (“Your Windows partition is damaged”), and super annoying, but I think I got the solution now.

So, the Linux-based (of course) solution for Windows 10 and VeraCrypt is:

# esp partition - /loader/entries/winvera.conf
title Windows 10 VeraCrypt
efi /EFI/VeraCrypt/DcsBoot.efi

This is in fact all you need to do. Now, if Windows fucks up its own boot loader, it seems systemd-boot just ignores everything, loads the correct VeraCrypt bootloader (as it is supposed to be), and all is well.

It can happen though that Windows places its own boot manager back in front of systemd-boot again, so it’s used as the default one. Then use one of the methods described here, and you should be fine. (This did not happen to me, it always used the correct boot manager but fucked up Windows boot)

Categories
Uncategorized

Windows after 13 years – and nothing changed

I have a Windows PC again, after about 13 years of abstinence and never looking back. (Why? Gaming. Once in 13 years is OK I guess).

And nothing changed.

Step 1: Uninstalling crap

Uninstall those things from the Windows menu: Candy Crush, Cooking Fever, and three others I forgot to document. It’s a pristine ISO install, nothing from a vendor – I bought components myself, and I assembled myself. So this is Windows and Windows alone that’s to blame.

And don’t forget all the crap which is in the Windows menu tiles – XBox & co, I mean you. (Removed about 7 super useless things here alone).

Step 2: change mouse wheel direction

Step 2: Change mouse wheel direction (sorry, Mac spoiled me). I can configure anything and everything in Windows – not that. Google helps, and I have to – of course – navigate the registry to find keys that look like this:

HKLM\SYSTEM\CurrentControlSet\Enum\HID\...
... VID_046D&PID_C53D&MI_01&COL01\9&12BDBF6B&0&0000\...
... DeviceParameters\FlipFlopWheel

(Set this to 1, and get the “VID_0…” whatever string from the “Advanced Settings” of the mouse properties dialogue. Brainfuck.

Step 3: Disable cortana

Oh yeah, disabling Cortana is almost easy (set this to 0):

HKLM\SOFTWARE\Policies\Microsoft\Windows\...
... Windows Search\AllowCortana

Step 4: Remove contacts icon from taskbar

Removing the stupid “Contacts” icon on the task bar is super simple in contrast: Right-click, and uncheck “Show contacts”. Yay!

Step 5: Re-login / Reboot

Where the fuck can I log out?!

Oh right, click the start menu, immediately see the unobtrusive grey junk icon which is supposed to be me in the leftmost area on top of all the other nondescriminate icons, click it, and see the menu pop up which offers to “log out”. How could I miss this.

Summary

Well, this is not all. This is just what I did today, after already tuning the system a while ago. In contrast Mac: Unpack, open (Laptops only here), start working. No candy crush removal necessary.