Friday, November 5, 2021

PyCompilePackage, A Lightweight Python Pre Compiler and Packager

A Lightweight Python Pre Compiler and Packager (As a single Package). with Added Support for Dependencies having C/C++ extensions. e.g. Numpy

Try PyCompilePackager here.

Are You Tired of, with the below aspects of your Python Deployments?

* Concerned about sharing the Original Python Source code files for Deployment? (The source may highly prone towards tampering)

* Slow startup time of your Python App, due to the initial compilations

* Your deployment contains the whole hierarchy of Python Source, folders and associated files (which are Difficult to manage and update)


PyCompilePackge, Helps to make your Python Build/Deployments clean and compact by;

1. Pre-Compile all your python sources to Byte Codes

2. Package those Compiled Files in a Single PYZ Container file, with any associated resources

3. Deployment is as simple as, Copy this single PYZ file to Target Machines and run


This has the below advantages over the traditional python deployments;

* Original Python Source code is not shared, hence less chance for tampering

* Enjoy performance boosts, due to pre compiled source and faster startup time

* Easy and fast (re)deployments, as you don't have to deal with lot of files/folder hierarchies

* Chances for Individual file corruption post deployment is less, Since all files have packaged as a single PYZ file

Friday, September 24, 2021

Reconnect to a Local Desktop Session from RDP : Linux

Connecting to the same Locally Logged In Desktop Session, from an RDP Client is an obvious challenge in any Linux Environment. But this should be the way, how RDP Protocol should behave as we find with Windows Machines.

Linux RDP Implementations like XRDP, will create separate Session with Remote Connections, rather than connecting to a locally available Desktop Session.

However you could use a combination of both XRDP and X11VNC utilities, to achieve the desired behavior.

A sample implementation with Debian10 LXQt Desktop (using LightDM as the display-manager) is given here;

fig. A Debian 10 Virtual Machine, being accessed simultaneously from an RDP Client (Remmina) and a native viewer (Virt-Viewer), using the same Session.

RDPShareLocalSession

Monday, March 29, 2021

Cross Compile Modern C++, 2X Faster and Cleaner with Docker

Setting up Cross Compilation Tool Chain on your Development Box for Modern C++, is not easy and could easily pollute or break the system.

However, Docker and Qemu User space Emulation will make these tasks a lot more simpler and faster.

Refer a sample implementation in this GitHub Page.

image

 

image

image

Tuesday, March 16, 2021

Run Your Pi (RaspberryPi) with 16GB Of RAM !

Enable your Pi to boot from a good quality SSD (Solid State Drive).
Enable Swap file, and configure it to grow between 8-16 GB.

Your Pi is now ready to take, much demanding use cases !

image

  

Components Used:

PowerBank-1 (Two 2.4A Out), powering
   Raspberry Pi2
   120GB SSD (Enables Virtual Memory of 16GB for Pi)

PowerBank-2 (Two 2.4A Out), powering
    Router (Used as Wifi Extender – Optional*)
    USB FAN (To maintain the Pi’s temp between 40-42C)

 

 

Sunday, February 14, 2021

WhiteStat : Real-time Daily Network Bandwidth Usage Analyzer, Targeted for RaspberryPi

WhiteStat is an entire Network (Internet) Bandwidth Daily Usage Analyzer, in a Docker Container with Historic Data Persistence.

Supports both IPV4 and V6 captures. It requires no other external dependency other than Docker CE installed on the Host.

 

image

Key Features includes:


1. Entire Network Usage Analyzer is in a Docker Image and minimal enough to run on a Pi Hardware


2. Provides Daily Usage Levels per individual Host in the Network, Considering DHCP and the same Host could have different IP's on the same day


3. Single Responsive Dashboard (UX) to view all the daily/historic statistics. Supports searching/sorting on all usage record fields.


4. Survival of Usage Data, in case of a System Crash (Router/Pi at which WhiteStat is running)
WhiteStat keeps checkpoints on data usage in every 30 Seconds by default, and use the same as the starting level, when the system comes up.


5. Provides Historic Data, in SQL lite Database


6. JSON end points are given, so that it could be integrated with other Analytics tools for detailed data analysis (like PowerBI, excel)

To Know More Follow WhiteStat in GitHub.

image

image

Monday, January 18, 2021

PowerBank as a UPS, for RaspberryPi

We could make use of a Standard Powerbank, as a cost effective UPS to powerup RaspberryPi. This will be particularly useful, if Pi is serving critical functions for your network 24x7, and you cannot afford any downtime.

Make a note of below important points;

a. Use a PowerBank that meets the Voltage/Current specifications of Pi.

b. The PowerBank should allow PassThrough Charging

(So you could charge your PowerBank and Pi at the same time)

c. The PowerBank should allow Advanced Current Shunt

(Even if you leave the PowerBank, with AC Power the feature will protect from Overcharging).

Moving around the Pi, While its Up and Running !

image

Sunday, January 17, 2021

Network Bandwidth Monitoring/Analysis Using RaspberryPi II

Pi could be used to Monitor the Bandwidth Usage of entire Home Network. Time series data could be visualized in different types of Charts. Historic data visualization supported (e.g Monthly Bandwidth Usage). Each Network/IP/Machine level statistics could be analyzed and viewed.

The below configuration explain about setting up such an environment. The only prerequisite would be, Make all your traffic go through Pi. i.e Change your Default Gateway from Router to Pi. This could be easily done through, updating the Router LAN settings, and putting Raspberry Pi IP-Address, in the Default Gateway box.

Now update Raspberry Pi’s Default Gateway as Routers IP, and enable IP forwarding. This will make all traffic destined for Internet will be automatically routed to the Router from Pi. Finally setup ‘ntopng’, to churn the network packets, for analysis. 

Detailed instructions are given here.

image

image

Monday, January 11, 2021

Raspberry Pi, as Network Security Appliance/AD-Blocker

In this article, we will explain how to use RaspberryPi, as a Network Security Appliance for private network, which could be used to block all ADS, and secure the network by whitelisting/blacklisting DNS names.

It could effectively improve the overall network performance as all the AD requests going out of your private network will get blocked, and never goes out of your private network. It extends the protection to all computers in your network including mobile/other devices connects to your home network.


The below configuration shows, Pi-Hole deployed in Docker containers hosted on a RaspberryPi, and managed through Portainer (A Container orchestration platform, again running inside a Docker Container)

image

 

You could find the instructions on setting up the same here.

The only change we’d, is using a new version of Pi-Hole image (pihole/pihole:v5.0-armhf)

A single day operation statistics is given below: In a single day operation, Pi-Hole has blocked 31.7% of total requests, which are of type Ads.

Since the CPU/Memory (~4.5MB) footprints are pretty low, Pi runs smooth 24x7 and meets the network performance.

image

Bypass Qemu Network Stack with Virtio-Vhost, for Near Native Performance

For virtualized environments, primary performance bottleneck could happen with below resources:

a. CPU

b. Storage

c. Network

For CPU, direct passthrough option would give a performance near to bare metal. For Storage and Network, deploying VIRTIO drivers (paravirtualization) could provide a descent performance as well. These concepts have been explained here.

With network, one more performance tuning is possible, to completely bypass the Hypervisor (Qemu) network stack, and let the GUEST directly interact with HOST’s network stack. This may give almost similar network performance for guest applications as with application running on the host.

Implementing this requires, enabling ‘vhost_net’ driver on the host, and update the VM Settings to use this driver, which is detailed here.

In an optimal setting, you will also enable the same number of IO-Queues, as with the total number of CPU Cores allotted to the Virtual Machine.

Reference

image