Marius van Witzenburg We fight for our survival, we fight!

16jun/112

How to fix the crackling (bad) sound of Bluetooth A2DP headsets or speakers on Mac OS X

Posted by mariusvw

If you found this post you probably ran into the same issue as I had, low volume on your headset or speakers or crackling sound.

The solution for this might sound more complex than it is, the Bitpool for the Bluetooth Audio Agent by default is 35, this seems to be too low if you also use a mouse and keyboard at the same time. In my case only a mouse. Raising it to a higher value solved this problem for me.

I raised it to 50 and it worked perfectly!

You can edit the preference file with a plist editor in this file: ~/Library/Preferences/com.apple.BluetoothAudioAgent

Or, more simple, you can run the following in the program Terminal located at /Applications/Utilities/Terminal.app

At the command line enter the following command:

defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" 50

After doing this you might need to reconnect your device or reboot your Mac to apply the change. In my case turning off the bluetooth adapter and enabling it again was enough.

I tested this with a Sennheiser PX 210 BT and it works perfectly!

12jun/110

Test your console if it can display 256 colors with Perl

Posted by mariusvw

With this script you can test which colors your console can display.

You will simply see all the supported colors on your console.

#!/usr/bin/perl
# Author: Todd Larason <jtl@molehill.org>
# $XFree86: xc/programs/xterm/vttests/256colors2.pl,v 1.1 1999/07/11 08:49:54 dawes Exp $
 
# use the resources for colors 0-15 - usually more-or-less a
# reproduction of the standard ANSI colors, but possibly more
# pleasing shades
 
# colors 16-231 are a 6x6x6 color cube
for ($red = 0; $red < 6; $red++) {
	for ($green = 0; $green < 6; $green++) {
		for ($blue = 0; $blue < 6; $blue++) {
	    	printf("\x1b]4;%d;rgb:%2.2x/%2.2x/%2.2x\x1b\\",
		   	16 + ($red * 36) + ($green * 6) + $blue,
		   	int ($red * 42.5),
		   	int ($green * 42.5),
		   	int ($blue * 42.5));
		}
	}
}
 
# colors 232-255 are a grayscale ramp, intentionally leaving out
# black and white
for ($gray = 0; $gray < 24; $gray++) {
	$level = ($gray * 10) + 8;
	printf("\x1b]4;%d;rgb:%2.2x/%2.2x/%2.2x\x1b\\", 232 + $gray, $level, $level, $level);
}
 
 
# display the colors
 
# first the system ones:
print "System colors:\n";
for ($color = 0; $color < 8; $color++) {
	print "\x1b[48;5;${color}m  ";
}
print "\x1b[0m\n";
for ($color = 8; $color < 16; $color++) {
	print "\x1b[48;5;${color}m  ";
}
print "\x1b[0m\n\n";
 
# now the color cube
print "Color cube, 6x6x6:\n";
for ($green = 0; $green < 6; $green++) {
	for ($red = 0; $red < 6; $red++) {
		for ($blue = 0; $blue < 6; $blue++) {
	    	$color = 16 + ($red * 36) + ($green * 6) + $blue;
	    	print "\x1b[48;5;${color}m  ";
		}
		print "\x1b[0m ";
	}
	print "\n";
}
 
 
# now the grayscale ramp
print "Grayscale ramp:\n";
for ($color = 232; $color < 256; $color++) {
	print "\x1b[48;5;${color}m  ";
}
print "\x1b[0m\n";
Geëtiketeerd als: , , , , Geen reacties
12jun/110

How to use a fully qualified domain name without an active DNS record for testing

Posted by mariusvw

Sometimes when you are moving sites between servers you might run into the problem that you must make contact with the new location by its real hostname. If you don't want the old DNS settings to be adjusted yet and want to test if everything runs fine first on your web server you can adjust the hosts file.

I'll explain this for usage on Mac OS X but of course it works the same on any other *nix environment.

Open Terminal form /Applications/Utilities/Terminal.app and enter the following command:

sudo vi /etc/hosts

Sudo will ask for your account password here.

After entering your password the program Vim will open the hosts file.

At the bottom add the following line by entering insert mode by pressing the i key:

160.79.58.10 test.domain.nl

This will point test.domain.nl to 160.79.58.10.

Now we are done editing we need to save the file first before this will work, this can be done by pressing Esc to exit insert mode and then enter :w to write the file.
You may also want to exit Vim by entering :q or the quick combination :wq.

Your hosts file should look something like this:

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1	localhost
255.255.255.255	broadcasthost
::1             localhost 
fe80::1%lo0	localhost
 
160.79.58.10 test.domain.nl
Geëtiketeerd als: , , , , Geen reacties
14sep/100

Having fun on April 1st with SSH and Mac OS X

Posted by mariusvw

Inspired by the latest MacAddict's April Fools' pranks, here are some very handy commands to remotely control a computer of which you are an administrator. These are most useful in a family environment where you own and administer the others' computers. They also work well over AirPort.

First, you need to ssh to the computer using your admin account. Then, you can type in any or all of the following commands.

[robg adds: Read the rest of the article for the pranks. Please note that some of these are quite nasty! Using your power as Admin to remotely reboot someone's machine, for example, is a simply horrendous thing to do. With that said, however, some of the following would be quite fun to do to someone with a good sense of humor...]

Note: Commands that are shown on two lines have the second line indented by two spaces. Enter the command on one line, removing all but one space between the end of the first displayed line and the start of the second...

Absolutely nasty:

sudo kill [program id learned from top] 
sudo halt
sudo reboot
sudo osascript -e 'tell app "[name of an open program]" to quit'

Note: using 'sudo open' over ssh does not give the user super-user privileges for the opened application.

Power:

sudo osascript -e 'tell app "Finder" to sleep'
sudo osascript -e 'tell app "Finder" to shut down'

General:

sudo open /Applications/iChat.app
sudo osascript -e "set volume 0"
sudo osascript -e "beep"
sudo osascript -e 'display dialog "Did you know that you are annoying?" buttons "Yes" with icon note'
sudo osascript -e 'tell app "Finder" to quit'
sudo open [path to an application]

Speech:

sudo osascript -e 'say "[whatever]" using "Zarvox"'
sudo osascript -e 'say "Dum dum dum dum dum dum dum he he he ho ho ho fa lah lah lah lah lah lah fa lah full hoo hoo hoo" using "Cellos"'
osascript -e 'say "oh This is a silly song silly song silly song this is the silliest song ive ever ever heard So why keep you listening listening listening while you are supposed to work to work to work to work its because i hate my job hate my job hate my job its because i hate my job more than anything else No its because youve no life youve no life youve no life and you better go get one after forwarding this crap" using "cellos"'

iTunes Control:

sudo open /Applications/iTunes.app; sudo osascript -e 'say "Play some music. Go on.  I dare you." using "Zarvox"'
sudo osascript -e 'tell app "iTunes" to stop' -e 'say "Please stop playing your annoying music" using "Zarvox"'
sudo osascript -e 'tell app "iTunes" to next track' -e 'say "I did not like that song very much" using "Zarvox"'
sudo osascript -e 'tell app "iTunes" to fast forward' -e 'say "This song is boring" using "Zarvox"'
sudo osascript -e 'tell app "iTunes" to quit'

Have fun, but not too much fun!

Source: http://hints.macworld.com

Geëtiketeerd als: , , , , Geen reacties