Posts tagged macosx

GPG and S/MIME in Apple Mail

I use both OpenPGP and S/MIME in my Apple Mail, but by default all new Messages are sent using OpenPGP. It’s easy to change this behaviour in the Terminal:

Set S/MIME as default security method

defaults write org.gpgtools.gpgmail DefaultSecurityMethod -int 2

Use OpenPGP as the default again:

defaults write org.gpgtools.gpgmail DefaultSecurityMethod -int 1

Got this from https://gpgtools.tenderapp.com/kb/gpgmail-faq/gpgmail-2-hidden-settings#define-the-default-security-method-to-be-used

Git: ignore Mac OSX icon files

When using git on Mac OSX and your project’s folder has a custom icon, you will see a “Iconr” File showing up in your git status or Source Tree. Ignoring this file doesn’t work.

The solution is to ignore the correct way (or syntax), because Apple uses ^M at the end of the filename, which is a CRLF, a hidden character. In fact you have to ignore “Icon^M^M” in your .gitignore file, but it’s not easy to enter these special characters as ^M is in fact one single CRLF character.

I found a hint using the ruby interactive interpreter, but i wanted to use my beloved Python, so here’s the code:

>>> f = open('.gitignore','a')
>>> f.write('Icon\r\r')
>>> f.close()

use this in your home directory as you need to edit ~/.gitignore and ~/.gitignore_global (for Source Tree)

Resize Raspberry Pi SD Card Image

I had the need to shrink a 16GB microSD card to use the image on my other Raspberry Pi, but only had smaller SD Cards lying around. So what now?

After a lot of tests and googling i found a way to get this working on my Mac OSX.

Things you need:

  • Apple Pi Baker
  • gParted Live Image
  • CD Burner and empty CD or an USB Stick with at least 256 MB
  • big SD Card containing current Raspberry Pi image
  • smaller SD Card (2GB, 4GB, …)

Apple Pi Baker is a GUI to copy Raspberry Pi or other .img files to a SD card or USB stick, like using dd from command line, but with the advantage of using a GUI and displaying the time remaining for the process to finish. Additionally you can use it to create a .img from a SD card (backup) or create a Raspberry Pi NOOB SD card.

Part I: gParted

Download gParted live image from http://gparted.org/download.php

When using a USB drive:

  • convert the downloaded .iso to a .img in the directory containing the .iso with this Terminal command:
hdiutil convert source.iso -format UDRW -o destination.img
  • then use Apple Pi Baker to copy the gParted.img to the USB Stick

When using a CD:

  • open the .iso in Disk Utility
  • Burn this image

Then connect the USB stick to a Mac or PC or boot from the CD.

Start gParted an then select the SD card (on Mac you will need to use a USB SD card reader as the internal SD card reader is not supported) and select the second (big) EXT4 partition and resize it to a bit bigger than the minimum size or a little bit smaller than the desired SD card size (1.9 GB for a 2 GB SD card).

eject the SD card and / or restart your computer.

Part II: create card image and restore

Use Apple Pi Baker to backup your (big) SD card. This will create a image in the size of the card, not in the size of your shrinked image! 

The trick is to restore this image to the smaller SD card. This will work, because you shrinked all partitions below the size of your (smaller) SD card. Apple Pi Baker will diskplay a warning that the image is to big to restore to the SD card, but it will stop when the card is full.

Now we have the smaller SD card and we’re almost finished.

Part III: fix the SD card

Now insert the smaller SD card into your Raspberry Pi and power it on to boot.

Booting will fail as fsck will fail to repair the card automatically. But pressing CRTL-D to continue will fix the problem and reboot the Raspberry.

Part IV: backup the smaller SD card (optional)

Now it’s a good idea to backup the small SD card to a now smaller .img because the backup will always have the size of the card used. Use Apple Pi Baker for this again.

To fill the whole SD card use this command in the Terminal of your gParted Live CD / USB stick, where XXX is the name of the SD card (eg. /dev/sdc2):

