Thursday, November 7, 2013

Colors and Split Screens in Vim

Here is some info on vim that I put here mainly for my reference. Maybe someone else will find them useful.

Color schemes
Set the color scheme in .vimrc, e.g. add a line like "colorscheme ron"
In vim, you can list the color schemes with ":colo <TAB>" (space after "colo")
If no colors after setting the color scheme, make sure syntax is enabled. In .vimrc add the line "syntax on".

Editing Multiple Files
:ls - List open files
:n or :bn - Go to next file
:p or :bp - Go to previous file
:b10 - Go to 10th file
:b foo - Go to file named "foo"
:b <TAB-KEY> - Cycle through open files (space after ":b")
CTRL-w v - Split screen vertically
CTRL-w s - Split screen horizontally
CTRL-w h and CTRL-w l - Switch through vertical windows
CTRL-w k and CTRL-w j - Switch through horizontal windows

Wednesday, September 4, 2013

Android Google Services Data Usage is Huge

If you have a Nexus device running a custom ROM, you better check your data usage. A lot of people have noticed a huge spike in data usage on these platforms. The problem might not be limited to Nexus devices, but it is a problem with custom ROMs based on Android 4.2.2 and earlier. It seems to have started around the end of August. Some speculate that Google Services is downloading the Android 4.3 update, which fails since the ROM is custom, and then downloads the update again, etc.



I ran into this problem on my Nexus 7 (2012) running AOKP. This is how I fixed mine (hopefully, so far so good). Note that your device must be rooted, but if you're running a custom ROM, I assume it is.

  • Download FOTAKill.apk from CyanogenMod or from XDA
  • Move the APK to the /system/app folder (remember to remount /system read-write)
  • Change owner/group to root/root and change permissions to 0644 (not sure if this is needed, but I did it to match existing apps)
  • Reboot to recovery and wipe the cache
  • Reboot and done
Hope this helps someone out there.

Monday, August 19, 2013

Disable the Touchpad and Trackpoint Pointer in Linux

The mouse pointer on my Arch Linux system was going crazy. It was drifting badly and my mouse was unusable most of the time. Very frustrating. I thought I narrowed the problem down to a hardware issue on the touchpad. I have a USB mouse, so I don't really need the touchpad. I came across this script to toggle the touchpad on and off.
#!/bin/bash
synclient TouchpadOff=$(synclient -l | grep -c 'TouchpadOff.*=.*0')
This does indeed toggle the touchpad, but my problem still remained. So, the touchpad wasn't the problem. Then I saw the Trackpoint pointer sitting in the middle of my keyboard (otherwise known as an eraser pointer or the colorfully nicknamed clit mouse). So I dug around and found I could disable it easily enough. First, get the name of the device by running:
xinput
In my case the name is "TPPS/2 IBM TrackPoint". Then disable it with this:
xinput set-prop "TPPS/2 IBM TrackPoint" "Device Enabled" 0
Problem solved. Hopefully someone else will find this useful.

Tuesday, August 13, 2013

Setting up a Gogo6 / Freenet6 IPv6 tunnel in Linux

It's 2013....where's my IPV6? IPv6 was introduced to alleviate some of the problems with IPv4. It's been available for well over 10 years, but the internet is slow to adopt the new format. I wanted to start using IPv6 to become familiar with it but, like most ISPs, mine doesn't offer native IPv6.

When native IPv6 isn't available, one option is to use a tunnel broker. Basically a broker sets up a tunnel between your device and an endpoint at the broker. IPv6 is encapsulated in an IPv4 packet, sent through the tunnel to the broker, then sent out from there as IPv6. I looked at three brokers: Hurricane Electric, SixXS, and Gogo6 (which owns Freenet6). I chose Gogo6 for several reasons: it allows NAT traversal, it allows anonymous connections (the other two require registration), and it is touted as the easiest to set up. One of the down sides of using Gogo6 is that it currently appears to only have two Points of Presence (PoP), Montreal Canada and Amsterdam Netherlands. This is the location of the broker server, so your IPv6 traffic will appear to come from one of these areas.

To install the Gogo6 client in Ubuntu, run the following:
sudo apt-get install gogoc
This will install both gogoc and radvd. The radvd package is only needed if you plan on routing IPv6 from your PC. All done! You should now have an anonymous tunnel up and running. Test it by running
ping6 -c 5 ipv6.google.com
The tunnel will start when the system starts. If you don't want this, run
sudo mv /etc/rc5.d/S20gogoc /etc/rc5.d/s20gogoc
Then you can start and stop the tunnel with
sudo /etc/init.d/gogoc start
sudo /etc/init.d/gogoc stop

