Coding

To have System.IO.FileSystemWatcher LastAccess work, the system must have access logging enabled with the following command. fsutil behavior set DisableLastAccess 0 After setting this, reboot, and you can successfully use the FileSystemWatcher to monitor LastAccess of files (sorta). Example Code FileSystemWatcher lWatcher = new FileSystemWatcher(@”C:\windows\temp”, “*.*”); lWatcher.NotifyFilter = NotifyFilters.LastAccess; lWatcher.EnableRaisingEvents = true; lWatcher.Changed += new…

Read More FileSystemWatcher – LastAccess Not Working

Over the last few weeks I’ve been using Python to scrape the Pennsylvania Department of Health’s Coronavirus page. Over time the page has evolved and even split into sub-pages which contain table date of cases, deaths and other statistics. I’ve decided to put my Python script on GitHub for public consumption. Initially when I had…

Read More Pennsylvania COVID-19 Data Scraping with Python

I’ve been trying to learn some Python and have been tinkering with the requests module. Here is how I am able to log into a webpage, such as WordPress. import requests url = “https://techish.net/wp-login.php” redirect_to = “https://techish.net/wp-admin/” with requests.Session() as session: post = session.post(url, data={ ‘log’: ‘admin’, ‘pwd’: ‘password’, ‘redirect_to’: redirect_to }, allow_redirects=True) get =…

Read More Login to WordPress from Python

Came across a script I wrote some time ago. Sitting there in my user directory was patch.cmd. As I find my scripts, I’m putting them in Git for historical purposes… and for a good laugh. What in the actual fuck are you, patch.cmd? –Rich One thing I learned;  document the damn things.  I had no…

Read More Forgotten Scripts

This snippet of code worked when tested in VB.NET application I’m working on. It will set the User Agent string for the duration of the control. Private Property uag As String = Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko _ Private Shared Function UrlMkSetSessionOption(ByVal dwOption As Integer, ByVal pBuffer As String, ByVal dwBufferLength…

Read More Change User-Agent in WebBrowser Control