Linux vs Windows: Python Virtualenv

Although Virtualenv is available on both Linux and Windows, there are some differences that you may find useful to understand.

Is there a difference to creating virtualenvs?

No, creating virtualenvs in Windows and Linux is exactly the same.

Can I use the same venv folder on both systems?

No. You will need to create 2 separate virtual environments. I suggest creating folders named winvenv and linvenv to tell them apart. You will have access to the same packages through pip, although you will need to use pip freeze if you wanted to replicate the packages exactly.

Do I activate the venvs in the same way?

No, but you CAN activate, and the differences are subtle. After creating the virtualenv, follow these steps:

Windows

\winvenv\Scripts> activate

Navigate to Scripts within the venv root. Type activate to use your venv in the current prompt

Linux

$ source linvenv/bin/activate

In the terminal, type source followed by the path to /bin/activate within the viretualenv folder

uhex – a CLi hex editor

A quick and easy to use CLi script to transform hex values into different data types.


Current known limitations:

  • Hex order : will only convert from Big-Endian hex orders
  • Hex to int : will only convert hex to unsigned integers

Known Issues:

  • Hex to float not yet fully working

The script is available from github :

github : uhex

WordPress XMLRPC.php is now working!

I really like the additional features provided by the Jetpack plugin, and after the recent migration, it stopped working. I checked over permissions, .htaccess, WP configurations and even cross referenced some major server configs to try and figure it out.

I remembered that I had this issue before and needed to install another module somewhere, but unfortunately couldn’t quite put my finger on it. Looking at apache2 error logs, after several tries at linking to wordpress.com, and XML error showed up. A quick Google of this informed me of a PHP XML module.

The PHP module is needed to produce and receive the XML through the RPC API.

Since I’m using PHP 7.0, all I had to do was issue this command:

sudo apt install php7.0-xml

If your running a LAMP stack, you can change the version to your current PHP version, or simply:

sudo apt install php-xml

could work too (although some people have had issues with this “generic” module)

Restart Apache2 and you should be good to blog from anywhere!

MYSQL Crashes… FIXED!

I was awoken today with a rather rude message indeed. An email from Jetpack plugin notifying me that the website was down. I often get this message at the most awkward of times, mainly whilst unable to log in to the server.

Opening up the site shows me an alarming message “Unable to contact database”…. the worst kind of messages. Databases have never been my strong point… I find them terribly complicated and I tend to just leave them alone as much as I can.  Now what? Annoyingly MYSQL seems to quickly zip up any MYSQL error log files, often leaving the latest error log almost completely empty. Another annoyance.

Trawling through the logs, I can see MYSQL has shut down, restarted, shut down, restarted, until it finally gave up. Quickly found the error…

innodb is trying to pass over 130MB of indexed(?) files to the allocated defaulted 128MB buffer size pool. After a bit of tinkering and increasing the size, the site not only has greatly improved response time, but it should cure the site from going down regularly.

It’s not fixed until the fat server sings…

It’s early days but I’m confident the issue is resolved. I will monitor the situation to hopefully find 30 WHOLE DAYS of uptime. Here’s hoping.
( that is not an invitation btw 🙂 )

Fail2ban Unban All / Mass Unban Guide

Fail2ban-Script-postimage

Update: you can find a fully automated script here. If you’d rather do it manually.. keep reading…


Here’s a quick guide to unban all ip’s from a fail2ban jail in linux.
This is semi-automatic with some user input involved. You also may need to change file paths and script commands to cater for your system’s configuration. Lets get started. Continue reading “Fail2ban Unban All / Mass Unban Guide”