Saturday, April 20, 2019

Device Clean Up

Every time you plug in an USB drive, it leaves a footprint in your system.  It is okay if you only use a drive or two.  However, if you have a few, then this can get a bit ugly.

You can tidy things up by removing them in the Device Manager, but you can only do this one at a time.  This is a bit too clumsy.  Alternative, you can use a tool such as DeviceCleanup Tool (https://www.uwe-sieber.de/misc_tools_e.html), which allows you to select multiple devices and delete together.




Monday, July 30, 2018

Convert multiple text files to UTF encoding

If you have multiple files and want to convert them all into UTF (without BOM), you can try this PowerShell script.

Get-ChildItem . -recurse -File -filter *.txt* | % {
        $MyFile = Get-Content -Raw $_.Fullname
        $MyPath = $_.Fullname
        [System.IO.File]::WriteAllLines($MyPath, $MyFile, [System.Text.UTF8Encoding]($False))
}
[System.IO.File]::WriteAllLines is used instead of the more commonly used Out-File because the latter outputs UTF8-BOM instead of plain UTF.

Monday, May 21, 2018

What's my Dell Service Tag

Recently come across this command which allow me to get the service tag for my Dell machine without crawling under my desk.

The command is

wmic bios get serialnumber

http://www.dell.com/support/article/uk/en/ukbsdt1/sln268357/how-to-locate-system-service-tag-using-command-prompt?lang=en

I have tried it on other brands too.  As it seems, it works for Acer machines too.

Tuesday, May 15, 2018

SMB3

I have issues to browse Windows Shares on my network ever since Windows retired SMB1.  Today I came across this post and its solution fixes my problem.

To make Windows shares browsable again, I added this line to /etc/samba/smb.conf

client max protocol = SMB3
This line should be put right after the line

workgroup = WORKGROUP
 Now I can browse and open share folders on my Windows machines in the network as it used to be.

Saturday, February 17, 2018

Reset Windows Updates

Windows update can mess up sometimes.  Even there is an option in Windows 10 for attempting to fix this issue, in my experience it isn't as good as old solutions found on TechNet.

Anyway, if you have similar Windows Update issue like myself, you may want to use the script found on this TechNet article at:

https://gallery.technet.microsoft.com/scriptcenter/Reset-Windows-Update-Agent-d824badc

Sunday, August 6, 2017

Backward slash where are you?

I got a new bluetooth keyboard yesterday, and it is nice.  However, one thing I didn't notice at the time of purchase is it does NOT have a backward slash key.  I only found it out when I try to type an UNC path.

As always, Google came to rescue.  It turns out you can type a backward slash using the ALT GR + # key combo (at least in Windows 10 where I have tried so far!).

Edited 2018-03-17: On Linux, it is ALT GR + - key

Sunday, July 30, 2017

Linux and its schedulers


Personally I don't like the default CFQ scheduler as a heavy IO process can make the whole system sluggish.  For instance, you will find everything non-responsive while copying a large file.

Luckily, there are alternatives.  You can use either NOOP or Deadline instead.

I use Deadline for my system as it is based on fixed length time-slicing.  With this scheduler, IO tasks are queued up for processing.  When it is its turn, it will be run for a fixed duration.  If the task cannot be completed within the time, it will get suspended and put back to the queue for its next run.  As the execution time is fixed, it means no IO task can hog the IO, i.e. the system can apparently be felt like more responsive.

To permanently change the scheduler, you need to modify your /etc/default/grub file by modifying the line below:

GRUB_CMDLINE_LINUX="elevator=noop"
And then run the update-grub2 to apply the change (see https://blog.codeship.com/linux-io-scheduler-tuning/)

You may also change the scheduler if you are running Linux as a virtualized instance.  It seems NOOP scheduler is more suitable, i.e. letting the host IO to worry about IO scheduling.