PowerShell script to check the status of a URL

I recently set up a script that does this. As David Brabant pointed out, you can use the System.Net.WebRequest class to do an HTTP request. To check whether it is operational, you should use the following example code: # First we create the request. $HTTP_Request = [System.Net.WebRequest]::Create(‘http://google.com’) # We then get a response from the … Read more

How to monitor a complete directory tree for changes in Linux?

I’ve done something similar using the inotifywait tool: #!/bin/bash while true; do inotifywait -e modify,create,delete -r /path/to/your/dir && \ <some command to execute when a file event is recorded> done This will setup recursive directory watches on the entire tree and allow you to execute a command when something changes. If you just want to … Read more

Check if a VPN connection is active in Android?

Using NetworkCapabilities worked for me. You have to loop over all existing networks and check which has VPN_TRANSPORT ConnectivityManager cm = (ConnectivityManager)mContext.getSystemService(Context.CONNECTIVITY_SERVICE); Network[] networks = cm.getAllNetworks(); Log.i(TAG, “Network count: ” + networks.length); for(int i = 0; i < networks.length; i++) { NetworkCapabilities caps = cm.getNetworkCapabilities(networks[i]); Log.i(TAG, “Network ” + i + “: ” + networks[i].toString()); … Read more

What is the best macro-benchmarking tool / framework to measure a single-threaded complex algorithm in Java? [closed]

Below is an alphabetical list of all the tools I found. The aspects mentioned are: is it easily parameterizable is it a Java library or at least easily integratable into your Java program can it handle JVM micro benchmarking, e.g. use a warmup phase can it plot the results visually can it store the measured … Read more

How can I monitor a Windows directory for changes?

Use a FileSystemWatcher like below to create a WatcherCreated Event(). I used this to create a Windows Service that watches a Network folder and then emails a specified group on arrival of new files. // Declare a new FILESYSTEMWATCHER protected FileSystemWatcher watcher; string pathToFolder = @”YourDesired Path Here”; // Initialize the New FILESYSTEMWATCHER watcher = … Read more