Categories
coding windows

Keep Calm and use WSL from VS Code

In case you did not know: You can use WSL (Windows Subsystem for Linux) as your shell in Visual Studio Code. This comes in very handy if you did mod the hell out of your WSL, as I did.

The Visual Studio Code Remote – WSL extension lets you use the Windows Subsystem for Linux (WSL) as your full-time development environment right from VS Code. You can develop in a Linux-based environment, use Linux-specific toolchains and utilities, and run and debug your Linux-based applications all from the comfort of Windows.

Link: https://docs.microsoft.com/windows/wsl

Categories
windows

Powerline Fonts in Windows WSL

Just in case you like modding your environment as I do, you might end up as well in a situation where you SSH into a remote server or using WSL requiring Powerline Fonts. And just in case, if you are wondering what Powerline is? Here you go:

Powerline is a statusline plugin for vim, and provides statuslines and prompts for several other applications, including zsh, bash, tmux, IPython, Awesome and Qtile. 

The problem arises if your host system is Windows and you are using SSH and WSL a lot as I do.

Stanley Meng provides a condensed instruction set on how to get Powerline fonts on your Windows system up and running.

Once you installed the fonts, you can select them e.g. for WSL:

Update (2019-11-18)
While I was looking for the new Cascadia Code font providing Powerline glyphs, I was pointed to Delugia, which in fact is Cascadia Code extended with Powerline glyphs.

Powerline: https://github.com/powerline/powerline
Powerline on Windows: https://medium.com/@slmeng/how-to-install-powerline-fonts-in-windows-b2eedecace58
Bash on Ubuntu on WSL: https://medium.com/@jrcharney/bash-on-ubuntu-on-windows-the-almost-complete-set-up-1dd3cb89b794
Powerline Fonts: https://github.com/powerline/fonts
Delugia Font: https://github.com/adam7/delugia-code/releases

Categories
windows

Automatically upgrading Ubuntu on WSL to the latest release

As I use multiple Windows machines, all running the identical setup of WSL (Ubunto) I wanted to keep all these instances automatically updated.

I am using Ansible scripts to set up the WSL. While all the files are hosted on the file system (\mtn\c\…) I can throw away a WSL instance and create a new one within minutes.

While many packages are not available on Ubunto 18.04 LTS, I created a small Ansible task upgrading my WSL to the latest Ubuntu version available.

  1. Start your WSL instance the very first time and run sudo apt-get update
  2. Install ansible by running sudo apt-get install ansible
  3. Make sure the Ansible scripts are located on the host system (e.g. c:\dev\…)
  4. Start your WSL instance and change e.g. to /mnt/c/dev
  5. Run your Ansible playbook as sudo

You can check your dist version with lsb_release -a:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 19.04
Release:        19.04
Codename:       disco

The Ansible tasks can be found here.

GitHub Gist: https://gist.github.com/aheil/6d48a77ac44c83e00666d3c49ffd7890

Categories
hacks

Turn off your Screen in Windows 10

A problem you might have as well: how to turn off the screen of your laptop without changing the battery settings and without using any tools? Probably using a hotkey? Did you realize, this is not part of Windows at all?

Basically, here is the batch file you have to create for it. Yes, someone wrote a batch file for this. Create a shortcut to the batch file, assign a hotkey and be happy. You also can download the batch file from TechNet. Works on my machine (with Windows 10).

powershell (Add-Type '[DllImport(\"user32.dll\")]^public static extern int SendMessage(int hWnd, int hMsg, int wParam, int lParam);' -Name a -Pas)::SendMessage(-1,0x0112,0xF170,2)

Found on TechNet: https://gallery.technet.microsoft.com/scriptcenter/Turn-off-screen-4d173e0a

Categories
windows

Change what Terminal to open in Windows Terminal (Preview)

While using Windows terminal (Preview) for quite some time, I always opened up the Terminal and then opened a second Tab with my WLS instance. Doing this multiple times a day, this ends up in many many unnecessary clicks.

To change the default behaviour open the Settings (can be found at the right drop-down arrow of the Terminal tabs).

