Debugging Android over Wifi

Super simple:

  1. Connect your device via USB and ensure debugging is working (e.g. make sure Android Monitor in Android Studio is displaying live logs).
  2. At a terminal / command prompt, type adb tcpip 5555
  3. Then type adb connect DEVICE_IP:5555 (you can get your device’s IP address from your Wifi connection properties – advanced settings)
  4. Disconnect the USB and proceed with wifi debugging.
  5. [Optional] To disconnect Wifi debugging when you’re done, type adb -s DEVICE_IP:5555 usb

If you experience adb hangs when executing these commands, try with another android device. if that works, try disabling / enabling wifi on the problematic device. You may also need to adb kill-server and adb start-server to reset things.

Nexus 5X not detected in Windows

My Nexus 5 was working fine with my Windows 7 desktop, but when i plugged in a Nexus 5X (running Android 6.x) it was not detected at all (in Windows Explorer or adb). Installing drivers did not help, and the phone was detected fine on another Windows 7 computer. Here’s what fixed it – go into Device Manager and see if you have a ‘Portable Devices’ node. If you don’t, check to see if you have a ‘Android Device’ node. If so, try right clicking the child node and choosing ‘Update Driver Software’.


For me, it found some random USB compatible device or something, and then the ‘Portable Devices’ node suddenly appeared, and all was good! Maybe it will work for you!

Record screen + audio with FFMpeg

$480 for Camstasia? I think not. CamStudio? Buggy as hell. Luckily, we have an excellent FREE cross-platform tool that let’s us easily create a video-recording of your desktop including audio: FFMpeg.

If you are running Windows, download the x64 here.

Extract the downloaded archive and open a command prompt in the bin folder.

To check your version:
ffmpeg --version

ffmpeg version N-79630-g9ac154d Copyright (c) 2000-2016 the FFmpeg developers

To show available input devices for audio:
ffmpeg -list_devices true -f dshow -i dummy

DirectShow audio devices
“Microphone (5- Webcam C170)”

This is the magic string you’ll need to specify in the next, awesome command.

ffmpeg -y -f dshow -i audio="Microphone (5- Webcam C170)" -f gdigrab -video_size 1920x1080 -i desktop -vcodec h264 my-screen-with-audio.mkv

This will record your screen at full-hd encoded using h264 and including audio sourced from your microphone. When you want to stop the recording, press Ctrl+C in command prompt and your video file will be ready, too easy!

If you want to record the screen only (no audio), use:
ffmpeg -f gdigrab -offset_x 0 -offset_y 0 -video_size 1920x1080 -i desktop -vcodec h264 my-screen-only.mkv

Thank you FFMpeg developers!

Play video at specific position and size

Using VLC, we can have a video begin playback at a specific screen location and window size. I found this useful when creating a screen recording of some software where I wanted to have a video overlay playing in the corner of the screen at the same time. Here’s the command line I used (for VLC 2.0.8 on Windows 8.1):

vlc.exe –no-video-deco –no-embedded-video –video-x=1320 –video-y=700 –width=600 –video-on-top –qt-system-tray –qt-start-minimized my-video.mp4 vlc://quit

  • The vlc://quit is a special playlist entry that causes VLC to quit after playback of the preceeding video.
  • Adjust video-x and video-y to set screen position, and set width or height to set window size.
  • The no-video-deco and video-on-top will remove the window chrome, and ensure the video is always on top.

Amahi DNS not working

Amahi has proven itself to me as a solid and reliable home server solution. However, occasionally, I’ve had a problem where DNS stops working, sometimes after OS updates have been installed and the server restarted. It’s only happened 2 times over the last year or two, and the helpful Amahi folks on the IRC channel came to the rescue both times, but I’d thought I’d document the solution here.

Sympton: You use the Amahi network troubleshooter, and find you can’t ping hda from your hda box, i.e. name resolution is not working.

Solution 1: If you are running a desktop version of linux, or have installed some specific packages, like Jenkins, that install libvirtd service, then you need to disable that service. Unfortunately libvirtd takes the default DNS port and therefore Amahi, which uses dnsmasq, can’t work. This is documented here, and the solution is to use:

sudo systemctl disable libvirtd
sudo reboot

Solution 2: If you can now ping hda, but still can’t ping, it means the DNS provider that amahi uses for the web is not reachable. Amahi support multiple DNS providers: OpenDNS, OpenNIC and Google Public DNS. Mine was set to OpenDNS, which I think is the default, the solution was to change it to Google DNS.

If you haven’t tried Amahi, and you have a home network with a bunch of computers, I highly recommend checking it out!

Fixing GWXUX crash (aka Windows 10 Ads)


I would like to go on record and say the reason I’m not upgrading to Windows 10 at this point is because there is a HINT that Windows 10+ will be subscription based operating system. I mean come on, I know Windows 8 is an abomination, but a FREE upgrade to Windows 10?? Surely that can leave no doubt that Microsoft is going the way many other (foolish) IT companies are heading – to a subscription based model. I can see them crippling core OS features, like ‘Computer Management’ and ‘Network Drives’ unless you ‘subscribe’ to a higher pricing tier, just like they are doing in Azure. I develop on Azure for my full-time job and today we started receiving deployment errors stating:

The ‘AlwaysOn’ feature is not available in your current plan.

Granted, Azure was actually having some ‘down-time’ during this, and we are yet to confirm if this was a programming fuck-up, or they actually changed the pricing tier for features as they see the need for more money.

