Author: Vince

Replace Battery on Mid-2011 Macbook Air

http://www.ifixit.com/Guide/MacBook+Air+13-Inch+Mid+2011+Battery+Replacement/6359

One of the reviews from the amazon link below state that you may need to delete the system preference file /System/Library/Extensions/IOPlatformPluginFamily.kext/Contents/PlugIns/ACPI_SMC_PlatformPlugin.kext/Contents/Resources/MacBookAir4_2.plist to get the CPU throttling working normally.

My Mac
1.7 or 1.8 GHz (Mid 2011) 13″ MacBook Airs

My Battery Specs
Power Rating: 6700 mAh
Model #: A1405

Sellers:
http://www.aliexpress.com/item/Genuine-Original-A1405-BATTERY-for-Apple-MacBook-Air-13-A1369-A1466-Mid-2011-Mid-2012-Battery/1168791431.html

http://stores.ebay.com/toppowerusa/

I ended up buying from the seller on ebay.  The Battery had 8 cycles on it and was in close to new condition.  It also shipped with the pentalobe screwdrivers (2 of them) required to unscrew the macbook air and remove the battery.
current max: 6778 mAh
original max: 6700 mAh
health:101%.
cycles: 8
manufacture date: 7/24/12

Installation was very quick and easy, just unscrew and replace.

fixubuntu.com

From https://fixubuntu.com/
This is totally a copy of the link above, all credit goes to fixubuntu.com, I’m merely putting it here for my own keepings.  This is applicable for ubuntu 13.04+

Copy and Paste in Terminal

