Resize a Sparse Bundle Image using Terminal

A Sparse Bundle Image will increase in size automatically but will not shrink automatically. Before shrinking the sparse bundle, mount it and empty the trash to get rid of any deleted items from the image.

Unmount the image and follow the commands below.

To compact (image size stays the same):

 hdiutil compact ~/Documents/filename.sparsebundle

hdiutil compact -help (for a list of options)

To increase the image size (eg., 20G to 30G)

hdiutil resize -size 30g ~/Documents/filename.sparsebundle
hdiutil resize -help (for a list of options)

Mount the image then do a Get Info on the Volume to see the new size.


Read More

Test network speed with iperf

Iperf is a client server program that you run it in server mode at one end and connect to its from another computer on the other side of the network.

One both machines run:

sudo apt-get install iperf

We’ll start an iperf server on one of the machines:

iperf -s

And then on the other computer, tell iperf to connect as a client:

iperf -c <ip or hostname> 


Read More

HTTPS with Let’s encrypt & Nginx

sudo apt-get -y install git bc
sudo git clone /opt/letsencrypt
sudo service nginx stop
cd /opt/letsencrypt
./letsencrypt-auto certonly --standalone
sudo ls /etc/letsencrypt/live/your_domain_name

Add to nginx config

listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/;
ssl_certificate_key /etc/letsencrypt/live/;

Add block to redirect http -> https

server {
listen 80;
return 301 https://$host$request_uri;


Read More