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:


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



Testing Mongoose plugin with Jest and shared data

Grrrr just spent the better half of 2 hours trying to figure out why my Jest tests were not working for a Mongoose plugin I’m developing. It turns out that the schema configuration I was sharing between the tests was the culprit.

let Mongoose = require('mongoose');
let Schema = Mongoose.Schema;
const _ = require('lodash');
var mongooseI18n = require('../src/mongoose/mongoose-i18n-localize');

Mongoose.set('debug', true);

const simpleSchemaConfig = {
  firstName: { type: String, i18n: true, required: true },
  lastName: { type: String, i18n: false, required: true }

describe('Mongoose i18n localize', () => {
  beforeEach(() => {
    // Clear compiled models to avoid OverwriteModelError
    Mongoose.models = {};
  it('should throw an exception if the locales array is not defined', () => {
    const SimpleTestSchema = new Schema(simpleSchemaConfig);
    expect(() => {
      SimpleTestSchema.plugin(mongooseI18n, {
        defaultLocale: 'nl',
        allLocalesRequired: false
    }).toThrow('The required option locales array not provided or empty');

  it('should throw an exception if the locales array is an empty array', () => {
    const SimpleTestSchema = new Schema(simpleSchemaConfig);
    expect(() => {
      SimpleTestSchema.plugin(mongooseI18n, {
        locales: [],
        defaultLocale: 'nl',
        allLocalesRequired: false
    }).toThrow('The required option locales array not provided or empty');



The plugin makes changes to the schema configuration and these changes were made to the shared config. The fix I used was to make a copy of the shared config with lodash’s cloneDeep function. The only change I needed to make was the schema initialization.

const SimpleTestSchema = new Schema(_.cloneDeep(simpleSchemaConfig));

Now my tests run like a charm 🙂


When I initially ran into the above problem, I was also initializing the schema globally. I thought that was the problem, so I moved the following statement to each test case.

const SimpleTestSchema = new Schema(simpleSchemaConfig);

That caused the exception OverwriteModelError, because I was trying to initialize a compiled model. The fix for this problem was to remove all models between test cases using beforeEach. The following code does the trick.

beforeEach(() => {
  // Clear compiled models to avoid OverwriteModelError
  Mongoose.models = {};

Hope this helps someone.

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!

Adding fuzzy search to Feathers NeDB

Out of the box Feathers NeDB does not support fuzzy search. There is a hook that provides this functionality: feathers-nedb-fuzzy-search. It is really simple and straitforward to install and use.

  • Install
    npm install feathers-nedb-fuzzy-search --save
  • Configure
    Enable it for specifc services or alternatively enable it for all services in app.hooks.

    const search = require('feathers-nedb-fuzzy-search') 
      before: {
        find: search()
  • Usage
    const messages = app.service('messages')
      query: {
        $search: 'some string to search for'


Happy coding.

Adding hot reload to featherjs

Feathers is a very cool framework to quickly and easily setup API’s. Version 3 comes with a very cool CLI that generates all the scafolding code for you and makes it extremely easy to add services, hooks, etc. One thing that is missing is hot reloading to simplify the development proces. This is were nodemon comes to the rescue.

nodemon is a tool that helps developing node.js based applications by automatically restarting the node application when file changes in the directory are detected.

Setting nodemon up with Feather and Webpack si a simple two step proces.

  1. Install nodemon
    npm install --save-dev nodemon
  2. Add one line to the scripts section of Webpacks package.json file
      "scripts": {
        "test": "npm run eslint && npm run mocha",
        "dev": "node ./node_modules/nodemon/bin/nodemon.js src/",
        "eslint": "eslint src/. test/. --config .eslintrc.json",
        "start": "node src/",
        "mocha": "mocha test/ --recursive"

Now start Feathers using the following command.

npm run dev

That’s it, simple right?

Add Webpack alias using Quasar framework

Trying out Quasar Framework (QF) I ran into a minor challenge setting up the Webpack @ alias like Vue provides out of the box for imports.

import firebaseCfg from '@/firebase/config'

QF uses quasar.conf.js to simplify working with Webpack. So there is no Webpack config file that the alias can be added to directly.

Example of the Webpack resolve alias configuration that Vue provides out of the box.

  resolve: {
    extensions: ['.js', '.vue', '.json'],
    alias: {
      'vue$': 'vue/dist/vue.esm.js',
      '@': resolve('src'),

After some Googeling I found the solution. Add the following to quasar.conf.js file to get the @ alias to work.

At the top of the file.

let path = require('path')

To the build section.

  build: {
    scopeHoisting: true,
    vueRouterMode: 'history',
    // vueCompiler: true,
    // gzip: true,
    // analyze: true,
    // extractCSS: false,
    extendWebpack (cfg) {
        enforce: 'pre',
        test: /\.(js|vue)$/,
        loader: 'eslint-loader',
        exclude: /(node_modules|quasar)/
      // Create aliases for importing
      cfg.resolve.alias = {
        '@': path.resolve(__dirname, 'src')

Pretty straight forward once you know how 🙂

Creating a simple REST server

For testing purposes I needed a quick and dirty way to create a REST server to server data. I found a very basic and easy to use REST server that stores data inside a JSON file. It is called json-server. Any changes you make will be saved to the JSON file.

Getting it up and running is very easy.

Install json-server:

npm install -g json-server

Create a JSON file containing the data, e.g. db.json:

    "products": [{
        "id": 1, "name": "coat", "price": 100.00
    }, {
        "id": 2, "name": "hat", "price": 30.00 
    }, { 
        "id": 3, "name": "umbrella", "price": 10.00 

Start json-server:

json-server --watch db.json

Now go to http://localhost:3000/products/1 and you will get:

{ "id": 1, "name": "coat", "price": 100.00 }

Check out the json-server GitHub page for all the other cool stuff you can do.

Happy coding.

Finding out the size of directories in Linux

Do you want to know the size of a directory in Linux? Use the du command.

du -sh


The du command estimates the space used by a directory.

The options -sh are (from man du):

  -s, --summarize
         display only a total for each argument

  -h, --human-readable
         print sizes in human readable format (e.g., 1K 234M 2G)

To check more than one directory and get the total size of those directories, use

du -sch *

What does the extra option mean?

  -c, --total
         produce a grand total

Include hidden files?

du -sch * .*

Want to know how much disk space has been used?

du -h .

Tradingview Pine Script syntax highlighting for Notepad++

I have been working with Tradingview Pine Scripts (TPS) and it was irritating me that when the scripts get lager and more complex they are hard to read. So I decided to create syntax highlighting for TPS for Notepad++ (NPP). NPP is the go to text editor for Windows. It provides an easy mechanism for adding custom syntax highlighting for languages using its User Defined Language (UDL) functionality.

You can find the the User Defined Language (UDL) file for syntax highlighting Tradingview Pine Scripts (TPS) files in Notepad++ (NPP) in this repository on GitHub.

Let me know what you think and if it is helpful.