Open Cygwin at a specific folder
February 3rd, 2021The easiest way to do this is open up a Cygwin terminal (as an administrator) and type the command:
chere -i -t mintty -s bash
If the icon doesn't show, you can use the following (Windows 10) from within a cygwin window:
regtool -w -s set /HKCU/Software/Classes/Drive/Shell/cygwin64_bash/Icon 'C:\cygwin64\Cygwin-Terminal.ico'
regtool -w -s set /HKCU/Software/Classes/Drive/Background/Shell/cygwin64_bash/Icon 'C:\cygwin64\Cygwin-Terminal.ico'
regtool -w -s set /HKCU/Software/Classes/Directory/Shell/cygwin64_bash/Icon 'C:\cygwin64\Cygwin-Terminal.ico'
regtool -w -s set /HKCU/Software/Classes/Directory/Background/Shell/cygwin64_bash/Icon 'C:\cygwin64\Cygwin-Terminal.ico'
And to remove the icon:
regtool -w unset /HKCU/Software/Classes/Directory/Shell/cygwin64_bash/Icon
regtool -w unset /HKCU/Software/Classes/Directory/Background/Shell/cygwin64_bash/Icon
regtool -w unset /HKCU/Software/Classes/Drive/Shell/cygwin64_bash/Icon
regtool -w unset /HKCU/Software/Classes/Drive/Background/Shell/cygwin64_bash/Icon
If you don't have admin privileges, you can do the following:
Go to your "Send To" folder
C:\Users\<your_user_name>\AppData\Roaming\Microsoft\Windows\SendTo
Create a shortcut "Bash Here" with this target:
C:\cygwin\bin\mintty.exe -i /Cygwin-Terminal.ico C:\cygwin\bin\bash.exe -l -c "cd \"$0\" ; exec bash"
OpenVPN Certificates
February 2nd, 2021Suddenly all my OpenVPN connections stopped working. Turns out that the signing certificate expired (took some doing to figure this out). Here are some links dealing with OpenVPN certificates (and certificates in general)
How to change CA certificate validity period
OpenVPN - expired certificates
Dumping SSL certificate information
Extend validity of a OpenVPN certificate
Easy-RSA v3 OpenVPN Howto
Easy-TLS
How to decrypt an OpenVPN EasyRSA Encrypted Private Key
Generate OpenVPN Certificates and Keys
For PEM, use the following:
openssl x509 -text -in cert.pem
For PKCS#12, use this:
openssl pkcs12 -info -in cert.pfx
To dump a CSR (Certificate Signing Request), use this:
openssl req -text -in request.csr
To dump/check a private key:
openssl rsa -text -noout -in key.pem
Ford F250 Wiring Information
February 2nd, 2021I added a backup camera to the truck and to do so, I needed to hook into the reverse switch to make it automatically switch to the camera when put in reverse. Here are a couple links to wiring diagrams that helped out.
1993 F150XLT 5.8L info on backup wiring
'93 Bronco Firewall Connectors
OPNsense
February 1st, 2021I've been using pfSense as my firewall/router for several years now. Overall, I've been very satisfied except for one issue. I don't believe I ever got failover to work reliably and that is key. I had written my own software to handle failover years back so it should have been a no brainer to get it to work properly on a dedicated firewall/router package. For the past couple years, I actually installed an a/b network switch to manually switch between our primary and backup network as needed and utilized a second (backup) server to connect to the AT&T DSL line. The current state came up in conversation and I decided I should make another attempt at getting it working properly. During my research process, I stumbled upon OPNsense which is a fork of pfSense and ultimately decided to give it a try. It turns out that 5+ years of tweaking my router / firewall / DNS / DHCP / etc... adds up to a significant amount of configuration so it took a few days to get everything set up but I finally made the switch and I believe everything (including failover) is working properly now. Here are a bunch of links that I used to get everything set up (note: some links are for pfSense but are related/applicable).
Note: While apparently it is possible to import some configuration sections from a pfSense export file, I chose to set everything up manually to ensure it was done (theoretically) properly and not take any chances on configuration incompatibility. In some cases, I did export configs from both systems, extract data from the pfSense backup, clean it up and paste it into the OPNsense config and re-import, but this was mainly for DHCP static address mapping.
Comparison
Thinking about moving from pfSense to OPNsense
Multi-WAN / Failover
How to configure pfSense as multi wan (DUAL WAN) load balance failover router
"Skip rules when gateway is down"-equivalent in OPNSense
(Solved) Multiwan (failover) DNS not working
Default gateway behavior with DNS Resolver in 2.4.4
DNS doesnt work for wAN 2 FAILOVER
DUAL WAN ON PFSENSE 2 - HD Quality
pfSense Part 10: Configure Multi WAN Load Balancing
How to Setup Failover and Load Balancing in PFSense
Pfsense - Multiple Wan link load-balancing
Pfsense - Multiple Wan link Failover Configuration
OPNsense - Multi WAN
Installation
OPNsense Installation [ Step by Step ]
Port Forwarding
NOTE: for port forwarding, set up the port forward and OPNsense will automatically create the linked rule.
Portforwarding in OPNsense
[Tutorial] How I do port forwarding - simple and straightforward
How to Configure Firewall Rules in OPNsense
BIND
OPNsense - BIND Plugin
BIND with DNSBL – more detailed information about DNSBL types?
DNSBL via BIND Plugin
Config Backups
Automatic config backups using os-api-backup
Sample bash script for backups using the API
Miscellaneous
My Successful Migration - pfSense to OPNsense
How to setup AT&T Arris BGW210-700 IP passthrough
Python Selenium for Automation
January 25th, 2021Occasionally, I need to perform some sort of automation task on a website that is beyond the capability of mechanize. In these cases, I generally end up using Selenium to do the automation. Selenium actually remote controls a browser so the browser performs all the Javascript interpretation as it normally would. Here are a number of related links I used for the last Selenium/Python task I performed:
How To Screen Scrape With Python
Unable to hide “Chrome is being controlled by automated software” infobar within Chrome v76
Selenium-Debugging: Element is not clickable at point (X,Y)
Scrolling to element using webdriver?
How to handle child windows in Selenium with python?
Python 3.5 - Selenium - How to handle a new window and wait until it is fully loaded?
Selenium Python Waits
How to check if some text is present on a web page using selenium 2?
How to close all windows that Selenium opens?
How disable debuger on chrome webdriver in Python 3.x?
How to Maximize window in chrome using webDriver (python)
I've used XPath to identify items for Selenium to click. Here are some XPath specific links:
How can I find an element by CSS class with XPath?
Selenium - XPATH - Searching for element by innerHTML
XPath with multiple conditions
How to use XPath contains() here?
XPath: Find element that contains text X and not Y
XPath Find full HTML element ID from partial ID
XPath locator examples
