2010
07.14

The ‘Disk Cleanup’ function in the VMWare Fusion GUI seems to be of no help with shrinking Linux virtual disks. Use the VMWare CLI tools within your virtual machine for real results. This method just shrunk my disk by ~50%!


[root@bubbles.t3ch.com ~]# vmware-toolbox-cmd disk list
/
/boot
[root@bubbles.t3ch.com ~]# vmware-toolbox-cmd disk shrink /
Progress: 100 [===========>]
2010
03.27

I am running 3 displays on the Apple Macbook Pro by using the Sewell Minideck USB to DVI adapter.

Click for full size



1 – 1440×900 – 15.4″ Apple Macbook LED Display
2 – 1920×1200 – 24″ Apple Cinema LED Display
3 – 1920×1200 – 24″ Samsung 2433BW

I was skeptical of the usb video adapter since the previous models I tried had all sucked horribly. For the past 3 weeks the Sewell adapter has performed way beyond my expectations, however I don’t recommend watching fullscreen HD movies on it since VLC consumed about half of the CPU resources. A utility that is essential (even with just 1 display), is SizeUp by Irradiated Software which enables shortcuts to auto-position windows. This is 1 of the most handy utilities for Mac OS!

While I’m taking pics, here is my command center:

Click for full size

And the Sewell adapter in production:

Click for full size

2010
03.13

Follow these instructions to resize TrueCrypt volumes on Mac OS without losing your data.

** Definitely backup your stuff (If your not already, omg.) before attempting this on a live system.

** Proceed at your own risk! This process works great for me, but you may have different results. I am not responsible for anything :)

Pre-requisites:
- Access to a win* box
- TrueCrypt v6.2a installed on win* box
- Download extcv binaries, available at http://sourceforge.net/projects/extcv
- TrueCrypt volume must not have any ‘hidden’ volumes (they will be destroyed)
- Filesystem on the TrueCrypt volume must use the GUID partition scheme and be formatted as HFS+ (aka Mac OS Extended Journaled)
- Unmount the TrueCrypt image before starting.

Ok, now lets get down to business…

1. Launch ‘extcv’ on the win* box.

2. Select the file that contains your TrueCrypt volume.

3. Enter the new size and go.

** I am assuming you have a solution to move or access your TrueCrypt file from the win* and Mac boxes. I personally just used a WinXP vm in Parallels and used shared folders to access the TrueCrypt file on the Mac.

4. Mount the TrueCrypt volume on your Mac.

5. Launch ‘Terminal.app’.

6. View your volumes and current sizes by executing ‘diskutil list’

laptop01:~ root# diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *320.1 GB   disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            319.7 GB   disk0s2
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *128.0 GB   disk1
   1:                        EFI                         209.7 MB   disk1s1
   2:                  Apple_HFS hd                      127.7 GB   disk1s2
/dev/disk2
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            t3ch                  *37.6 TB    disk2
/dev/disk3
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme untitled               *524.0 MB   disk3
   1:                  Apple_HFS part1                   100.0 MB   disk3s1

In my scenario, ‘/dev/disk3′ is the TrueCrypt volume and you can see that the size is now 524MB. The partition I want to expand is ‘disk3s1′ which is currently 100MB.

7. View the size limits by executing ‘diskutil resizeVolume disk3s1 limits’

laptop01:~ root# diskutil resizeVolume disk3s1 limits
For device disk3s1 part1:
        Current size:  100.0 MB (100028416 Bytes)
        Minimum size:  100.0 MB (100028416 Bytes)
        Maximum size:  389.8 MB (389767168 Bytes)

Clearly you see that the max size our new partition could be is 389.8MB

8. Now we are going to do the live resize. This is the scary part (double check your backups before completing this step)!

I want my partition to be approximately 250MB. Please read the docs ‘man diskutil’ to see if you want to use different syntax.

Execute ‘diskutil resizeVolume disk3s1 250M’

