My use case for a customer was to configure WSUS for a couple of DMZ servers. The DMZ servers are not domain-joined. So I create a PowerShell script to configure the registry so I can easily deploy the settings to the servers.
You can use this script also for non domain-joined servers
With Powershell ISE you can use CTRL + SPACE for auto completion.
Powershell ISE Completion
But when you work in a native Powershell window you don’t have this option. And many often you cycle with tab completion trough the powershell and because you press the TAB button too soon you have to remove characters and cycle again trough all the commands.
Unit now 😉
There is an easy fix you can implement so the Powershell have the same auto completion like bash.
Type notepad $profile for Windows or gedit $profile for Linux
Add the line Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete
Add line in $profile
Save the file and restart Powershell
And now you have a much better working tab completion
Today I update my dual boot system and unfortunately my Debian OS wasn’t booting anymore. The root cause was that Windows decide to reclaim the EFI boot.
A friend of mine came back from vacation where he had taken a lot of pictures. When he got back home a large part of his Micro SD card (exFAT partition) was no longer accessible so he missed a couple of weeks of his photos and videos. His Windows Operating System froze completely when it hit a rotten cluster during a file copy action. So we had to find another solution to get his files back.
The first step I tried was to get the data from the SD card via Linux with ddrescue. With ddrecue, you create and complete dump of the SD card (or the sdb1 partition only). So you can do the data recovery on the image file (backup1.img) and not on the already corrupted SD Card.
But Linux also had also trouble reading when I hit a bad cluster. The only thing I could do during the read issues was a physical disconnect of the USB adapter, reconnect the adapter and restart the ddrescue process. The reason of was that a dual SD card adapter was used:
Micro SD > SD > SD > USB
(spoiler ALERT!: Never use multiple adapters for data recovery!!!)
Because ddrescue has a mapfile it goes further where he was stopped the last time.
While debugging I wrote a simple loop that forced a “physical” disconnection of the USB adapter wait one sec and reconnect the devices without touching anything.
This works but is a very very slow process. This will takes months to recover so I had to find another way.
#!/bin/bash
## Steps to Prepare:
# lsusb check card reader and change the /dev/bus
# Start script in usbreset folder
# Run as sudo
# mount disk (media / thomas)
while true
do
echo "Let's try Again!"
ddrescue -d /dev/sdb1 /media/thomas/4905eb31-1df4-49bb-bb75-ec4889641d20/backup1.img /media/thomas/4905eb31-1df4-49bb-bb75-ec4889641d20/backup1.mapfile
sleep 1
./usbreset /dev/bus/usb/001/004
sleep 1
done
The funny thing is that it was Sinterklaas time and that my daughter had just received a vtech kiddy photo camera with a Micro SD to USB adapter included 😀
So I try new new adapter: Micro SD > USB and with success.
And after almost 15 hours the result 99.98% rescued rate 🙂
During my search for a solution I found some interesting articles:
I was working for an elementary website of a friend of mine. I pushed the website to GitHub so it’s was way easier to maintain the site.
But I thought it must be easier than transferring all the changes every time by an FTP program. So I found git-ftp and of course FTPS didn’t work out of the box 😉
Windows
What you have to do to enable GIT FTP (on Windows)
First start an ssh sessions from powershell
ssh username@SOMEHOSTNAME
This will add the public key to you known host. Otherwise you will get this error later
And the next time you make a change you only have to do
git ftp push
When you get an errors like these:
zo 19 dec 2021 23:11:50 CET: Retrieving last commit from sftp://******:***@s*******/public/sites/*********/.
* Trying *********:22...
* Connected to ******* (********) port 22 (#0)
* Found host ******** in /home/******/.ssh/known_hosts
* Set "ecdsa-sha2-nistp256" as SSH hostkey type
* Closing connection 0
curl: (79) Error in the SSH layer
zo 19 dec 2021 23:11:50 CET: fatal: Could not get last commit. Use 'git ftp init' for the initial push. Can't access remote 'sftp://******:***@********'. Network down? Wrong URL? exiting..
Pfff I’ve had a battery drain for weeks on my Oneplus device (you know that your phone battery drains faster than you would expect). But that drain was not visible in the android battery overview.
I had already installed an app (betterbattrystats) that give you more information about the drain. With betterbatterystats I found out that logd could be the issue, but logd is a log service so it should not be a root cause.
So I found out that you could just start a task manager (top) from the Android debug tools. What seems; the youtube music app was draining my battery. Even though I don’t even use it. You can’t delete that app either so I forced stopped it and now everything is quiet.
Really wtf; I am a tech guy and have to put in so much effort to figure this out. How many people don’t have the same issues but just accept it?
How can you fix this?
First install ADB
Put your phone in development mode
Start top
adb shell top -m 20 -d 2
Here you can see the logd and the com.google.and+
To figure out what PID 9036 is
adb shell ps | grep 9036
And voila; the root cause…. Youtube music
So I turned off the Youtube app and now everything looks nice!
Please google don’t hide you shitty services from the android battery overview!