To install the Gogo6 client in Arch, install it from the AUR. Since this is Arch, I'll assume you know how to install a package from the AUR. To create the tunnel and start using IPv6, run (as root)
systemctl start gogoc
Wait a few seconds for the tunnel to come up and try pinging ipv6.google.com as above. If there are no problems and you want to create a tunnel when the system starts, run
systemctl enable gogoc

Anonymous connections are fine to play with but the IPv6 address will change when your IPv4 address changes. I suggest registering for an authenticated tunnel at Gogo6. This will get you a static IPv6 address, a DNS entry (e.g. username.broker.freenet6.net), and a /56 prefix (so you can set up a router and give out IPv6 addresses to the devices on your network if you want). If you do register, you'll have to edit the /etc/gogoc/gogoc.conf file and enter your username and password, and change the server to the authenticated one.

A couple of notes: IPv6 addresses are globally accessible, so make sure you have a firewall and that it is properly configured. And since traffic is going through a tunnel, speed will be impacted somewhat. Here are some of my speedtest results. Top bar (green) is IPv4 and bottom bar is IPv6.


Finally, here are some sites that might be of interest.
ipv6test.google.com
ipv6-test.com
ip6.me/
www.subnetonline.com/pages/ipv6-network-tools/online-ipv6-traceroute.php

Wednesday, August 7, 2013

Boot Multiple OSes Using Your Android Device and DriveDroid

DriveDroid is a neat app that allows you to boot ISO and IMG files that are stored on your Android device, just like you are booting from a USB drive. You can download a lot of images from within the app. You can also create blank images, but I haven't used this feature.

Your device must be rooted to use this app, so if it's not then this app isn't for you.

The process is quite simple. Start DriveDroid and press the "+" button and select "Download image" to get a list of available images. Select a distribution and then select the file you want. For the first time, I suggest trying Slitaz, since it is only about 35MB. Once it is downloaded, it will show up on DriveDroid's main screen.



To boot from an image, select it in DriveDroid, and select the host mode (e.g. Writable USB, etc). Then, connect the Android device to a PC using a USB cable and boot the PC. The PC will boot the selected image. If the image doesn't boot, check the PC's BIOS settings and make sure "Boot from USB" is set as the first boot device.

To stop hosting, just tap the DriveDroid icon in the Android notification area.


One requirement for the ISO images is that they must be in hybrid format. To check an ISO, type
fdisk -l file.iso
If no partition table is found, the ISO is not in hybrid format. One of my favorite tools, SystemRescueCd, isn't in this format. To make it work, all I had to do was download the ISO and run
isohybrid file.iso
This changes the file to the correct format and then it works with DriveDroid just fine.

DriveDroid makes it easy to try out new distributions. And with the right tools, your Android device can be an invaluable recovery tool.

Thursday, February 14, 2013

ADB Shows Device Offline after Android 4.2.2 Update

If you have upgraded to Android 4.2.2 and you can no longer connect to your device with ADB, the problem may be an outdated ADB executable on your PC. If ADB shows your device as "Offline", update your Android SDK to get the latest ADB and see if it helps. I ran into this problem with my Nexus 7. I know version 1.0.31 works. You can check the version with "adb version".

Android 4.2.2 introduces a "whitelist" for ADB connections. When you plug the device in to a PC, a screen opens on the device that gives you the option to allow or deny the ADB connection. If you have an old version of ADB, this screen doesn't appear and the device shows as "Offline" on the PC.

If ADB isn't the issue, then you can try the following:

  • Unplug the device and run "adb kill-server" on the PC and plug it back in. Or,
  • Reboot the Android device. Or,
  • Plug the device into a different USB port
Hope this helps.


Friday, January 11, 2013

My Nexus 7 (2012) and its Headphone Problem

I bought a Nexus 7 tablet a few weeks ago as my first tablet. I got the 32GB wifi-only model. So far I have been impressed. The speed, display, and battery life are great.

I did run into one problem though. The headphone jack didn't seem to work properly. When I inserted my headphones, I would either get sound out of the tablet speaker or only one of my headphone speakers. And it would switch between these two, kinda like a bad connection. I tried two different sets of headphones and both behaved the same. I was disappointed in my shiny new tablet.

Thankfully, the solution (for me, at least) was simple. It turns out that the headphone jack is a tight fit and I just had to push the headphones in a little harder until I heard it click. Problem solved!

I have heard of a lot of other people with this problem that were returning their Nexus 7s. Hopefully this will help someone and save them from having to return their Nexus 7.