gsettings set com.canonical.Unity.Lenses remote-content-search none; if [ `cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -d”=” -f2` \> /etc/hosts’;

What it does:

settings set com.canonical.Unity.Lenses remote-content-search none Turns off “Remote Search”, so search terms in Dash don’t get sent to the internet
gsettings set com.canonical.Unity.Lenses disabled-scopes "['more_suggestions-amazon.scope', 'more_suggestions-u1ms.scope', 'more_suggestions-populartracks.scope', 'music-musicstore.scope', 'more_suggestions-ebay.scope', 'more_suggestions-ubuntushop.scope', 'more_suggestions-skimlinks.scope']" Turns off other remote Dash scopes, just in case (for Ubuntu 13.10 and newer)
sudo apt-get remove -y unity-lens-shopping Uninstalls Amazon ads built-in to Ubuntu (for Ubuntu 13.04 and older)
sudo sh -c 'echo "127.0.0.1 productsearch.ubuntu.com" >> /etc/hosts' Blocks connections to Ubuntu’s ad server, just in case

Setting up a VNC server on Ubuntu

I had the need to VNC into my old Ubuntu machine. The built in Desktop Sharing application, which I think is Vino, was not able to properly share to my Mac. I needed something else. I decided to use x11vnc because of the solid reviews I saw when I did a quick search.  It lacks the nice GUI options but it seems to get the job done.

Install it
sudo apt-get install x11vnc

Setup a password
This will store the password in ~/.vnc/passwd
x11vnc -storepasswd

There are other options to store it in different locations but you can see those options by just running x11vnc with no options.

Start x11vnc
x11vnc -usepw -many -nap
-usepw uses the password you just created
-many allows for multiple connections
-nap if activity is low take longer naps between screen pools to cut down load when idle

other options
-bg go into background after starting up
-loop restarts x11vnc in the event it is terminated
-display :X the display to connect to where X is usually 0
-noxdamage
all options

Some examples:
x11vnc -usepw -many -nap -loop -noxdamage
x11vnc -usepw -many -nap -noxdamage -bg
x11vnc -usepw -many -nap -noxdamage -display :0 -bg
The last one is what I typically use.

Tunnel through SSH
On your ssh server
ssh -f -L5900:127.0.0.1:5900 USER@HOST “x11vnc -usepw -many -nap -noxdamage -display :0 -listen 127.0.0.1”
or
ssh -f -L5901:127.0.0.1:5900 wincen@t60 “x11vnc -usepw -many -nap -noxdamage -display :0 -listen 127.0.0.1”

Replace USER and HOST with your username and server’s hostname.
-L5900 tells ssh to set up forwarding on port 5900.  The tunnel’s endpoint will be 127.0.0.1:5900 on our vnc server.  Notice -listen added to the end of my x11vnc command, this is so that x11vnc is specified to listen for connections from 127.0.0.1 and not elsewhere; you could also use -localhost instead of -listen.  I run into problems using -L5900 and use -L5901 instead.  The -f options tells ssh to run this in the background; you won’t be able to use -bg with x11vnc anymore.

Now you’ll want to connect to the ssh tunnel on your client machine (source).
ssh -N -p 22 USER@HOST -L 5901:localhost:5900
where USER is the username on the vnc server and HOST is the vnc server.  This creates a tunnel on your client machine:5901 to the vnc server:5900.

When I use the mac’s vnc client I connect via Go->Connect to Server and enter vnc://localhost:5901

The best client I found thus far is vncviewer.  I connect using
VNC Server: localhost:5901

Troubleshooting SSH Tunneling
If you run into ssh tunneling issues enable it by following this guide
https://help.ubuntu.com/community/SSH/OpenSSH/Configuring#Forwarding

If you run into this error it’s probably the Ubuntu firewall
x11vnc channel 1008: open failed: administratively prohibited: open failed
TODO: solution
Workaround: disable firewall with sudo ufw disable

If that doesn’t work try using port 5901:
ssh -L5901:127.0.0.1:5900 wincen@t60 “x11vnc -usepw -many -nap -noxdamage -display :0 -listen 127.0.0.1”

Run Automatically after logging in
TODO

Additional Information
http://www.karlrunge.com/x11vnc/index.html
http://ubuntuforums.org/showthread.php?t=45565
https://wiki.archlinux.org/index.php/X11vnc
http://allthingsgeek.wordpress.com/2012/12/01/using-ssh-and-x11vnc-to-tunnel-vnc-between-linux-hosts/
http://www.howtogeek.com/115116/how-to-configure-ubuntus-built-in-firewall/
http://www.cs.utexas.edu/users/habals/blog/index.php/archives/22

Diable password ssh logins

If you want to disable root from being able to login via ssh edit /etc/ssh/sshd_config and find PermitRootLogin.  Change the value to no.

# Authentication:
LoginGraceTime 120
PermitRootLogin no
StrictModes yes

If you wish to disable all password logins which requires uses to use public keys instead in /etc/ssh/sshd_config and find PasswordAuthentication.  Change the value to no.

PasswordAuthentication yes

If you wish to diable password logins for only some users add the following to your /etc/ssh/sshd_config file

Match User user1, user2, user3    PasswordAuthentication no

Apple WIFI dropping constantly

Switched from Ubuntu to OS X a year ago, specifically a Macbook Air.  “It just works” is what Apple likes to claim.  While I know that’s marketing, you shouldn’t say it if you can’t back it up.

I feel like I’m using Linux again with all sorts of wifi issues, buts due to driver issues.  A company that controls the platform has no excuses there.  Seriously, I’ll be working and all of a sudden my WIFI drops.  God….

And their trackpad seemed like a nice touch at first, gestures were cool.  However after a year it has given me carpel tunnel syndrome where as a normal touch pad never has.  I like gestures but if it’s a choice between gestures and my health I’ll gladly give up stupid gestures.

Anyway… wifi… some say it’s bluetooh, others speculate other things….. god damnit.  For my tracking purposes…

Updated to 10.7.3. Wifi drops constantly.
https://discussions.apple.com/thread/3704573?start=0&tstart=0

Wifi constantly dropping in Lion
https://discussions.apple.com/thread/3190651?start=15&tstart=0

Bluetooth disrupts Wi-Fi  – not sure about this one

Wifi dropping discussion
http://www.ilounge.com/index.php/backstage/comments/os-x-lion-serious-wi-fi-disconnect-problems-for-macs-and-solutions/

Apple’s solution from the above link – did not work
http://support.apple.com/kb/HT4628

A new hope…
http://osxdaily.com/2012/08/02/fix-os-x-mountain-lion-wireless-connection-problems/
Change MTU to 1453
MTU is maximum transmission unit which is the largest packet size allowed over the network.  This setting can be problematic for some networks.  They recommend using 1453 which “is just small enough to maintain a consistent connection with most networks but just large enough to not cause any slowdowns, it’s the magic number and an old cisco networking secret.”

Ubuntu 10.04 on a T60 – flickering and wifi dropping

Ubuntu 10.04 runs pretty bad out of the box on a Thinkpad T60. There was a lot of random screen flickering and the wifi connection would drop under heavy load. One way to make the wifi drop happen was to start watching a full episode of the daily show and then start copying a file over your network to your computer.

Thinkpad T60
ATI Radeon x1400
iwl3945

It seems the screen flickering has to do with the ATI drivers, which are really poor in linux. Surprisingly the wifi problems are related.
I found a post on the ubuntu forums detailing the fix. The fix is to turn off the kernal mode settings (KMS ). To do this edit your /etc/default/grub file and edit the contents:
sudo vi /etc/default/grub

# ORIGINAL: GRUB_CMDLINE_LINUX=””
GRUB_CMDLINE_LINUX=”nomodeset”

Follow this up with a sudo update-grub and reboot.
Also from the same thread it mentions you can also set kernal parameter radeon.modeset=0. I choose nomodeset, the option above which as worked for me.

Either nomodeset or more specific radeon.modeset=0 kernel parameter made it as responsive as 9.10 and fixed suspend and hibernate.

I also replaced NetworkManager with Wicd and am very pleased with it.
ATI Pink Flicker Bugs
Wifi Drop Bugs

Encrypting a directory with Ubuntu

I found a nice post on the ubuntu forums on how to encrypt a directory in Ubuntu. This is a copy and paste of that post by remmelt, I cannot take credit for it.
This guide describes how to create encrypted directories. These can come in handy for laptop users, password lists and the like.

1. Install the software
Code:

sudo apt-get install encfs fuse-utils
sudo modprobe fuse

And since we don’t want to modprobe each time we reboot, add “fuse” to /etc/modules (without quotes, on a line of its own)

2. Add yourself to the fuse group
The installer creates a fuse group and to use fusermount you need to be in this group. You can do this with your favourite GUI admin tool or command line:
Code:

sudo adduser fuse

3. Create a directory where your encrypted stuff will be stored
I put mine in my home dir, but you can put it anywhere you like.
Code:

mkdir ~/encrypted

4. Create a mountpoint
This is the directory where you will mount the encrypted directory. Through this path you can access the encrypted files.
Code:

mkdir ~/temp_encr

5. Create the encrypted system and mount it
The first time you try to mount the directory, encfs will create the encrypted filesystem. It works like the regular mount:
Code:

encfs

So for this example:
Code:

encfs /home//encrypted /home//temp_encr

Note that encfs wants absolute paths, i.e. starting with a /

6. Do the work
Put some files in your ~/temp_encr folder and look in the ~/encrypted one: they will show up there, encrypted.

7. Unmount the encrypted filesystem
Unmounting is as easy as
Code:

fusermount -u /home//temp_encr

8. Goto step 5
Repeat! EncFS will only create the filesystem once, after that first time it will ask for a password and mount your directory.

Remember to keep the two directories apart: in this example the “encrypted” folder holds your encrypted data and should not be used directly. The gateway to access this data is “temp_encr” or whatever you want to call it.

This was tested and verified on Ubuntu 10.04

MySQL Query Browser and Arch Linux

I’ve been having a problem starting the MySQL GUI Tools: Query Browser and Administrator with Arch Linux. I am using libxml2-2.7.6-1, zlib-1.2.3.4-4 and mysqlgui-tools-5.0r14-4. They all seem to be installed properly.

Whenever I start them I get this error:

/usr/bin/mysql-query-browser-bin: symbol lookup error: /usr/lib/libxml2.so.2: undefined symbol: gzopen64

After a ton of searching online with no success I came upon this post. It basically says that in the /usr/lib directory is a problematic libz.so.1. In my case I have a symbolic link to libz.so.1.2.3.4. It seemed correct to me, but I deleted the sym link and remade it. That fixed the problem and mysql query browser works again from the CLI. It doesn’t work from the start menu.

I have to do this everytime I start mysql-query-browser. Not sure why and it’s annoying, but it’s a workaround.