Showing posts with label mac. Show all posts
Showing posts with label mac. Show all posts

Tuesday, June 19, 2012

Tweak Apple Remote for XBMC

Apple Remote is a small and pretty remote controller for Mac OSX, but it contain less key then others. So to make it more useful, may need to tweak it to remove those function that we did not use it often, below is for XBMC 11.0 :

neomacmini:TempHD neo$ diff joystick.AppleRemote.xml joystick.AppleRemote.xml.orig

# Click "Menu" button at main screen to bring up shutdown menu
86,87c86,87
<       <button id="8">XBMC.ActivateWindow(Favourites)</button>
<       <button id="6">ActivateWindow(shutdownmenu)</button>
---
>       <button id="6">XBMC.ActivateWindow(Favourites)</button>
>       <button id="8">ActivateWindow(shutdownmenu)</button>

# Click "Right" button to stop music, so that we dont need to browse to to "stop" button"
90,95d89
<   <mymusicfiles>
<     <joystick name="AppleRemote">
<       <button id="4">Stop</button>
<       <button id="6">ParentDir</button>
<     </joystick>
<   </mymusicfiles>

# Let "Up/Down" button to do big jump when watching movie
98,99c92,93
<       <button id="1">BigStepForward</button>
<       <button id="2">BigStepBack</button>
---
>       <button id="1">VolumeUp</button>
>       <button id="2">VolumeDown</button>

#Long press "Menu" key at video screen will bring up OSD menu, instead of switch back to control screen
104c98,99
<       <button id="8">OSD</button>
---
>       <button id="7">OSD</button>
>       <button id="8">Fullscreen</button>

For Mac OSX, the location of joystick.AppleRemote.xml is at /Applications/XBMC.app/Contents/Resources/XBMC/system/keymaps

Modified joystick.AppleRemote.xml : http://goo.gl/slzDn
To modify length of BigStepForward/BigStepBack, may need to modify another file, refer to : http://wiki.xbmc.org/?title=Advancedsettings.xml

Friday, January 21, 2011

pidof script of mac OSX

Found at http://hints.macworld.com/article.php?story=20030618114543169

#!/bin/sh
ps axc|awk "{if (\$5==\"$1\") print \$1}";

Sunday, April 04, 2010

How to build squashfs-tools under mac osx

http://zettelchen.blogspot.com/2009/04/build-squashfs-tools-for-mac-os-x.html

1. remove FNM_EXTMATCH, it does not exist at mac
2. include

Friday, March 05, 2010

Use Android phone as 3G modem on Mac OSX

** Only tested at Google Nexus One

Reference from :
Using Android Phone as a USB Tether on Mac OS X
Tethering android and OSX without root
Mac OS X Droid Tethering (USB/Wired)

1. Download and install necessary applications at OSX :
- TunnelBlick OpenVPN for Mac OS X
- tuntap for Mac OS X
* need to reboot to make sure kext got loaded at startup.
* or manually load them by blow command w/o reboot :
sudo kextload /Library/Extensions/tun.kext
sudo kextload /Library/Extensions/tap.kext

2. Download and install azilink.apk at android phone :
- azilink for google android
* execute azilink at android phone, enable service

3. Download Android SDK, cp tools/adb into executable path ( like /usr/sbin )

4. Enable USB debugging on the Android phone :
- Settings>Applications>Development>USB debugging.

