‘wc -l’ equivelant for Windows… kinda

Came across a cool find today that I can implement in Windows to replicate wc -l. When wanting to count how many lines in a file on Windows, I can use the following.

type test.txt | find /v /c ""

This is saying to count /c all the lines not containing /v nothing "".



type test.txt | find /v /c ""

Note that it counts the empty line between e and g in test.txt. It would also count any extra lines that do not contain data (carriage returns).

Login to WordPress from Python

I’ve been trying to learn some Python and have been tinkering with the requests module. Here is how I am able to log into a webpage, such as WordPress.

import requests
 url = "https://techish.net/wp-login.php"
 redirect_to  = "https://techish.net/wp-admin/"
 with requests.Session() as session:
     post = session.post(url, data={
         'log': 'admin',
         'pwd': 'password',
         'redirect_to': redirect_to
         }, allow_redirects=True)
     get = session.get(redirect_to, cookies=post.cookies)

Sage Peachtree 2013 crashes when posting Receipt

Sage Peachtree 2013 was crashing every time while attempting to save a Receipt entry.

This occurred only via Remote Desktop. Peachtree 2013 is installed on a Windows 10 1903 system, 8GB RAM and Intel 530 Graphics. Remote machine is a Windows 8.1 system, 4GB RAM and Intel Graphics.

Resolution was to change RDP properties to color of 24bit Color instead of 32bit and also uncheck Use Persistent Bitmapping.

Mount network location in WSL

To mount a network location in Windows Subsystem for Linux, use the following commands.

Mounting DrvFs

In order to mount a Windows drive using DrvFs, you can use the regular Linux mount command. For example, to mount a removable drive D: as /mnt/d directory, run the following commands:

$ sudo mkdir /mnt/d
$ sudo mount -t drvfs D: /mnt/d

Now, you will be able to access the files of your D: drive under /mnt/d. When you wish to unmount the drive, for example so you can safely remove it, run the following command:

$ sudo umount /mnt/d

Mounting network locations

When you wish to mount a network location, you can of course create a mapped network drive in Windows and mount that as indicated above. However, it’s also possible to mount them directly using a UNC path:

$ sudo mount -t drvfs '\server\share' /mnt/share

Note the single quotes around the UNC path; these are necessary to prevent the need to escape the backslashes. If you don’t surround the UNC path with single quotes, you need to escape the backslashes by doubling them (e.g. \\\\server\\share).

WSL does not have any way to specify which credentials to use to connect to a network share. If you need to use different credentials to connect to the server, specify them in Windows by navigating to the share in File Explorer, using the Windows Credential Manager, or the net use command. The net use command can be invoked from inside WSL (using net.exe use) via interop. Type net.exe help use for more information on how to use this command.

Additional information: https://blogs.msdn.microsoft.com/wsl/2017/04/18/file-system-improvements-to-the-windows-subsystem-for-linux/