Tuesday, March 24, 2020

Defragmentation and resizing to minimize HD size of a Virtual Machine Drive for Virtual Box

When creating a Virtual HD for Virtual Machine in Virtual Box, you can create a large disc space but the actual size on the disc can be much smaller until you fill it up.
But after you fill it, and then delete and try to free space the size on the host disc still remain large.

Here is how to resize the Virtual Drive HD on the host machine:

You have to do the following steps:

Run defrag in the guest (Windows only)
Nullify free space:

With a Linux Guest run this:
dd if=/dev/zero of=/var/tmp/bigemptyfile bs=4096k ; rm /var/tmp/bigemptyfile
Or:

telinit 1
mount -o remount,ro /dev/sda1
zerofree -v /dev/sda1
With a Windows Guest, download SDelete from Sysinternals and run this:

sdelete.exe c: -z
(replace C: with the drive letter of the VDI)

Shutdown the guest VM

Now run VBoxManage's modifymedium command with the --compact option:

With a Linux Host run this:

vboxmanage modifymedium --compact /path/to/thedisk.vdi
With a Windows Host run this:

VBoxManage.exe modifymedium --compact c:\path\to\thedisk.vdi
With a Mac Host run this:

VBoxManage modifymedium --compact /path/to/thedisk.vdi
This reduces the vdi size.

https://superuser.com/questions/529149/how-to-compact-virtualboxs-vdi-file-size

Wednesday, March 11, 2020

גרף שעוקב אחר התפשטות והדבקות נגיף הקורונה בארץ

העיתונות מפרסמת הרבה מספרים והרבה מלל. אז אני מנסה לתמצת את זה, ותמונה שווה יותר מאלף מילים וגרף שווה יותר. אז אני אוסף את פרומי העיתונות ועוקב כמה חולי קורונה חדשים יש לנו כל יום ושם את זה על גרף בשאיפה לראות מגמות, כמה נדבקים, כמה נדבקו בארץ מקורונה ולכמה תחלואה בארץ ישראל גורם הנגיף COVID-19. 

ניתן גם לראות את המספרים הגולמיים של חולי הקורנה, הדבקות חדשות, חולים קשה וכמה הבריאו מהנגיף ישירות במסמך Google Sheets שיצרתי על חולי הקורונה.

והנה גרף חולי הקורונה בארץ:

Saturday, March 7, 2020

Firefox notifications permissions fix for non secured domains (http and not https)

I had a running internal service inside an organization intranet. We wanted to allow notifications (web notifications) but we couldn't. In order to allow notifications for website and domains, both Firefox and Chrome requires https. Quite annoying since it is an Intranet inside the organization.

Trying to install a self-sign certificate or a signed certificate inside the organization (where there is no outside internet connectivity) it's really a pain in the a** and does not work well - and if you ask me it should be much easier and simple than it is.

I found a nice bypass workaround to allow notifications from websites and domains without SSL, hence http:// and not https:// for Firefox.

Firefox holds a file inside the Mozilla directory called permissions.sqlite which is a sqlite database file that holds the permissions for domains. You can add your domain there http://yourdomainname with permissions for notifications and it will work.

I have created a demonstration for Windows here
https://gist.github.com/caviv/8df5fa11a98e0e33557f75215f691d54 in go (golang)