21.6.16

Download files of Google App Engine project

Fast tip, that can be useful if you have deployed your app but you have forgot to push your latest commit and you need to work remotely.

Well, I've just discovered that you can download the source code of every version, both deployed and not.

Nothing cannot be simpler than this. You only need AppEngine SDK, which is obvious if you develop with it ;)

Just execute
appcfg.py download_app -A {APPNAME} -V {VERSION_NUMBER} {DEST_FOLDER}

It'll ask you for OAuth credentials and then it'll start download.. And magic! 
You have what you need! Let's start coding now!

1.5.16

Default recovery on your Nexus

Have you ever needed to access to some advanced functionality of your Nexus device?

In the past days, I started to have performance lags on my Nexus.
After some research, I discovered that a Wipe cache command could solve.
Well, how can I do it?
Using a recovery, accessible from fastboot mode.
But, even if I can reach easily the fastboot mode, I have no custom recovery installed.
"Oh no, I need to unlock the device, install recovery, lose all data and restore everything.. Such a mess" I  thought.

Surprise, I discovered that the device has a simple recovery installed!!!!
Do you know it? I played with Android from several years, but I never heard about this possibility and so I want to share this knowledge.

Here the instructions, for a Nexus (I don't know if other have it but I think no):
  1. Turn off your Nexus
  2. Boot into Fastboot Mode (tipically Power + Volume Up pressed together)
  3. Select Recovery, pressing the Volume Down Button Twice and then Power button.
  4. Wait Until You See an Android on its Back With an Exclamation Mark
  5. Now press and Hold the the Power Button, Then Press the Volume Up Button
  6. You’ll be Taken to the Recovery Mode Menu


Remember: this screen does mean that you have not a custom recovery installed!
Don't be scared ;)


5.7.15

Script to automatize Secure Copy - SCP

Here a fast script, implemented using expect, that I use to automatize copy from a remote server using scp.

#!/usr/bin/expect -f
spawn scp -P port_number user@address:/file /home/file

expect { -re ".*sword.*" { exp_send "PASSWORD\r" } }

interact

It works without asking password to the user if you insert it in the 'PASSWORD' placeholder.
You can schedule as cronjob and you'll have a simply way to backup some of your remote files, maybe logs for later inspection.

2.3.15

Run windows from an external usb hard disk

Sometimes you need to have a portable Windows installation, to use on-the-go without having it installed on your laptop.
I use a Linux-based pc but some programs require Windows and performances under Wine aren't sufficient.

So, here a simple guide on how to install a copy of Windows in an usb disk and run it from anywhere.
1) Grab a copy of Windows 8; Windows 7 isn't so portable and you can have some big problems to run it on a different machine.
2) Get a USB drive! I tested a 2.0 drive and performances are ok. No big problems. Clearly, SSD and/or USB 3.0 perform better.
3) Download and install WinToUSB.

So, now, nothing easier.
Open WinToUSB, select the .iso file, select the external disk and launch the installation!
It will take probably more than 30 minutes, but it depends from hard disk performances.
So, get some coffee and be patient.

When it'll finish, ensure to select (from BIOS) the usb port as priority during boot, attach the external drive and have fun!

15.1.15

Vodafone IT - Enable free tethering on Android

I'll write this post in Italian, since it's targeted to people with an Android smartphone on Vodafone IT network.

L'operatore Vodafone IT fa pagare il tethering via wifi effettuato sui dispositivi Android fin dalla versione 4.
Infatti, in automatico viene riconosciuta la connessione da PC/tablet e viene abilitato l'apn web.omnitel.it anche se non presente e non configurato nelle impostazioni.
Questo fa pagare all'utente 4€ ogni volta che si utilizza questo apn.

Su internet si trovano diverse guide, con o senza root.
Personalmente ne ho provate diverse, sia con root che senza.
Questa è quella che personalmente consiglio. Ho potuto provarla su un Nexus 4, con root e Android Lollipop 5.0.1. Il root non è comunque necessario.

SUGGERIMENTO: se volete essere sicuri di non pagare l'accesso all'apn omnitel potete disabilitarlo dall'area "Fai da te" nel sito 190.it, sotto l'opzione "Blocco internet da PC".

Veniamo a noi, ecco ciò che vi serve:

  • Attivate l'opzione sviluppatore: cliccate 7 volte su "Numero Build" in "Impostazioni" - "Info sul telefono".
  • Collegate lo smartphone con il cavo usb al pc
  • Attivate il debug usb nel menù "Opzioni sviluppatore"
  • Ora dovete scaricare i driver adb relativi allo smartphone. Trovate innumerevoli guide su internet ma a volte vengono anche installati in automatico quando connettete lo smartphone.
  • Ora è necessario avere il pacchetto Android con i tool adb e fastboot. Potete trovare una versione compatta qui; una volta scaricato installatelo in una specifica cartella.

Ci siamo quasi.
Ora aprite la cartella dove avete installato il pacchetto Android (sdk) e aprite un terminale/finestra di comando e posizionatevi in questa cartella.
Eseguite il comando adb devices
Apparirà un messaggio: List of devices attached e un dispositivo numero seguito da "device" (se indica unathorized dovete accettare il certificato sullo smartphone).
Ora, digitate il comando: adb shell
e in seguito: settings get global tether_dun_required
Apparirà il valore "null" o zero.
Digitate
settings put global tether_dun_required 0
E' fatta! Uscite e godetevi il vostro tethering gratis!

Se dubbi o difficoltà lasciate pure un commento!

[Guida aggiornata al 15-01-2015]