I’ve also stopped recommending Team Viewer now that they have to switched from a ‘pay-once, updates are optional’ to ‘pay every month, BILLED UP-FRONT ANNUALLY, all updates required‘. Which means you have to instruct your partners on the other end to continually upgrade to keep up with your version to be able to connect!! What once was a small one-off purchase changes to a AU$538 up-front charge, billed every year thereafter, unless you can figure out how to cancel it. And we all know how companies make it next to impossible to cancel any subscription service. Normally you have to call up a number, wait in line, and then listen to an hour long spiel about how great they are, testing your patience and willingness to give up over sitting it out to get cancelled. BTW I’m not just being theoretical here, we wanted to buy a team viewer license just the other week, but no one was willing to swipe a credit card to the tune of $AU538 per year, i.e. people are not crazy. So we did not purchase it! Team viewer lost!

Rant over, my Windows 7 box I use as my media center has been having this GWXUX.EXE crash every time i boot it for the last few months (i.e. since Windows 10 advertising started). I lived with it for a while, expect Microsoft to actually care about their advertising programming crashing in full-view of customers every time they turn on their PC, but now I’ve given up. So I’ve written the simplest possible program to look for and kill GWXUX.exe before it gets a chance to crash.

If you are seeing this crash, and haven’t found a way to fix it you can do this:

1. Download KillWindows10Ads.exe to anywhere on your PC.
2. Add a shortcut to your startup folder to this executable.

There is no UI, it just runs in the background, waiting for GWX.exe to rear it’s ugly face (yeah it’s named GWX.exe but the crash dialog shows GWXUX.exe, but the user experience it’s programmed to give is a crash dialog) and kills it quick. The source code is as follows for those who care:

using System.Diagnostics;
using System.Linq;
using System.Threading;

namespace KillWindows10Ads
    /// <summary>
    /// This program exists to kill the poorly programmed 
    /// Windows 10 update advertisements, which is 
    /// installed automatically by windows update and 
    /// launching automatically on login of any user.  
    /// And then it crashes, more than once.  Great effort 
    /// Microsoft.  And yes i see the irony in using 
    /// Microsoft technology to kill Microsoft advertising
    /// for Microsoft technology.
    /// </summary>
    public partial class App
        public App()
            while (true)
                var windows10Crap = Process.GetProcessesByName("GWX")
                if (windows10Crap != null)
                    catch {}

Flushing Amahi (dnsmasq) dns cache

The latest version of Amahi uses dnsmasq for network management including dns caching, which works really well. However somehow my Windows 8 laptop’s wifi was enabled at the same time as it’s ethernet LAN connect, and so the laptop ended up with two IP addresses. This is probably due to some bug in Windows 8, but even after I disabled the wifi adaptor, rebooted both my Amahi server and the laptop, the dns cache still retained the now unused IP address for the disabled wifi adapter. In the end I had to manually edit the dnsmasq.leases file in order to fix this – here’s how (as root on on Fedora 21):

1. View your dnsmasq leases to confirm there’s a bogus address you want to remove:

[root@hda-com]# cat /var/lib/dnsmasq/dnsmasq.leases

2. Stop the dnsmasq service

[root@hda-com]# service dnsmasq stop

3. Edit the dnsmasq.leases file to remove the bogus address(s):

[root@hda-com]# nano -w /var/lib/dnsmasq/dnsmasq.leases

2. Start the dnsmasq service

[root@hda-com]# service dnsmasq start

Then renew your client’s IP adress (e.g. using ipconfig /renew on Windows) and you’re done.

Missing Maximize / Minimize in Gnome

Gnome 3 continues to be abhorant. Not only can I not get to a terminal easily anymore, but there’s no maximize / minimze button on windows? Who designed this and have they used graphical user interfaces for more than a few minutes / hours? Anyway to turn this basic functionality back on using Fedora try (thanks to this thread):

sudo yum install gnome-tweak-tool

Then search for ‘tweak’ in the Gnome 3 Applications menu, open ‘tweak tool’ app and click the ‘Windows’ tab and enable the titlebar options as follows:



VNC to Linux PITA

A stubborn or short-sighted developer, it seems, is the cause of many people’s grief and effort to get VNC working to a linux box from any of the standard VNC clients (tiger, realvnc etc.). As of Fedora 19+, the code has changed in vinoserver, the default linux VNC server, such that the encryption mechanism is incompatible with ALL standard VNC viewers. You’ll see something like ‘No matching security types’:


The only option for the average user is to disable encryption. Pretty stupid, but I’ve seen this before. A developer ‘David King’ says “My code is right, everyone else is wrong.” and marks a bug as ‘NOTABUG’. How sad. Anyway, until someone else can take a look at this from another perspective, make sure you only use VNC to linux on a secure LAN environment and then do this:

gsettings set org.gnome.Vino require-encryption false

Make sure you do it as standard (not sudo) user. Sucks to disable security – but if complexity is a barrier to entry, that is the result. 🙁

Mime types with Gnome Commander

One of the things that mime types are used for is to specify the default program to associate with a file extension. Unfortunately, this is currently broken with Gnome Commander (at at v1.2.8.17). To fix it, you’ll need to add a line to the following file:


Create that file if it doesn’t exist and add [Default Applications] on the first line. Then add the mime type (as shown on the gnome commander error dialog when you try to open your file) and specify the program to use. For example, for PNG file extension you might want to use Eye of Gnome (eog) so you’d add:



Save the file and you’re done. If it still doesn’t work, you should check this thread on the Ubuntu forums. Tested with Zorin OS 9. Hopefully this is fixed in a future version.