7-Zip

7-Zip is an Open Source file archiver with a high compression ratio. It's used for DriverPacks. p7zip is a Unix port of it that can also be compiled on OS X.

cd /extra/src
wget http://downloads.sourceforge.net/project/p7zip/p7zip/9.04/p7zip_9.04_src_all.tar.bz2
tar xjf p7zip_9.04_src_all.tar.bz2

Build it:

cd p7zip_9.04
make

Edit install.sh, if necessary, to adjust the install location (defaults to /usr/local), then install the programs:

make install

Technology:

ImageMagick conversions

Helpful one-liners and small scripts for batch processing of images.

  • Drop Quality factor of JPEG files
    for imageFile in *.jpg; do convert -quality 25 $imageFile $imageFile; done
  • Resize JPEG files
    for imageFile in *.jpg; do convert -resize 2048x2048 $imageFile $imageFile; done

    Largest dimension will be 2048 pixels

  • Convert PDF to multiple JPEG files:
    convert image.pdf -scene 1 image-%d.jpg

    "scene" specifies where the page numbers will start

Technology:

Using CD/DVD Burners with Linux

Using mkisofs to create and burn CD/DVD images.

Installation
On CentOS:

yum install mkisofs cdrecord

Usage
http://www.ks.uiuc.edu/Development/Computers/docs/user/cd-burner.html

mkisofs -J -l -R -r -T -V volid -allow-multidot -o filename path
  • volid - the volume id for the disk you will make. This is the label the disk will have when automatically mounted on some operating systems.
  • filename - where the filesystem image will be output. The file may be as large as 650MB (CD) or 4.7GB (DVD), so use scratch space if possible.

Technology:

ImageMagick for OS X

Installing ImageMagick on OS X 10.3 (Panther) and OS X 10.6 (Snow Leopard).

Recommended Libraries

  • libtiff
    wget http://dl.maptools.org/dl/libtiff/tiff-3.8.2.tar.gz
    tar zxf tiff-3.8.2.tar.gz
    cd tiff-3.8.2
    ./configure
    make
    sudo make install
  • libjpeg
    wget http://www.ijg.org/files/jpegsrc.v7.tar.gz
    tar zxf jpegsrc.v7.tar.gz
    cd jpeg-7
    ./configure
    make
    sudo make install

ImageMagick installation
To get the latest version of ImageMagick:

Capturing Web Pages

Options for automating the capture of a screen shot of a web page.

Paparazzi!
Paparazzi! is an OS X application for capturing screenshots of web pages. It is AppleScriptable to automate the capture of a page:

tell application "Paparazzi!"
  capture "http://www.google.com/"
  repeat while busy
    delay 1
  end repeat
  save in POSIX file "/Users/foo/Desktop/google.png" as PNG with icon
end tell

webkit2png

Technology:

Handy programs for scripting on OS X

  • MacOSX::File - A collection of Perl modules to manipulate files on MacOS X (set file/creator codes, copy files while preserving the resource fork,etc.)
    Installing on Panther resulted in a "gcc2" error when trying to install from CPAN. Manually still required a tweak even though the latest version has a patch for Panther:

    curl -O http://search.cpan.org/CPAN/authors/id/D/DA/DANKOGAI/MacOSX-File-0.71.tar.gz
    tar zxvf MacOSX-File-0.71.tar.gz
    cd MacOSX-File-0.71
    perl Makefile.PL
    make CC=gcc3
    make test

Technology:

Finding files (quickly) from OS X's command line

Using tar

Some basic usage examples of tar.

Archive a set of files:

tar -cvf tarfile.tar /var/log/syslog /var/log/messages

Archive and compress (gzip) a set of files:

tar -cvzf file.tar.gz /var/log/syslog /var/log/messages

Archive and compress (bzip2) a set of files:

tar -cvjf file.tar.bz2 /var/log/syslog /var/log/messages

Extract a tar file:

tar -xvf file.tar
tar -xvzf file.tar.gz
tar -xvjf file.tar.bz2

Display the content of a tar file:

tar -tvf file.tar
tar -tvzf file.tar.gz
tar -tvjf file.tar.bz2

Technology:

Creating OS X Packages for *nix Programs

Create OS X .pkg files for easily installing custom-built *nix programs.

http://developer.apple.com/tools/installerpolicy.html
http://steven.bitsetters.com/articles/2007/05/09/xcode-packagemaker-tutorial/
http://s.sudre.free.fr/Stuff/PackageMaker_Howto.html

The "Trick"!!
When installing the Unix programs using make install, set a specific destination for the files. You'll then use that to build your OS X pkg. Example:

DESTDIR=/where/to/temporarily/put/the/stuff sudo make install

On OS X 10.6 (Snow Leopard), had to change the command a bit:

make install DESTDIR=/where/to/temporarily/put/the/stuff

Technology:

Shell Script Snippets

Useful Bash shell scripts and one-liners for managing files.

Rename multiple files:

for i in *.avi
do
j=`echo $i | sed 's/find/replace/g'`
mv "$i" "$j"
done

Can also be written on a single line as

for i in *.avi; do j=`echo $i | sed 's/find/replace/g'`; mv "$i" "$j"; done

Finding Multiple Files in a directory
Find and count how many files were modified more than 365 days ago:

find . -mtime +356 | wc -l

Find and delete files that were modified more than 365 days ago:

find . -mtime +365 -exec rm {} \;

Technology:

Pages

Subscribe to Production Monkeys RSS

Recent Updates

  • 5 days 1 hour ago
    1.27.2 update
  • 2 weeks 2 days ago
    Drupal 10/11 config
  • 2 weeks 3 days ago
  • PHP
    2 weeks 3 days ago
    PHP 8.3.11 and AlmaLinux
  • 2 weeks 4 days ago
    New version of Pound