Some day ago I had problems with two mobile devices, the last one was with Nexus 7 tablet; the problems started because of so stupid issue I confused my Nexus 7 V2 (2013) with a V1 (2012) and of course flashing recovery and system images everything was broken. Finally, I had to re-flash stock images for recovery and system. In the middle of the process and thanks to XDA-Developers, I found a really useful toolkit called SkipSoft.
I just want to remark the work done by people of SkipSoft and give thanks to them for their great work. They simplified long processes downloading and flashing images to my devices to a simple wizard process with their scripts.
BTW, thanks also to Pof who gave me the inspiration for solving my mistakes flashing improper images to the Nexus 7.
Reading time: < 1 minute
Sometimes when a container is running for a long time especially when docker logs command is called the logs dump is extra long and then a recurrent search on google for reminding how to truncate a file is mandatory for avoiding this repeating task this is the trick that it saves me from that uncomfortable long log dump.
I imagine you are used to using curl for many command line scripts, tests, and much more things. I did the same but some weeks ago I discovered HTTPie which is the best substitute that I’ve ever found for curl. Of course, it’s also available for a lot of Linux distributions, Windows, and Mac. But I used it with docker which is much more transparent for the operative system and easy to update. To be more precise I use next alias trick for using this tool:
alias http='sudo docker run -it --rm --net=host clue/httpie'
When we have a file with a ‘dd’ of a full disk and we want to mount a partition of that disk, we have to use an offset for jumping to the beginning of the partition that we want to mount.
Using ‘fdisk’ command we can find the partitions of that disk copied inside a file.
fdisk -l FILE_WITH_DISK_INSIDE
Once partition table is shown there is a column called ‘Start’ using the corresponding number in this column for the partition that we want we can obtain the offset required for our mounting point. Reasoning behind that is multiply start sector per number of bytes per sector.
# OFFSET = START * 512
mount -o ro,loop,offset=OFFSET FILE_WITH_DISK_INSIDE /mnt
I hope thanks to this technical note next time that I forget how to get the offset I find it fastly.
If you don’t want to do that manually, there is a small tool called losetup which maps the partitions of a disk image on a file.
# example, attaching partitions to loopback devices
losetup -P /dev/loop0 DISK_IMAGE
# just mount the devices now, they are /dev/loop0pX where X is the number of the partition
# dettach this assignament:
losetup -d /dev/loop0
Reading time: < 1 minute
This is another short entry, in this case for recommending a service which we solve typical problem solved using a DNAT. Once we have a service on our laptop, or on a private server and we have to expose that service on the internet for some time or permanently usually we have to go the firewall, or router and create a NAT rule forwarding a port. This is a simple and powerful service which is going to solve that for you.
There is a free account for understanding and testing the service, other plans are available and especially affordable for professional requirements.