This will open up the settings JSON file. Look up for the defaultProfile entry and search for the corresponding GUID (the string behind this setting) in your document.

Change the GUID in the defaultProfile to the one identifying your prefered terminal.

Save it, close the file and save a lot of clicks.

Categories
tools

Animated GIFs with ScreenToGif

With platforms like Twitter, Slack or Microsoft Teams, animated GIFs have been revived. In addition to emojis, animated GIFs seem to be the way to express yourself on the web. In case you are in the need to create your own animated GIFs, check out ScreenToGIF.

This tool allows you to record a selected area of your screen, live feed from your webcam or live drawings from a sketchboard. Afterwards, you can edit and save the animation as a gif or video. 

It comes with a nice screen recorder frame and a whole list of features to create animated GIFs, Videos and so on. You can record your screen, capture the webcam or whiteboard drawing.s

ScreenToGif Capture Frame

It also comes as a single file, which easily allows you to deploy it almost everywhere, even to keep it on a USB stick.

Homepage: https://www.screentogif.com/
GitHub Project: https://github.com/NickeManarin/ScreenToGif

Categories
hack-the-planet

RFC Quick Access

To follow best practices, understand and learn new de-facto standards, I read and refer a lot RFCs (Requests for Comments). Luckily, the IETF provides an endless list of RFCs to do so.

If often need quick look into these RFCs while being in an editor or at a console windows. To avoid switching from the keyboard and losing focus, I use a small batch file called rfc.bat to gain access to RFCs very quickly.

rfc batch file call on cmd.exe

The batch script simply calles the IETF RFC URL with the RFC number as parameter.

@echo off
start https://tools.ietf.org/html/rfc%1

Where ever the batch files lives, make sure the directory is in your path. I use a folder called c:\Prg\batch which is synchronized over all my computers.

I have adapted this approach to a variety of manual tasks to open files which live on a dedicated place. E.g. I use a much more sophisticated script to open Visio diagrams based on process numbers from our company sharepoint to gain quick access instead of maneuvering through a bunch of websites. These are more than 500 documents named based on a alphanumeric pattern, so this way makes it much more easy to find and open the documents.

Categories
windows

Windows 10 PowerToys

I loved PowerToys for Windows 95! Now they are back. To be found on GitHub. Available summer 2019.

PowerToys is a set of utilities for power users to tune and streamline their Windows experience for greater productivity.
Inspired by the Windows 95 era PowerToys project, this reboot provides power users with ways to squeeze more efficiency out of the Windows 10 shell and customize it for individual workflows. A great overview of the Windows 95 PowerToys can be found here.
The first preview of these utilities and corresponding source code will be released Summer 2019.

Link: https://github.com/Microsoft/PowerToys

Categories
tools

Customize Windows 10 File Type Icons

I just realized, that recent Windows version make it very hard to customize some aspects of your desktop.

As I am using Sumatra PDF as my default PDF viewer, I do not have the typical Adobe icon on my desktop. While having these icons on my Mac as well as on my work PC, this is rather confusing.

I came along File Types Manager which actually takes away the registry fiddling.

File Tymes Manager Main Window

It works with Windows XP, 7/8 and Windows 10. if you have any .ico files available it is pretty easy to change an icon for a particular file type just by assigning it.

Changed PDF file type icon

Also there are tons of other features, I haven’t used yet.

tl;dr

If you want to change file type icons on a Windows 10 system, you ca use File Type Manager to do so easily.

Categories
windows

Snip & Sketch

Right after I just writing about Windows Snipping Tool in my previous post, my Windows 10 notebook just surprised me by telling there will be something called Snip & Sketch in the future. Snipping Tool is moving dialog

It seems it has the same capabilities as Windows Snipping Toll while adding the possibility to annotate your screenshots directly using various pencil and sharing capabilities via Bluetooth and WiFi.

Snip & Sketch Toolbar

In case you don’t have Snip & Sketch on your Windows machine yet, you can download it from the Windows Store for free.

tl;dr

Windows Snipping Tool will be replaced by Snip & Sketch providing additional annotation capabilities.