Building minio’s mc and restic on termux

If you use the binaries provided by minio and restic to run the ‘mc’ and ‘restic’ commands on android’s termux, it won’t work, due to restriction on DNS resolution, you need to build them yourself.

This is how to do it:


$ go get -d
$ cd $HOME/go/src/
$ GOPATH=$HOME/go make


$ git clone
$ cd restic
$ go run build.go -v --enable-cgo

Straightforward java compilation on termux

To run java apps on your android device, install termux, and run the following:

$ pkg install ecj dx
$ cat > <<EOF
public class Hello {
  public static void main(String[] args) {
    System.out.println("Hello world, on termux!");
$ ecj
$ dx --dex --output=Hello.dex Hello.class
$ dalvikvm -cp Hello.dex Hello
Hello world, on termux!

How to find out compiler version of a go binary

If you have a binary that was produced by a golang compiler, and you want to find out which version of the compiler was used, you can use use the C debugger gdb as follows:

$ gdb /path/to/binary
(gdb) p 'runtime.buildVersion'
$1 = 0x5e1d83 "go1.9"

Generate an SSH public key

If all you have is an SSH private key and you need to generate a public key out of it, you can run the following:

ssh-keygen -y -f yoursshkey

It will spit out the public key on the standard output.

Raspberry Pi: attach a serial console

For a Raspberry Pi with GPIO pins (B, B+, 2, 3):

  1. Connect as follows:
  2. Append this line at the end of /boot/config.txt:
  3. Access the console from your workstation like this:
    sudo screen /dev/ttyUSB0 115200


For Raspberry Pi without pins (Pi Zero, Pi Zero W):

  1. Add the following line at the end of /boot/config.txt:
  2. Insert the following between ‘rootwait‘ and ‘quiet‘ in /boot/cmdline.txt:
  3. Mount the linux part of the Pi SD card and add the following lines at the end of /etc/rc.local, before ‘exit 0’:
    if [ ! $(systemctl is-enabled "${usbconsole}") ]
    echo "Enabling and starting ttyGS0 console..."
    systemctl enable "${usbconsole}"
    systemctl start "${usbconsole}"
  4. Connect a micro usb cable into the socket market ‘USB‘ on the Pi, not the one marked ‘PWR’.
  5. On your workstation, console can be accessed as:
    sudo screen /dev/ttyACM0 115200


git: list all files in a commit

To list all the files tracked a commit, run this:

git ls-tree --full-tree -r <hash>

If you’re only interested in the names:

git ls-tree --full-tree -r --name-only <hash>

Helpmate in 1

A helpmate is a problem where a mate is possible with the help of the color that is defending. Here a nice example of a helpmate in 1:

Solution is here: