Login to WordPress or other accounts using python selenium package

The best way to install the selenium package is using the following command:

$ pip install selenium

or on macOS with Homebrew

$ brew install geckodriver

If you are using Anaconda just simply activate your virtual environment and then install geckodriver using the following command:

$ conda install -c conda-forge geckodriver

Then you’ll need a driver to interface with the browser you choose. I used Firefox in this example, therefore I downloaded the required geckodriver driver.
Drivers for other browser: selenium-python.readthedocs.io
You might need to set the PATH of your geckodriver.

This python source code will pull up a Firefox window and open the url that you need set https://yourwpdomain.com/wp-login.php, then find user_login and user_pass elements on the page (by the id) and finally send a click() function to the submitButton.
If everything goes well the next thing you should see is your WordPress dashboard page in the browser.

If you are using Windows you might need to set the geckodriver PATH with FirefoxDriver.

How to use wget without adding –no-check-certificate

You need to add a check_certificate = off line into your .wgetrc file in your Home directory.
Or simply run this command on your terminal.

After this wget will add this –no-check-certificate automatically from your .wgetrc file.

BTCPayServer the self-hosted payment processor for Bitcoin and other cryptocurrencies.

How does it works?

BTCPay Server is a self-hosted and automated invoicing system. When checking out, the customer is presented with an invoice. Each time, a different address is tied to a particular invoice, so there is no address re-use. BTCPay follows the status of the invoice through the blockchain and informs a merchant when he can fulfil the order safely.

BTCPay is a code, not a company. There is no third-party between a merchant and a customer. Merchant is always in full control of the funds. There are no processing or subscription fees. BTCPay Server is free to use and completely open-source, so developers or security auditors can always inspect the quality of the code.

Source code: https://github.com/btcpayserver/btcpayserver

SQLite – How to use fundamental functions in C++

SQLite operations in C++
This tutorial aimed to demonstrate how to use SQLite database operations such as CREATE, INSERT, UPDATE, SELECT and DELETE in C++. Since the appearance first smartphone and other mobile devices SQLite become most widely deployed and used database engine in the world. Precise numbers are difficult to obtain but SQLite is likely used more than all other database engines combined. We can find SQLite in every Android device, iPhone and iOS device, Mac, Windows10, Firefox, Chrome, Safari, Skype, Dropbox, TurboTax, QuickBooks, PHP, Python, television sets, set-top cable boxes and many automotive multimedia systems.

It’s an open-source SQL database engine. You can download the source code or precompiled binaries depending your requirements. You might also need to add [-lsqlite3] and [-std=c++17] to successfully compile, create an executable file. Each of the following source code available on my git repository.

github.com/lnrsoft/sqlite3_cpp_basics_updated

Use this link local_db.sqlite.zip (116 downloads) if you would like to download the local_db.sqlite file that I used in this tutorial.

Step 1 – The first thing we need to do is to create the actual database file that we will use in this article. I called sqltdemo.db in our case.

Compile and run our source code to create the local_db.sqlite with the following command. Here we link our code with the sqlite3 library that will create our db file.

Verify our result:

Step 2 – CREATE TABLE

Compile and run.

Step 3 – INSERT INTO our CANDIDATE TABLE

Compile and run.

Step 4 – Fetch and display records from the company CANDIDATE TABLE. In this scenario we use a callback function that obtains results from SELECT statement.

Compile and run.

Step 5 – Using UPDATE statement to update any records in our CANDIDATE table.

Compile and run.

Step 6 – DELETE statement can delete any records from the CANDIDATE table.

Compile and run.

I recommend you to check the official SQLite documentation at sqlite.org for more advance SQLite features and options and support. For further info about using sql with c++ you might found it useful to read me previous post of  a simple Qt tool to test QSqlDatabase access connection to a MySQL database. I created this simple Qt command line tool to test connection between Qt client applications and a remote Mysql Server. The code includes Secure Sockets Layer (SSL) support to test secure connection. The QSqlDatabase class provides an interface for accessing a database through a connection where an instance of QSqlDatabase represents the connection. The connection provides access to the database via one of the supported database drivers, which are derived from QSqlDriver.

Alternatively, we can subclass your own database driver from QSqlDriver. My next post will be an article how to write your own database driver in Qt for Unix, OSX and Windows platforms.

[WWW] Web development tools

Here is a list of web development tools I mostly use, these tools are coming very useful especially to analyze, tune and optimize your web project. These are essential tools to achieve the best user experience and highest performance.

https://developers.google.com/speed/pagespeed/insights/
https://www.websitepulse.com/help/tools.php
https://tools.geekflare.com/tools/dns-lookup
https://www.webpagetest.org 
https://tools.geekflare.com/report/speed-test 
https://performance.sucuri.net 
https://sitecheck.sucuri.net 
https://www.site24x7.com/web-page-analyzer.html
https://www.dotcom-tools.com/website-speed-test.aspx
http://www.monitis.com/pageload/

[Linux] Enable universe, multiverse and restricted repositories on Ubuntu

Use the following terminal commands to enable universe, multiverse and restricted repositories on your Ubuntu system. It works well on the latest Ubuntu Server 18.04 LTS

How to temporarily disable IPv6 on Ubuntu? You need to diagnose a communication issue or track down a network problem?

IPv6 provides solution of the IPv4 address exhaustion as it’s offering a much larger addressing space.
However, there are few instances in which IPv6 is casing network problems.
Some hardware doesn’t utilize it or take any advantages of IPv6 communications protocol. There are instances in which the temporary and easy solution is to (permanently) disable it. It can be easily re-enabled when it needed again.

In case you need to disable it, either only for troubleshooting or permanently, you can use the following terminal commands.

First of all, let’s verify the current status of your IPv6 communications protocol.

If this command returns 0 that means IPv6 is enabled in your system.

Scroll down to the end of the file and insert these three lines below.

Save and quit your editor, then reboot your system.

Verifying the status of IPv6.

This command should return 1 meaning you successfully disabled IPv6 communications protocol.

To re-enable IPv6 just simple delete or comment out those 3 lines above.

You can use

to read values from file, it should return:

There are some additional commands if this method does not work.

Disable the network manager

Get the IP address from the server using:

List of IP address

Removing all IP information from an interface (enp2s1 in my case)

Assign the first ip addresses like this:

You can repeat for other IP addresses.
You can add the default route using:

List of network devices:

Restart the networking.service

or

Ipv6 test is a free online service to diagnose connection problems: http://ipv6-test.com/