Programming

Table of Contents

Working in Command-Line

Startup Items

  • 1) /Library/LaunchAgents/*
    2) System Preferences > Users & Groups > Login Items

Make Bootable Media

  • $ diskutil list
    /dev/disk2 (external, physical):
    #: TYPE NAME SIZE IDENTIFIER
    0: Apple_partition_scheme *15.6 GB disk2
    1: Apple_partition_map 4.1 KB disk2s1
    2: Apple_HFS 2.4 MB disk2s2
    $ diskutil unmountDisk /dev/disk2
    $ dd if=ubuntu.iso |pv |sudo dd of=/dev/rdisk2 bs=1m
    # Use rdisk2 instead of disk2 for better performance

MacPort

  • $ sudo port uninstall inactive
    $ port echo leaves
    $ sudo port uninstall leaves

Backup to Disk Image

  • $ sudo dd if=/dev/rdisk2s2 bs=1m |pv |gzip > disk2s2.img.gz
    $ sudo gzip -dc disk2s2.img.gz |pv |sudo dd of=/dev/sda bs=1m

Find

  • $ find . -name ".DS_Store" -exec rm {} \;

    # Fix premission from NTFS
    $ chflags -R nouchg .
    $ find . -type d -perm 777 -exec chmod 755 {} \;
    $ find . -type f -perm 777 -exec chmod 644 {} \;

Enable Spolight indexing for Google Drive

  • # Enable
    $ mdutil /Volumes/GoogleDrive/ -i on
    # Disable
    $ mdutil /Volumes/GoogleDrive/ -i off
    $ Check
    $ mdutil /Volumes/GoogleDrive/ -s