2010/01/18

MacBook Pro - Very Poor Volume Output FIXED!

If your bootcamp windows is having very poor volume output on 2009 unibody MacBook Pro, here's the solution: http://www.stuffedcow.net/macbook_audio. Thank you, Henry.

I follow the instruction below, plus a reboot, and fixed the problem:
  1. Download and unzip this package: CirrusAudioXP_Macbook_c.zip 1.0.0.13c (Nov. 1, 2009).
  2. In Device Manager, Update Driver for the Cirrus Logic High Definition Audio device. Don't let Windows search for or do anything automatically. Manually choose to the driver from a list, and use the "Have Disk..." button.
  3. Reboot.
My configuration is latest 13" MBP (MB990LL/A), bootcamp 3.0 from Snow Leopard, and latest Windows 7 (build 7600).

The detail discussion can be viewed here: http://discussions.apple.com/thread.jspa?threadID=2037093&start=449

2009/12/25

Linux & NTFS

http://wiki.centos.org/zh-tw/TipsAndTricks/NTFS

1. Install
yum --enablerepo=rpmforge install fuse fuse-ntfs-3g

2. Mount it
mount /dev/The_NTFS_PARTION /the_mount_point

That's it.

2009/11/12

ssh via apache deamon user

Scenario: You have a web script (php, ruby, python, or so) that need to ssh over a remote machine to do stuff. How you do set up ssh key for the apache deamon user?

After some dig out, here's the steps, mostly taken from (Boredworkers.com):

Make key for apache daemon
1. log in to source server as root
2. create .ssh directory for apache user. Make sure you have the ownership right:

$ mkdir /var/www/.ssh
$ chown -R apache:nobody /var/www/.ssh


3. Generate the ssh-key authentication key as user apache using sudo. Use the default file location and leave empty when prompted for passphrase.

$ sudo -u apache ssh-keygen -t rsa


4. Append apache's public key to destination server

$ sudo -u apache cat .ssh/id_rsa.pub | ssh dest_user@dest_server 'cat >> ~/.ssh/authorized_keys'


5. Test the set up. You’ll see that you can now run ssh commands without being prompted for the user password:

$ sudo -u apache ssh dest_user@dest_server


refernce: http://www.boredworkers.com/2009/08/24/script-tips-ssh-key-for-apache/

2009/10/23

REHL: mount iso images

Below is the way to mount iso image file in REHL system:

Before you start to mount your iso image, you need to ensure the folder /mnt/isoimage is available, if /mnt/isoimage is not available just create one using command below:-

#mkdir /mnt/isoimage

* Once isoimage directory is available, you can use the command below to mount your iso image

# mount -o loop -t iso9660 myisoimage.iso /mnt/isoimage/

* You just mount your iso image file to /mnt/isoimage successfully. To access your iso image files, go to /mnt/isoimage

Once you finish using your files, below is the way to unmount your iso image:-

# umount /mnt/isoimage

2009/09/26

REHL: rsync setup & ssh keys

Have you ever wanted to know how to easily synchronize the data between multiple servers automatically?

rsync is the anwser. And here's some note. We will use rsync, ssh key authentication, and a cron job.

Let’s call the 2 servers "SOURCESERVER" and "DESTSERVER" for:
SOURCESERVER = Source server (the server we’re connecting from to upload the data)
DESTSERVER = Destination server (the server we’re connecting to receive the data)

Part 1 - Setting up SSH key authentication
First, we need to make sure the DESTSERVER has the ability to use key authentication enabled. Find your sshd configuration file (usually /etc/ssh/sshd_config) and enable the following options if they are not already set.

RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys


If you edit the file be sure to restart sshd afterwards.

#service sshd restart


Next, on the SOURCESERVER we will create the public & private key pair to be used for authentication with the following command:

ssh-keygen -t dsa

*Note 1: Do not enter a passphrase for this, just hit enter when prompted.
*Note 2: if SOURCESERVER doesn't have key yet, do the keygen as well.

This should create 2 files in ~/.ssh folder, a public key file (id_dsa) and a private key file (id_dsa.pub).

The private key file (~/.ssh/id_dsa) we will keep on the SOURCESERVER.

*Be sure to keep this private key safe. With it anyone will be able to connect to the DESTSERVER that contains the public key.

chmod 700 ~/.ssh
chmod -R 600 ~/.ssh/*


Now we will add the public key we created on to the DESTSERVER.
Choose the user account which you will use to connect to on DESTSERVER, we'll call this user ‘destuser’ for now.

The public key file (~/.ssh/id_dsa.pub) we will upload to the DESTSERVER, and call it SOURCESERVER.pub.

scp ~/.ssh/id_dsa.pub DESTUSER@DESTSERVER:~/.ssh/SOURCESERVER.pub


On the DESTSERVER, in the DESTUSER's home directory, in the .ssh folder, create a new text file called "authorized_keys".
touch ~/.ssh/authorized_keys

If it already exists, great, we will use the existing authorized_keys file to add the SOURCESERVER's public key.

cat ~/.ssh/SOURCESERVER.pub >> ~/.ssh/authorized_keys


Be sure the permissions for key files are 600 and 700 for the ‘.ssh’ folder.

Now to test that the keys are working. From the SOURCESERVER try logging in as normal using ssh to the DESTSERVER.

# ssh destuser@DESTSERVER


If all is working you should not be prompted for a password and able to connected directly to a shell on the DESTSERVER.

Part 2 - Creating the rsync script
Now for the rsync script. I use a simple script such as the following

#!/bin/bash

SOURCEPATH=’/source/directory’
DESTPATH=’/destination’
DESTHOST=’123.123.123.123′
DESTUSER=’destuser’
LOGFILE=’rsync.log’

echo $’\n\n’ >> $LOGFILE
rsync -av –rsh=ssh $SOURCEPATH $DESTUSER@$DESTHOST:$DESTPATH 2>&1 >> $LOGFILE
echo “Completed at: `/bin/date`” >> $LOGFILE

Copy this file into the home directory of the sourceuser on the SOURCESERVER and modify the first 4 variables in the file.

SOURCEPATH (Source path to be synced)
DESTPATH (Destination path to be synced)
DESTHOST (Destination IP address or host name)
DESTUSER (User on the destination server)

Save it as something like ‘rsync.sh’

Set the permissions on the file to 700.
# chmod 700 rsync.sh

Now you should be able to run the script, have it connect to the DESTSERVER, and transfer the files all without your interaction.

The script will send all output to the ‘rsync.log’ file specified in the script.

Part 3 - Setting up the cron job

Assuming everything has worked so far all that’s left is to setup a cron job to run the script automatically at a predefined interval.

As the same sourceuser use the ‘crontab’ command to create a new cron job.

# crontab -e

This will open an editor where you can schedule the job. Enter the following to have the script run once every hour:

# Run my rsync script once every hour
0 * * * * /path/to/rsync.sh

Your 2 servers should now be syncing the chosen directory once every hour.

Mercury簡易改裝

有同好有一樣的困擾 - 如何使用自己的data logging軟體,因此寫了這篇來分享我的簡易改裝。 Background 雲豆子 MERCURY roaster 烘豆機的設計是使用自行開發的軟體,來:1. 操控風門/火力; 2. data logging/自動烘焙。 ...