I have finally solved an annoying problem with my Windows 10 setup which was sortof hard to Google, so I am sharing. For quite some time, the computer had refused to go to sleep when it was not running on battery. Instead of going to sleep when instructed to, it would simply turn off the screen and mute the volume while continuing to *actually not sleep*. Moving the mouse a tiny bit would swiftly end the charade. In a recent fit of rage I decided to inspect the event log, and behold, there were some Kernel Power events that said: > _The system is entering Away Mode._ Which is entirely _not_ what I wanted when I told it to go to sleep. However, there was no option _anywhere_ in the power settings to be found that turned off this _"Away Mode"_. Well, the option actually does exist, but for some reason it is not visible unless you set the `Attributes` value to `2` in the following, easily memorable registry key: ``` HKLM\SYSTEM\CurrentControlSet\Control\Power\PowerSettings\238C9FA8-0AAD-41ED-83F4-97BE242C8F20\25DFA149-5DD1-4736-B5AB-E8A37B5B8187 ``` Armed with this registry tweak, you can go back to the _"advanced"_ power settings, aka: ``` rundll32 shell32.dll,Control_RunDLL PowerCfg.cpl @0,/editplan: ``` Navigate to `Sleep` and there should be an option that says `Allow Away Mode Policy` or something similar. And that policy should be set to no, not even when plugged in, never, just sleep, for crying out loud, why does this even exist.


The color that [PuTTY](http://www.putty.org/) uses for blue is simply too dark. The scrollback buffer, by default, is 200 lines. That's ridiculous, I have several gigabytes of RAM going to waste here. In case you have a lot of stored sessions, it's quite tiresome to use PuTTY to go through all of them and fix whatever settings you would like to change. You can edit them directly in the registry, though - or use this Python <b>3</b> script! ```python from winreg import OpenKey, EnumKey, QueryValueEx, SetValueEx, \ KEY_WRITE, KEY_READ, HKEY_CURRENT_USER as HKCU class callrange: def __init__(self, call_function): self.call = call_function def __getitem__(self,index): try: return self.call(index) except OSError: raise IndexError with OpenKey(HKCU,"SOFTWARE\SimonTatham\PuTTY\Sessions") as sessions: for s in callrange(lambda i: EnumKey(sessions,i)): with OpenKey(sessions,s,access=KEY_WRITE|KEY_READ) as key: for name,value in [ ('Colour14','100,100,250'), ('Colour15','120,120,250'), ('TerminalType','xterm'), ('ScrollbackLines',6000) ]: type = QueryValueEx(key,name)[1] SetValueEx(key,name,0,type,value) ``` By the way, searching the tubes reveals [some useful suggestions to improve PuTTY's default settings](http://dag.wiee.rs/blog/content/improving-putty-settings-on-windows).


I recently <a href="/2014/08/25/switching-end-and-insert-key-on-the-lenovo-yoga/">lamented about switching two keys on my new Lenovo Yoga</a>. Big problem: In my office, I attach that notebook to a docking station and to that docking station I attach a <a href="http://www.daskeyboard.com/" target="_blank">keyboard</a>. On that keyboard, all keys are precisely the way I want them to be. Therefore, I do <i>not</i> want to switch the <b>Insert</b> and <b>End</b> keys when I am docked. I ended up writing a little batch script based on <a href="https://code.google.com/p/killkeys/wiki/ScancodeMap" target="_blank">this nice google code wiki entry</a> for the registry update and <a href="http://stackoverflow.com/a/24665214/1578458" target="_blank">this stackexchange answer to elevate the batch script</a>: ```bash @ECHO OFF NET FILE 1>NUL 2>NUL if '%ERRORLEVEL%' == '0' goto run powershell "saps -filepath %0 -verb runas" >nul 2>&1 goto eof :run REG QUERY "HKLM\SYSTEM\CurrentControlSet\Control\Keyboard Layout" ^ /v "Scancode Map" >nul 2>&1 IF '%ERRORLEVEL%' == '0' goto remove <nul set /p ="> adding scancode map " REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Keyboard Layout" ^ /v "Scancode Map" /t REG_BINARY /f ^ /d 00000000000000000300000052E04FE04FE052E000000000 >nul 2>&1 IF '%ERRORLEVEL%' == '0' goto success goto fail :remove <nul set /p ="> removing scancode map " REG DELETE "HKLM\SYSTEM\CurrentControlSet\Control\Keyboard Layout" ^ /v "Scancode Map" /f >nul 2>&1 IF '%ERRORLEVEL%' == '0' goto success goto fail :fail echo failed. pause goto eof :success echo succeeded. pause ``` Sadly, it always requires a reboot for the changes to take effect.