# resize2fs /dev/XXX

Shairtunes (airplay audio client) on Mac OS X 10.7


Based on Thias blog instructions on building shairtunes for Mac OS X.

  • install XCode using AppStore on Mac OS X 10.7 (a AppleID is needed for that)
  • open XCode, in the Preferences “Downloads” click on button to download and install the Command Line Tools
  • Download and install Mac Ports (http://macports.org/)
  • Open Terminal and type:
$ sudo port install git-core libao p5-io-socket-inet6 p5-libwww-perl p5-crypt-openssl-rsa
$ sudo port install pkgconfig

install shairtunes as a damon:

$ sudo mkdir -p /usr/local/bin/
$ sudo cp hairtunes shairport.pl /usr/local/bin/
$ sudo vi /usr/local/bin/shairport.pl # change the path of cli_hairtunes  /usr/local/bin/hairtunes
$ sudo cp org.mafipulation.shairport.plist Library/LaunchAgents/
$ launchctl load org.mafipulation.shairport.plist
$ launchctl unload org.mafipulation.shairport.plist # (to remove)

Attention:

works only while a user is logged in! (on the login screen there is no shairtunes possible) consider using autologin for this mac (but be aware of the possible security risks!)

iChat 6 (Lion) as a Adium replacement?

For years i used Adium, but sometimes i miss the video and audio features iChat provides.

As i updated to Mac OS X 10.7 aka Lion i thought i should give iChat a try. Suprisingly iChat 6 has some features which come close to Adium’s user experience:

  • now supports Yahoo! Messenger, even with audio and video – that’s good!
  • has an open plugin interface for thirdparty protocols
  • Facebook (using Jabber): works
  • Jabber server from work works out of the box
  • GMail / GoogleTalk works (audio / video not tested)
  • AIM out of the box
  • ICQ works (you have to use an AIM account and change the server to login.icq.com and disable SSL)
  • Bonjour works out of the box

Protocols i used in Adium and missing in iChat out of the box:

  • Twitter (workaround: twitter.im – seems to work)
  • MSN (“Cocoon” plugin is in early development, but seems promising)
  • IRC (iChat 6 plugin is also in early development, but promising, was able to connect to a room, but many features missing)
  • Myspace (but who is still using it anyhow 😉 )

right now iChat seems to provide almost all important protocols i used to use on Adium plus the video and audio chatting.

gEDA open source electronic design automation

gEDA is installed using macports, but when installing i found a little problem when xgsch2pcb complained about a missing update-desktop-database
[important]fix: install desktop-file-utils first[/important]

complete install commands:

$ sudo port install desktop-file-utils
$ sudo port install geda-gaf
$ sudo port install pcb
$ sudo port install xgsch2pcb
$ sudo port install gerbv

useful addition: Mac OS X launchers for the commandline tools make it easy to start the apps and to double click documents, launches X11 and the responsible program:
http://www.msarnoff.org/geda-mac/

DIY DMX Steuerung mit ArduinoDIY DMX Controller using Arduino

Arduino, ein einfacher RS485 Treiber IC und ein Widerstand sind alles was man benötigt um einen billigen DMX Lichtkontroller zu bauen und man bekommt auch noch eine voll funktionsfähige Software gratis dazu.

Als Erstes bauen wir den DMX Kontroller, ich hab mich entschieden dafür ein Arduino ProtoShield zu verwenden. Das Design basiert auf der Arbeit von Tom Kness. Einfach nachbauen und den “Input” mit D0/RX auf dem Arduino verbinden. Ich hab mcih für einen Jumper entschieden, damit ich leicht zwischen D0 (damit wird aus dem Arduino ein OpenDMX Interface) und D3 – ist der Standardport für die DMX Simple Bibliothek – wechseln kann.

Als nächstes benötigen wir eine Lichtsteuer-Software und das bitte gratis. Q Light Commander ist gratis und Open Source und für Mac OS X / Windows und Linux verfügbar.

Das Wichtigste ist allerdings, dass vor dem Start der Software der FTDI USB Treiber (wird vom Arduino IDE mit installiert) beendet wird!

Prüfen ob der Treiber geladen ist:

$ sudo kextstat | grep FTDI

Treiber beenden:

$ sudo kextunload /System/Library/Extensions/FTDIUSBSerialDriver.kext

Treiber wieder laden:

$ sudo kextload /System/Library/Extensions/FTDIUSBSerialDriver.kext

Arduino, a simple RS485 driver, one resistor is all you need to get build your own cheap DMX light controller and get a full featured controlling software for free.

First you have to build your DMX controller, i’ve chosen to build it on a ArduinoProto Shield. It’s based on the design by Tom Kness. Just connect the “input” to D0/RX on your Arduino Board. I used a jumper to switch between D0/RX (for Arduino as a OpenDMX Interface) and D3 which is the default Output for the DMX Simple library

The next thing we need is a free Software to control the lights. I use Q Light Commander which is available for Mac OS X / Linux and Windows.

The most important thing is to unload the FTDI USB drivers (which you probably use for Arduino development because they get preinstalled with the Arduino IDE)!

check if the drivers are loaded:

$ sudo kextstat | grep FTDI

unload them

$ sudo kextunload /System/Library/Extensions/FTDIUSBSerialDriver.kext

load them again

$ sudo kextload /System/Library/Extensions/FTDIUSBSerialDriver.kext

Converting a .mkv with DTS audio to a .mkv with only AC3 audio on OS X

based on L. Preston Sego III’s work, check it out here.

first we need to install some tools:

$ mkdir ConverterTemp
$ cd ConverterTem
$ curl -O http://www.cmake.org/files/v2.8/cmake-2.8.3.tar.gz
$ tar xvfz cmake-2.8.3.tar.gz
$ cd cmake-2.8.3
$ ./bootstrap
$ make
$ sudo make install
$ svn co http://aften.svn.sourceforge.net/svnroot/aften Aften
$ cd Aften
$ mkdir default
$ cd default
$ cmake /../../Aften/
$ make
$ sudo make install
$ svn co svn://svn.videolan.org/libdca/trunk libdca
$ cd libdca
$ ./bootstrap
$ ./configure
$ make
$ sudo make install

download MKVtoolNIX from http://jonthn.free.fr/MKVtoolnix/

$ sudo ln -s /Applications/Mkvtoolnix.app/Contents/MacOS/mkv* /usr/local/bin/

install mkvdts2ac3:

$ curl -O https://github.com/JakeWharton/mkvdts2ac3/raw/master/mkvdts2ac3.sh
$ chmod 755 mkvdts2ac3.sh
$ sudo cp mkvdts2ac3.sh /usr/local/bin/mkvdts2ac3

Usage:

$ mkvdts3ac3 --new -n -f -wd /Volumes/myDisk/Rips mymovie.mkv

Von TextMate auf VIM umsteigenSwitching to Vim from TextMate

Basierend auf Daniel Fischer’s Artikel habe ich hier dokumentiert wie ich von TextMate nach Jahren auf MacVIM umgestiegen bin. Das hat den Vorteil für mich, dass ich nur noch einen Texteditor verwende, egal ob ich auf Linux oder auf Mac OS X arbeite.

MacVim installieren

  • MacVim von https://github.com/b4winckler/macvim/ (latest snapshot) runterladen
  • MacVim.app in /Applications kopieren
  • mvim in den Pfad kopieren (zu finden im entpackten MacVim-snapshot-xx Ordner mittels Terminal):
$ sudo mv mvim /usr/local/bin/

Install git

Install Carlhuda’s vim Distribution

$ for i in ~/.vim ~/.vimrc ~/.gvimrc; do [ -e $i ] && mv $i $i.old; done
$ git clone git://github.com/carlhuda/janus.git ~/.vim
$ cd ~/.vim
$ rake

macVim tunen

Syntax Highlight für Actionscript

" overwrite actionscript .as file detection
au BufRead,BufNewFile *.as set ft=actionscript

Farbschema auswählen

im gvimrc bzw vimrc nach einer Zeile die “color molokai” enthält suchen und mit folgender Zeile ersetzen:

color candycode

Taglists (zeigt Variablen, Funktionen in einem Fenster an)

Leider ist die ctags Version die in Mac OS X installiert ist zu alt und wir müssen eine aktuelle Version selbst runterladen und installieren:

$ curl -O http://prdownloads.sourceforge.net/ctags/ctags-5.8.tar.gz
$ tar xzvf ctags-5.8.tar.gz
$ cd ctags-5.8
$ ./configure
$ make
$ make install

Nun das Tag List Vim Plugin runterladen http://www.vim.org/scripts/script.php?script_id=273 und im gvimrc bzw. vimrc folgende Zeilen hinzufügen:

" Select the exuberant ctags (had to be downloaded and installed!)
let Tlist_Ctags_Cmd = '/usr/local/bin/ctags'
" configure Tag List
let Tlist_Show_One_File = 1
let Tlist_Use_Right_Window = 1
let Tlist_WinWidth = 40

Das Plugin lässt sich über :TlistToggle im VIM aktivieren.

Links

Based on Daniel Fischer’s article i document how i switched to Vim from TextMate after using TextMate for several years.

Install MacVim

  • download from https://github.com/b4winckler/macvim/ (use latest snapshot)
  • copy MacVim.app to your /Applications directory
  • copy mvim into your path, change into the unzipped downloaded MacVim-snapshot-xx folder in your Terminal and enter:
$ sudo mv mvim /usr/local/bin/

Install git

Install Carlhuda’s vim Distribution

$ for i in ~/.vim ~/.vimrc ~/.gvimrc; do [ -e $i ] && mv $i $i.old; done
$ git clone git://github.com/carlhuda/janus.git ~/.vim
$ cd ~/.vim
$ rake

Pimp macVim

syntax highlight file for actionscript

" overwrite actionscript .as file detection
au BufRead,BufNewFile *.as set ft=actionscript

choose a default color theme

search for a line containing color molokai and replace it with

color candycode

Taglists (displays variables, functions, …)

Unfortunately the ctags needed for the TagList vim plugin which comes preinstalled with Mac OS X doesn’t work because it’s too old. Therefore we need to build it ourselves:

$ curl -O http://prdownloads.sourceforge.net/ctags/ctags-5.8.tar.gz
$ tar xzvf ctags-5.8.tar.gz
$ cd ctags-5.8
$ ./configure
$ make
$ make install

Now download and install the Tag List vim plugin from here: http://www.vim.org/scripts/script.php?script_id=273

Edit your .vimrc file:

" Select the exuberant ctags (had to be downloaded and installed!)
let Tlist_Ctags_Cmd = '/usr/local/bin/ctags'
" configure Tag List
let Tlist_Show_One_File = 1
let Tlist_Use_Right_Window = 1
let Tlist_WinWidth = 40

use the tag list plugin by typing :TlistToggle in your VIM

Links

SerProxyGUI 1.0

SerProxyGUI ist eine grafische Oberfläche für die kommandozeilenbasierten Seriell-Proxys “TinkerProxy” oder “SerProxy”, die eine Verwendung der Proxys ohne Editieren der Konfigurationsdatei erlaubt und bietet eine komfortable Auswahl von vorhandenen USB Seriellen Geräten. Diese Software ist vor allem bei der Verwendung von Flash Anwendungen, die mit serieller Hardware (z.B. Arduino mit Firmata) interagieren sehr hilfreich und leicht zu bedienen.

>>> download

The first release of SerProxyGUI is now available!

SerProxyGUI is basically a GUI wrapper for the commandline serial proxy “TinkerProxy” or “SerProxy” that allows to use this proxy without editing the configfile and to choose from a list of available devices. This application is very helpful if you are using Flash applications to communicate with hardware like Arduino running Firmata.

>>> download

Sprache ändern

Categories

Archives