laptop01:~ root# diskutil resizeVolume disk3s1 250M
Started partitioning on disk3s1 part1
Verifying disk
Resizing
Finished partitioning on disk3s1 part1
/dev/disk3
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *524.0 MB   disk3
   1:                  Apple_HFS part1                   250.0 MB   disk3s1

Confirm the data is still there:

laptop01:~ root# ls -l
total 80
-rw-r--r--  1 root  wheel      3 Nov 19  2008 .CFUserTextEncoding
-r--r--r--  1 root  wheel     10 Jun 23  2009 .forward
drwxr-xr-x  3 root  wheel    102 Feb 23 19:48 .gem
-rw-------  1 root  wheel     35 Jul 22  2009 .lesshst
-rw-------  1 root  wheel   1204 Nov 20 11:30 .localized
drwx------  3 root  wheel    102 Nov 21  2008 .macports
-rw-------  1 root  wheel    253 Dec 10  2008 .mysql_history
-rw-------  1 root  wheel  10139 Mar 12 18:54 .sh_history
drwx------  5 root  wheel    170 Dec 22 11:01 .ssh
drwxr-xr-x  6 root  wheel    204 Nov 21  2008 .subversion
-rw-------  1 root  wheel   9190 Jan 22 13:45 .viminfo
drwx------  9 root  wheel    306 Feb 10 11:49 Library
drwx------  5 root  wheel    170 Nov 19  2008 Library (from old Mac)
drwxr-xr-x  2 root  wheel     68 Mar  8 00:05 test1
laptop01:~ root#

Great, you made it to the end! Hope you enjoyed… Please post comments if you figure out better solutions.

-joe

2010
03.07

Offering SFTP-only jailed user accounts is useful in many scenarios such as shared web hosts, storage space for friends, etc.

This tutorial is specific to CentOS 5.4 x86 64-bit. Other flavors will vary.

** Make sure you are root or using Sudo

1. Upgrade to OpenSSH 5.x

## fetch the packages
wget http://fs12.vsb.cz/hrb33/el5/hrb-ssh/stable/x86_64/openssh-5.1p1-3.el5.hrb.x86_64.rpm
wget http://fs12.vsb.cz/hrb33/el5/hrb-ssh/stable/x86_64/openssh-clients-5.1p1-3.el5.hrb.x86_64.rpm
wget http://fs12.vsb.cz/hrb33/el5/hrb-ssh/stable/x86_64/openssh-server-5.1p1-3.el5.hrb.x86_64.rpm

## upgrade OpenSSH
rpm -Uvh openssh-*

2. Comment out the following line in ‘/etc/ssh/sshd_config’

Subsystem     sftp     /usr/libexec/openssh/sftp-server

3. Append these lines to the end of ‘/etc/ssh/sshd_config’

Subsystem     sftp     internal-sftp
Match Group sftponly
    ChrootDirectory /home/%u
    ForceCommand internal-sftp
    AllowTcpForwarding no

4. Add the ’sftponly’ user group

groupadd sftponly

5. Modify the user’s group and shell

(I’ll use the completely random username: bree_olson)

usermod -g sftponly bree_olson
usermod -s /bin/false bree_olson

6. Set the proper filesystem permissions

(Bree’s home directory is /home/bree_olson and her website is in /home/bree_olson/public_html)

chmod 755 /home/bree_olson/
chmod 755 /home/bree_olson
chown root:root /home/bree_olson
chown bree_olson:sftponly /home/bree_olson/public_html

7. Restart the SSHD daemon

/etc/init.d/sshd restart

And that is it! Just be sure to repeat steps 5 and 6 for all the pornstars users that you wish to lockdown.

2010
03.06

1. PdaNet

Tether your phone’s data connection to your computer. Now I always have an emergency internet connection.

2. StatusNotes

Create custom notifications in your status bar. I love being able to set a quick reminder on the fly. For short-term tasks and reminders that would otherwise get lost in RTM, I turn to Status Notes as an extension of my human memory.

