Showing posts with label OSX. Show all posts
Showing posts with label OSX. 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

Thursday, February 02, 2012

How to manually add a new user account by command line in Mac OSX Snow Leopard

sh-3.2# dscl . -create /Users/svnuser
sh-3.2# dscl . -create /Users/svnuser UserShell /bin/bash
sh-3.2# dscl . -passwd /Users/svnuser passwd
sh-3.2# dscl . -create /Users/svnuser RealName SvnUser
sh-3.2# dscl . -create /Users/svnuser UniqueID 510  
sh-3.2# dscl . -create /Users/svnuser PrimaryGroupID 80
sh-3.2# dscl . -create /Users/svnuser NFSHomeDirectory /Users/svnuser
sh-3.2# cp -R /System/Library/User\ Template/English.lproj/ /Users/svnuser
sh-3.2# chown -R svnuser:staff /Users/svnuser

Refer from :

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

Thursday, March 11, 2010

iCal <-> gCal bi-direction sync 


refer to :
http://gcaldaemon.sourceforge.net/usage13.html

confirm working at 10.6 OSX, all other solution did not really bi-direction, or had some limitation.

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

Tuesday, November 24, 2009

Find out which program/process is locking a file in mac osx

from : http://www.macosxhints.com/article.php?story=20091104085622117

Basically, use lsof command, with a AppleScript to work with Finder