Ping with timestamps

Sometimes it is handy to run ping on the background to monitor network connectivity. Combine Microsoft PowerShell and the PsPing utility from Microsoft and you get a nice logging solution with shows on each line a timestamp and the results from the ping.

Ordinary ping:

psping -t -i 10 |Foreach{"{0} - {1}" -f (Get-Date),$_} | Tee-object -FilePath ping_log.txt

TCP port ping:

psping -t -i 10 |Foreach{"{0} - {1}" -f (Get-Date),$_} | Tee-object -FilePath port_log.txt


  • -t parameter means run until stopped
  • -i 10 means ping every 10 seconds
  • PowerShell foreach loops through the results add timestamp to each line
  • PowerShell Tee-object is like Unix tee command which both saves the input and sends it to stdout

Credits for the Foreach ping solution:

Posted in Windows |

Git on Windows & Github, authentication suddenly stopped working

I’m using Github 2FA and git on Windows with the Windows Credentials store credential helper. This can be configured with
git config --global credential.helper wincred

Couple of times git has suddenly started complaining “remote: Repository not found” when trying to do a pull on existing project. I haven’t figured out what is causing this, but the solution that works:

  1. Clear the existing credentials. This is done by starting up Windows “credential manager” just type this to “Run… ” or find it via Control panel (this is part of Windows). Look for github related things and remove them
  2. After this, git should ask again for your username when you try to do an operation that requires authentication. With two factor authentication you can’t just enter the username and password. Instead of password you need to use “personal access token” which can be generated on Github web pages. Click your profile icon and selected “Personal access tokens” from the menu on the left. Generate either a new token or reset the existing one so that you get access to the token which is a hex string.
  3. Login with your Github username and the access token. Once you have done this, you should see an entry for git:https://<username> on in the Windows Credentials Manager.
Posted in Misc |

QC35, Windows, Bluetooth audio

I started investigating pairing problems with my Bose QC35 headphone/headset and Windows. At first I was wondering why I actually see two separate QC35 devices with different icons in the pairing list. Soon I figured out the other one was “headphones” and the other one “hands-free” device. If I wanted to just listen to audio, the headphones was enough. In order to use QC35 in Skype, I had to enable the other one as well. For headphone use the audio quality was acceptable. In Skype is was quite horrible – which was not something I expected. Something had to be wrong, so I started digging..