3. Pandora Radio

I am addicted to Pandora and couldn’t write code without it.

4. Image Transfer

Wirelessly transfer your photos to your computer’s shared folder with 1 magical button. This saves me so much hassle of dealing with USB cables. Oh and I developed this app :)

5. Google Voice

Use your Google Voice # for outbound calls and SMS. I don’t even know my Verizon assigned phone number!

6. ConnectBot

SSH. Perfect for emergencies, just be careful when your root ;)

7. SplashID

Store all your passwords and important info in SplashID. It syncs wirelessly to your computer. This app has saved me countless times.

8. IP Cam Viewer

Keep an eye on your IP cams. Works great with my Panasonic cams and even supports pan/tilt/zoom controls.

9. Remember The Milk

I would not be able to function without lists. With a RTM pro account, you can sync your tasks to rememberthemilk.com.

10. Listen

Podcasts! Turns your commute into productivity. I spend much less time reading my news feeds and now listen to the podcast versions.

11. Twidroid

A very slick Twitter client that is not bloated and gets the job done well.

12. Evernote

I use Evernote for my personal knowledge base. Having this data with me on my phone definitely comes in handy.

2010
03.06

Keeping track of code snippets, network diagrams, IP allocations, complex syntax and everything else that a typical coder/sysadmin deals with requires a solid knowledge base.

I am using Github for code snippets and Evernote for everything else.

Gists at Github are excellent for storing code snippets. They can even be made public so others could use them also. I was using Snipplr up until now, and it worked out great especially with the TextMate integration. Since I moved my code repositories to Github, I wanted to everything in 1 central place.

Evernote allows you to make separate notebooks and tags which makes organizing your knowledge base pretty simple. The best part though, is the syncing. I am using the Mac and Android apps which sync to evernote.com, so I always have access to my stuff. Adding any type of files within a note is super handy. For instance, I put my network diagram OmniGraffle file in a note and now when I edit the file in OmniGraffle, it automatically saves in the Evernote! Evernote seems to offer a ton of features such as OCR and sharing, but I haven’t explored them much yet.

I am very excited about how both of these services will be increasing my efficiency as I move more of my data into Evernote and Github. Should save tons of time by having access to this info anywhere I go and eliminating having to search a variety of sources.

2010
03.01

Introducing “Image Transfer” for Android. Officially available now in the Android Market!

I was looking for a way to wirelessly transfer the images from my Droid to my computer. There are several file manager apps that will do this, but I wanted a super simple magic button. So I developed Image Transfer for Android using JCIFS (Java CIFS Client Library).

The app is quite simple. The only requirements are that you have a shared folder on your computer and your Android device is on the same wireless network. After setting up your shared folder, just add your destination computer IP address and the folder to transfer images to along with your username and password in the settings menu. Then just press ‘Start Transfer’ whenever you want to transfer your pictures. Here are some screenshots…



2010
02.20

Along with the device’s default time zone, output is now also displayed in GMT for conversions by utilizing the java.util.TimeZone class.

If your not using the Android Market by Google, download the package at Github

2010
02.13

Attended the Android Developer Lab at Google in NYC yesterday and had a blast playing with the Nexus One and several other devices. The presentation and Q/A was filled with topics such as developing for multiple hardware configurations, inter-application communications, marketplace strategies and the do’s and dont’s of Android development. We all know that Google is super developer friendly… and they showed their love yesterday by giving every developer a free Motorola Droid device!

Checkout the world’s largest Nexus One:

2010
01.30

Just published my first Android application in the Android Marketplace :)

Developing for Android isn’t too complicated at all. You need to have a firm grasp on Java and then learn how to work with the Android SDK and build layouts (which are XML btw). I am now working on a desktop widget that could live actively on any of the Android virtual desktops.

To install on your Android device, search for ‘Unix Epoch Converter’ in the Android market or scan this QR code:

Here are some screenshots:

Home Screen

Convert to unix timestamp