Accessing home folders from Windows Subsystem for Linux in Explorer

Are you running Windows Subsystem for Linux (WSfL)? Ever wondered where the home folders are stored so that you can access them from Explorer? Seek no further for here is the answer.

Every distribution has it’s own location. They can be found under:

%LOCALAPPDATA%\Packages

For Ubuntu 18.04 you can find the home folders in the following location:

%LOCALAPPDATA%\Packages\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgc\LocalState\rootfs\home

Enjoy!

Advertisements

Change root password Windows Subsystem for Linux

Today I was setting up Windows Subsystem for Linux and wanted to change to the root user using the command:

su -

I was prompted for the password, but had no idea what it was. So I needed to figure out another way of switching to the root user instead of prefixing every command with sudo. Did I say switch and prefix and sudo? O yes, stupid me.

sudo su

Don’t forget to exit once you are done. And be careful not to wrech havoc while working under the root account. Have fun!

Plugin Manager removed from Notepad++

I needed the compare plugin today. You used to be able to select the Plugin Manager under Plugins ->Ā Plugin Manager. But it was gone šŸ˜¦ It turns out it has been removed from the standard installation and has to be installed separately. I haven’t been able to find out why. Here quick instructions how to install Plugin Manager.

  • Download the latest version of Plugin Manger from GitHub. Make sure you download the correct version 32 or 64 bit depending on the version of your operating system.
  • Unzip the file.
  • Copy the two directories to the Notepad++ directory. In my caseĀ C:\Program Files (x86)\Notepad++.
  • Restart Notepad++.

Plugin Manager is available again under Plugins -> Plugin Manager. Yeah!

Validating a json file from the command line in Linux

Today I needed to validate a json file on one of my servers. It turns out there is a simple nodejs program or actually a linter to do this with.

Just execute the following line and you are in business.

sudo npm install jsonlint -g

This assumes nodejs is already installed. If not, execute the following line.
sudo apt-get install -y nodejs npm

To validate a json file run the following command.

jsonlint -qcĀ settings.analyzer.json

When running the program the first time I ran into the problem that the json file contains comments. Yes, I know this is not in line with the spec, but it is damn handy for understanding the file. So I needed to strip the comments to valiate the file. After googeling around a bit I found an awk command to do just this. Try the following command.

awk '{sub(/\/.*$/,"")}1' settings.analyzer.json >Ā settings.analyzer.json

Now run jsonlint again and it should work.

P.s. I know the title of this post says Linux, but jsonlint will also work under any other system that nodejs runs on.

Hope this saves someone some time.

Using the hosts file on Windows with ports

As you might or might not know I’m running Profit Trailer (PT) on a VPS. To be safe the GUI is not accessible to the outside world, but only through an SSH tunnel. It has been irritating me for a while that the URLs are not readable, e.g. localhost:8081. I wanted readable URLs without ports in them. Today I finally figured out how to do this using a combination of host file and the Windows networking tool netsh.

Continue reading

Surface Pro 4 shutsdown when I click the on/off button

When I pressed the on/off on my Surface Pro 4 running Windows 10 it would shut down! Really irritating.

After searching around for a while I found the setting under System Settings that controls the behavior of the on/off button.

  • Open Control Panel > Power Options > System Settings
  • Change the action when the on/off button is pressed to ā€˜Sleepā€™.

Thatā€™s it. Another problem solved!

Python and Windows

I’m back… It has been a while since my last post. To busy doing other things and not keeping up with my techie skills. I have decided it is time for some new projects. I have a few ideas lined up. Python, Flask, Angular 2 and Ionic 2 are my tools of choice. So I will be blogging about my adventures the comings weeks, months, …

Okay, this blog is going to be on setting up Python on Windows. Just some quick for myself with notes for later reference.

  • Install Python
  • Set environment variable %PYTHON27%
  • Add the following Python dirctories to path: bin & scripts
  • Setup virtualenv, a tool for creating isolated Python virtual environments, each with their own libraries and site-packages:
    pip install virtualenv
  • Install virtualenvwrapper, provides a set of commands which makes working with virtual environments much more pleasant. It also places all your virtual environments in one place:
    pip install virtualenvwrapper-win
  • Add an environment variable WORKON_HOME to specify the path to store environments. My choice: %PYTHON27%\env.
  • For anĀ  overview of the main commands check the repository on GitHub.
  • In order to keep your environment consistent, itā€™s a good idea to ā€œfreezeā€ the current state of the environment packages. To do this, run:
    pip freeze > requirements.txt
  • This will create a requirements.txt file, which contains a simple list of all the packages in the current environment, and their respective versions. You can see the list of installed packages without the requirements format using ā€œpip listā€. Later it will be easier for a different developer (or you, if you need to re-create the environment) to install the same packages using the same versions:
    pip install -r requirements.txt
  • Install Flask-DebugToolbar an extension that adds a toolbar overlay to Flask applications containing useful information for debugging:
    pip install flask-debugtoolbar
  • Check the Flask-DebugToolbar documentation for more information on the use.
  • Install initpy that helps initialize Python projects. It has support for different types of projects: single file project, Flask, Tornado Web, Falcon and Hosted.
    pip install initpy