Category Archives: Mac OS X

NXServer 3.5 and Ubuntu 12.04

Sometimes, when accessing a machine with Ubuntu 12.04 (or newer) running NXServer 3.5 from a system running NXClient 3.5 or OpenNX, all you can see is a screen with a desktop picture but no panels or menus.

In this case it is necessary to edit the file /usr/NX/etc/node.cfg on the server in order for it to default the virtual desktop to 2D, without effects.

Almost at the end of the file change the line CommandStartGnome to one of the following:

For Unity:

CommandStartGnome = "/usr/bin/gnome-session --session=ubuntu-2d"

 

For Gnome Classic:

CommandStartGnome = “/usr/bin/gnome-session --session=gnome-classic”

SSH Tunneling

Problem: it is necessary to connect your local PC to a remote PC using a service that uses an unencrypted connection, or a port number not allowed on the network. Instead, we would like to perform this connection using an encrypted mechanism and an allowed port number.

Solution: SSH Tunneling. This method works as long as the remote computer has an SSH server, and you know which port it is listening to, usually port 22.

Example: the service (such as a Remote Desktop Application) uses port 4000 between the client and server. We want to tunnel this application through port 22, using SSH which is an encrypted mechanism. Here, ‘user’ and ‘server_address’ have to be replaced by your actual user name and name or IP address of the remote computer.

>> ssh -L 4000:localhost:4000 user@server_address

If we needed to use a port different from 22, we have to use the argument ‘-p new_port_number’, as follows (if port 345 is to be used):

>> ssh -p 345 -L 4000:localhost:4000 user@server_address

After the SSH tunnel has been established, the client and server ends of the application (Remote Desktop, for example) have to be launched, and should be able to communicate.

Nice PDF Editor for Unix

(From http://www.ubuntugeek.com/list-of-pdf-editing-tools-for-ubuntu.html)

Pdftk allows you to manipulate PDF easily and freely. It does not require Acrobat, and it runs on Windows, Linux, Mac OS X, FreeBSD and Solaris.

 

Examples

Merge Two or More PDFs into a New Document:
pdftk 1.pdf 2.pdf 3.pdf cat output 123.pdf

or (Using Handles):
pdftk A=1.pdf B=2.pdf cat A B output 12.pdf

or (Using Wildcards):
pdftk *.pdf cat output combined.pdf

Split Select Pages from Multiple PDFs into a New Document:
pdftk A=one.pdf B=two.pdf cat A1-7 B1-5 A8 output combined.pdf

Rotate the First Page of a PDF to 90 Degrees Clockwise:
pdftk in.pdf cat 1E 2-end output out.pdf:

Rotate an Entire PDF Document’s Pages to 180 Degrees:
pdftk in.pdf cat 1-endS output out.pdf

Encrypt a PDF using 128-Bit Strength (the Default) and Withhold All Permissions (the Default):
pdftk mydoc.pdf output mydoc.128.pdf owner_pw foopass

Same as Above, Except a Password is Required to Open the PDF:
pdftk mydoc.pdf output mydoc.128.pdf owner_pw foo user_pw baz

Same as Above, Except Printing is Allowed (after the PDF is Open):
pdftk mydoc.pdf output mydoc.128.pdf owner_pw foo user_pw baz allow printing

Decrypt a PDF:
pdftk secured.pdf input_pw foopass output unsecured.pdf

Join Two Files, One of Which is Encrypted (the Output is Not Encrypted):
pdftk A=secured.pdf mydoc.pdf input_pw A=foopass cat output combined.pdf

Uncompress PDF Page Streams for Editing the PDF Code in a Text Editor:
pdftk mydoc.pdf output mydoc.clear.pdf uncompress

Repair a PDF’s Corrupted XREF Table and Stream Lengths (If Possible):
pdftk broken.pdf output fixed.pdf

Burst a Single PDF Document into Single Pages and Report its Data to doc_data.txt:
pdftk mydoc.pdf burst

Report on PDF Document Metadata, Bookmarks and Page Labels:
pdftk mydoc.pdf dump_data output report.txt

Adding code highlighting to VIM in Snow Leopard

Open a Terminal and and enter these commands to open vim’s configuration file:


cd /usr/share/vim
sudo vim vimrc

Press the ‘i‘ key to switch vim to Insertion Mode, then enter these lines below the ‘set backspace=2‘ line:


set ai " auto indenting
set history=100 " keep 100 lines of history
set ruler " show the cursor position
syntax on " syntax highlighting
set hlsearch " highlight the last searched term
filetype plugin on " use the file type plugins
" When editing a file, always jump to the last cursor position autocmd BufReadPost *
\ if ! exists("g:leave_my_cursor_position_alone") |
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal g'\"" |
\ endif |
\ endif

Press the Escape key to take vim out of Insertion Mode, then press ‘:‘ (colon) followed by ‘x‘ to save the file and exit. Enter this command again:


sudo vim vimrc

… and you’ll see that vim now automatically indents code, displays the cursor position, has syntax highlighting, etc.

Information taken from here.

Hidden files in Mac OS X

To view hidden files use the following command within a terminal window:


$ defaults write com.apple.finder AppleShowAllFiles TRUE
$ killall Finder

To hide them again change TRUE to FALSE.

Working installation of Python on Snow Leopard

Snow Leopard comes with its own Python and Numpy installation, located in /usr/bin, but in order to install Scipy it is necessary to install a “generic” version of Python.

Run the Python 2.6.4 installer.
Run the NumPy 1.3.0 installer.
Run the SciPy 0.7.1 installer.

It will be installed in /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6

This information was taken from here.