Get-ChildItem . -recurse -File -filter *.txt* | % {[System.IO.File]::WriteAllLines is used instead of the more commonly used Out-File because the latter outputs UTF8-BOM instead of plain UTF.
$MyFile = Get-Content -Raw $_.Fullname
$MyPath = $_.Fullname
[System.IO.File]::WriteAllLines($MyPath, $MyFile, [System.Text.UTF8Encoding]($False))
}
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.
Labels:
conversion,
multi file,
PowerShell,
utf8,
utf8-bom
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
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.
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 = SMB3This line should be put right after the line
Now I can browse and open share folders on my Windows machines in the network as it used to be.
workgroup = WORKGROUP
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
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
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
Labels:
alt gr + #,
backward slash,
missing from keyboard
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.
Friday, April 21, 2017
Mint Linux and HDMI
Recently I have set up a Linux Computer (Mint Linux XFCE 18.1) for playing media contents. The system is connected to my TV using HDMI, and initially everything seems working fine. Then I found it is having sound issue after I had turned my TV off and on again. The system keeps falling back to analog output.
After a bit of research on Google, this seems to be a known issue. I took the suggestions from this guide at
https://wiki.archlinux.org/index.php/PulseAudio/Troubleshooting#No_HDMI_sound_output_after_some_time_with_the_monitor_turned_off
I commented out the "load-module module-switch-on-port-available" option in /etc/pulse/default.pa as advised, and this seems fixed my issue.
https://wiki.archlinux.org/index.php/PulseAudio/Troubleshooting#No_HDMI_sound_output_after_some_time_with_the_monitor_turned_off
I commented out the "load-module module-switch-on-port-available" option in /etc/pulse/default.pa as advised, and this seems fixed my issue.
...
### Should be after module-*-restore but before module-*-detect
#load-module module-switch-on-port-available
Subscribe to:
Posts (Atom)