5. Save blow script into ~/azilink.sh ( from http://pastie.org/701122 ), and execute it :

#!/bin/bash
#
# azilink for OS X
# based on http://pastie.org/405289 but works with Tunnelblick only
# (no need to install a separate copy of OpenVPN2 from macports
# or building from source by hand, thankfully)
# Requires:
# - azilink running on android phone (http://code.google.com/p/azilink/)
# (run the app and check the box to start the service).
# - adb on system path (comes with the Android SDK;
# add its tools folder to your PATH in ~/.profile or
# place or symlink the sdk's tools/adb file in e.g. usr/local/bin or somewhere else on the PATH)
# - Tunnelblick, a nice OS X packaging of OpenVPN (http://code.google.com/p/tunnelblick/)
# Install Tunnelblick to Applications. Tested with Tunnelblick 3.0b22

init() {
adb forward tcp:41927 tcp:41927
sudo /Applications/Tunnelblick.app/Contents/Resources/openvpn --dev tun \
--script-security 2\
--remote 127.0.0.1 41927 \
--proto tcp-client \
--ifconfig 192.168.56.2 192.168.56.1 \
--route 0.0.0.0 128.0.0.0 \
--route 128.0.0.0 128.0.0.0 \
--keepalive 10 30 \
--up "$0 up" \
--down "$0 down"
}

up() {
tun_dev=$1
ns=192.168.56.1
sudo /usr/sbin/scutil << EOF
open
d.init
get State:/Network/Interface/$tun_dev/IPv4
d.add InterfaceName $tun_dev
set State:/Network/Service/openvpn-$tun_dev/IPv4

d.init
d.add ServerAddresses * $ns
set State:/Network/Service/openvpn-$tun_dev/DNS
quit
EOF
}


down() {
tun_dev=$1
sudo /usr/sbin/scutil << EOF
open
remove State:/Network/Service/openvpn-$tun_dev/IPv4
remove State:/Network/Service/openvpn-$tun_dev/DNS
quit
EOF
}


case $1 in
up ) up $2 ;; # openvpn will pass tun/tap dev as $2
down) down $2 ;;
* ) init ;;
esac

Thursday, December 17, 2009

mac 下用 meld

Meld 是 Linux 下很習慣用的比對工具,仰賴 darwin port 的 project,Mac 下也有機會可以用了。
但是啟動的時候,遇到一些錯誤。

Xlib: extension "RANDR" missing on display "/tmp/launch-RsRIqw/:0".
Dynamic session lookup supported but failed: launchd did not provide a socket path, verify that org.freedesktop.dbus-session.plist is loaded!
Dynamic session lookup supported but failed: launchd did not provide a socket path, verify that org.freedesktop.dbus-session.plist is loaded!
Dynamic session lookup supported but failed: launchd did not provide a socket path, verify that org.freedesktop.dbus-session.plist is loaded!
Dynamic session lookup supported but failed: launchd did not provide a socket path, verify that org.freedesktop.dbus-session.plist is loaded!
Dynamic session lookup supported but failed: launchd did not provide a socket path, verify that org.freedesktop.dbus-session.plist is loaded!
Dynamic session lookup supported but failed: launchd did not provide a socket path, verify that org.freedesktop.dbus-session.plist is loaded!
Traceback (most recent call last):
File "/opt/local/bin/meld", line 109, in
meldapp.main()
File "/opt/local/lib/meld/meldapp.py", line 855, in main
app = MeldApp()
File "/opt/local/lib/meld/meldapp.py", line 528, in __init__
self.prefs = MeldPreferences()
File "/opt/local/lib/meld/meldapp.py", line 465, in __init__
prefs.Preferences.__init__(self, "/apps/meld", self.defaults)
File "/opt/local/lib/meld/prefs.py", line 91, in __init__
self._gconf.add_dir(rootkey, gconf.CLIENT_PRELOAD_NONE)
glib.GError: Failed to contact configuration server; some possible causes are that you need to enable TCP/IP networking for ORBit, or you have stale NFS locks due to a system crash. See http://projects.gnome.org/gconf/ for information. (Details - 1: Failed to get connection to session: Not enough memory)


google 了一下,發現要執行下面兩行先:

# sudo launchctl load -w /Library/LaunchDaemons/org.freedesktop.dbus-system.plist
# launchctl load -w /Library/LaunchAgents/org.freedesktop.dbus-session.plist

注意的是,很多網站兩行都已 sudo 開頭,其實第二行必須自身的帳號執行( 也是google 來的拉)。
照做之後,果然就可以動了,耶~