Bluetooth specifications define bunch of various profiles for different services. For this post the relevant profiles are A2DP (Advanced Audio Distribution Profile), HPF (Hands-free profile) and HSP (Headset profile). When you are listening to high quality sound through your bluetooth headphones, you are using A2DP. A2DP supports stereo sound and quality is reasonably good. For headset use A2DP is no good, it can only transport audio to one direction (and in addition it has a bit higher latency, something like 120ms. In order to also use the microphone in the headset (to transfer audio to computer) you need to switch to HPF/HSP.

The audio quality of standard HPF is not exactly stunning. To make things better, version 1.6 of the profile introduces support for wideband audio. This is implemented using the same SBC codec that is mandatory for the A2DP profile. To make things complicated, the wideband audio is not a mandatory feature of the 1.6 specification.

Apparently some manufacturers are not so much touting the different bluetooth profiles and versions they support. Despite some serious Googling I was unable to find an official specification document from Bose. Luckily the manufacturers are required to submit very detailed information about their Bluetooth compatibility things to the Bluetooth SIG and the information is published on

Looking for things is pretty easy. Head to their search for listings page and type in the name of the product. In this case “QuietComfort 35”. From the results pick the right product, and from the details page choose “Display ICS details”. The information we are interested in can be found from “Profile ICS” tab. The codec for wide band audio is called mSBC (I assume the “m” stands for “mono”). In the table for QC35 you can see that this is not supported. So no wide band audio for QC35. I found this somewhat suprising, I would have assumed the flagship device from Bose would come with all the goodies.

Another top-of-the line product is Sennheiser PXC 550. I checked the listing and same thing – no wide band audio support. However the listing shows PXC 550 does support aptX. I have yet to figure out if this is something just for playback or if it applies to recording side as well.

I then continued the investigations with my old and forgotten Nokia Purity Pro headset. This is already quite old device, maybe from around 2012. For my surprise, the pages show mSBC as supported for Nokia Purity Pro.

Ok, so my head phones don’t support wide band audio, but how about my computer? I’m running trusty old Lenovo T440p, with Intel Bluetooth chip. Intel claims support for wide-band speech, but they also say Windows 8 and Windows 8.1 support audio profiles natively. Which I believe means that I need to check what Windows supports. This information can be found from MSDN. Bluetooth Version and Profile Support in Windows 10 document Microsoft specifies the HFP version supported is 1.5, which indicates that wide band audio is not supported (this is different for Windows Phone 10, which does support 1.6).

Posted in Misc |

Get SSL cert in PFX format using OpenSSL

Steps for getting SSL certificate in pfx format (suitable for Azure for example)

openssl req -new -nodes -keyout mycert.key -out mycert.csr -newkey rsa:2048

Upload CSR, get the Certificate and save it local file. Get the intermediate certificates (if needed).

Concatenate the intermedia certs to one file:

cat AddTrustExternalCARoot.crt COMODORSA* > intermediates.crt


openssl pkcs12 -chain -export -out mycert.pfx -inkey mycert.key -in mycert.crt -CAfile intermediates.crt
Posted in Azure |

Azure, add IP address to cloud service

Azure now supports multiple IP addresses per cloud service. This means you can for example host multiple web sites, each running in different IP address on one cloud service (1..n virtual machines).

Right now it seems to be be possible to manage this only via the Azure PowerShell commandlets. After adding a secondary IP for my cloud service I was no longer able to manage the end points via Azure management web site or the command line tools.

In brief the commands to create a new reserved IP address and create a load balancer that uses the IP are following:

# Create a new reserved IP address
New-AzureReservedIP –ReservedIPName "MyIP"  –Location "West Europe"

# Create load balancer and end points that use the reserved IP
# Here I'm adding it to two virtual machines which are part of the cloud service
Get-AzureVM -ServiceName myservice -Name vm01`
| Add-AzureEndpoint -Name myEndpoint -LoadBalancedEndpointSetName http`
    -Protocol tcp -LocalPort 8001 -PublicPort 80 -VirtualIPName MyIP -DefaultProbe `
| Update-AzureVM

Get-AzureVM -ServiceName myservice -Name vm02`
| Add-AzureEndpoint -Name myEndpoint -LoadBalancedEndpointSetName http`
    -Protocol tcp -LocalPort 8001 -PublicPort 80 -VirtualIPName MyIP -DefaultProbe `
| Update-AzureVM

# To see the endpoints for VM
Get-AzureVm -ServiceName myservice  -name vm01 | Get-AzureEndpoint

Posted in Azure |

Azure CLI tools, Credentials have expired, please reauthenticate

After installing Azure CLI tools and trying to use them on the first time on Windows, I started getting “Credentials have expired, please reauthenticate Detailed error message from ADAL is as follows: Error: Entry not found in cache.” error message. A regular logout/login did not fix the issue in my case.

I did not figure out the exact reason for the error, but a fix was simple. First logout using

azure logout <username>@<domain>

Then issue a command to clean up(?) the credentials:

%APPDATA%\npm\node_modules\azure-cli\bin\windows\creds.exe  -d -t AzureXplatCli:target=* -g

And after that login again.

Posted in Azure |

IntellijJ IDEA: Maven home directory is invalid

When creating a new project based on Maven archetype IntelliJ IDEA wants know certain Maven related directories. It took few minutes to figure out what IDEA actually wants here and answering wrong gives the not very informative “Maven home directory is invalid” -error message.

The Maven home directory is the place where your Maven installation is located. It is not your personal Maven directory, which in Windows is usually c:\users\<username>\.m2



The “Maven home directory is invalid” message would be a lot more helpful if IDEA would tell WHY it thinks the directory is not valid. If you are trying to find a specific file or sub directory – please tell me.

Posted in Misc |

Convert SPSS .SAV file to CSV (for Excel)

SPSS alternative, GNU PSPP include a very easy to use tool that can convert the SPSS SAV file to CSV. This can be further read in to excel. Just open the csv file in Excel. If excel does not automatically split data, choose the first column, go to Data tab and select “text to columns” and use comma as separator.

Usage is very simple:

pspp-convert <input.sav> <output.csv>

More instructions in documentation. You can download the Windows version of SPSS at least from pspp4windows Source Forge project page.

Posted in Misc |

Filezilla GnuTLS error -15: An unexpected TLS packet was received and VsFTP


sudo /usr/sbin/setsebool -P ftp_home_dir 1

Long(er) story

I ran into “interesting” problem on CentOS while trying to setup VsFTP with FTPS. I was using FileZilla to connect to the server. The VsFTPd version that comes with my CentOS version seems to be rather old, 2.2.2. The setup however was smooth. But then the problems started. The main issue I hit was FileZilla complaining about “GnuTLS error -15: An unexpected TLS packet was received” after the connection was established (NOTE: GnuTLS error -12 indicates a different problem, and a common solution is to add ssl_ciphers=HIGH to vsftpd.conf)

To an untrained eye this might indicate there is something wrong with the encryption. But no – apparently the “GnuTLS error -15” on FileZilla can be also caused by other issues which have nothing to do with the encryption. The way to find the solution was to take a step back, enable regular FTP and try to connect with that one. The regular connection attempt showed an interesting error message: “500 OOPS: cannot change directory:/home/myaccount”. Since I had already checked the permissions on the directory, the problem started to sound like some issue with SELinux. And indeed, that was the case. FTP daemon could not access the home directory of the user due to missing permissions.

Some googling revealed that “sudo /usr/sbin/setsebool -P ftp_home_dir 1” was the correct thing to do. And indeed, after that command both FTP and FTP-S started working.

Lessons learned: very the unencrypted stuff works before sprinkling security to your solution.

Some resources:

Posted in Misc |

Enable debug log in Azure Storage Emulator

Azure Storage Emulator has logging capability but this is not enabled by default and it does not seem to be available via user interface.

In order to enable the log,

  • Head to the Storage Emulator data directory, which is located at %LOCALAPPDATA%\DevelopmentStorage.
  • Edit the the developmentstorage configuration file located in the directory and change the LoggingEnabled to true
  • Restart Strorage Emulator

The logs will appear in the logs directory.

<?xml version="1.0"?>
<DevelopmentStorage xmlns:xsd="" xmlns:xsi="" v
Posted in Azure |