Report inadequate content

Mac, Scripts in Harecoded

Expand

Comando `tree` para Mac

Existe una utilidad llamada "tree" en Windows y Linux que sirve para ver un listado de directorio en un formato ASCII un poco más agradable a la vista. Si no quieres bajarte los MacPorts para esta pequeña utilidad lo más fácil es crear un script de una línea y enlazarlo en /bin para poder llamarlo directamente.

El comando en cuestión es este:

find . -print | sed -e 's;[^/]*/;|--;g;s;--|; |;g'

Ahora, para utilizarlo a troche y moche basta con pegar su contenido en un fichero en cualquier ubicación. Por ejemplo, en mi carpeta de usuario de scripts (/Users/alombarte/scripts/tree.sh):

#!/bin/bash
find . -print | sed -e 's;[^/]*/;|--;g;s;--|; |;g'

Y entonces, para poder escribir allí donde queramos el comando tree hacemos un enlace simbólico:

sudo ln -s /Users/alombarte/scripts/tree.sh /bin/tree

Un ejemplo de la salida es este:

 

|--a1
| |--a11
| | |--fichero_en_a11.txt
| |--fichero_en_a1.txt
|--a2
| |--a21

Así de simple :)

Expand

Overburning script for Mac OS X, Record large films in Mac

If you use the Finder burning tool to create your CDs, or an application that doesn't support overburning (surpass a little bit the CD or DVD maximum size) I am sure that some time you got anrgy.

Sometimes are films, sometimes it's just one more song in the CD library you are creating... The thing is that you have 703MB and you cannot burn a 700MB CD. It won't happen again!

Because I did a script to overburn CDs and DVDs, and it's quite simple if you want to try it:

  • Save the following script inside a overburn.sh file with your prefered text editor or from the shell
  • Give it execution permissions
  • Create a folder named contents_to_overburn that will contain your overburned CD/DVD stuff
  • Copy anything you want to burn inside the folder
  • Execute the script from the terminal, so you can see what's happening, with: ./overburn.sh
hdiutil makehybrid -o tempfile contents_to_overburn/
hdiutil burn tempfile.iso
rm tempfile.iso
rm contents_to_overburn/*

At this point you have the CD burned and the folder emptied for a next use. Hope that works for you, enjoy. This script can be improved or even integrated with the OS X environment easily. If you feel like doing it, please share :)

See the Apple developer page for hdiutil for more information.