Delete package from Mac OS

Sometimes you may want to delete some package (*.pkg) from your Mac OS installaction. Its assumed, you dont have uninstaller.

There is no official way to uninstall package, but you can do it manually using ‘pkgutil’ tool. There is some articles (you can google it) which described the process.

To automate the process i have wrote this script uninstall-pkg.sh

#!/bin/sh

# this script allow you to uninstall given pkg file

# ATTENTIONS!
# all delete operation are interactive, but in any way
# USE THIS SCRIPT FOR YOUR OWN RISK

SCRIPT=`basename $0`

WD=`pwd`

PACKAGE_NAME=$1

if [ -z "$PACKAGE_NAME" ]; then
    echo "[ERROR] - package is not defined"
    echo "Usage: $SCRIPT <package-name>"
    exit 0
fi

installed_packages=`pkgutil --pkgs | grep $PACKAGE_NAME`
if [ -z "$installed_packages" ]; then
    echo "[ERROR] - package '$PACKAGE_NAME' not found"
    exit 0
fi

for p in `pkgutil --pkgs | grep $PACKAGE_NAME`; do
    echo "Delete package: '$p' [y/n/other key to break] ?:"
    read -n 1 selection
    echo ""
    case "$selection" in
        y)
            echo "[INFO] - Process package: '$p'"
            volume=`pkgutil --pkg-info $p | grep -E 'volume:' | cut -d ' ' -f 2`
            location=`pkgutil --pkg-info $p | grep -E 'location:' | cut -d ' ' -f 2`
            package_path="$volume$location"
            echo '[INFO] - Go to package install location: $package_path'
            cd $package_path
            echo '[INFO] - Iterate package files:'
            for f in `pkgutil --only-files --files $p`; do
                echo 'Delete file: '$f' ? [y/n/other key to skip package]:'
                read -n 1 file_cmd
                echo ""
                case "$file_cmd" in
                    y)
                        sudo rm -i $f
                        echo "[INFO] - file '$f' deleted."
                    ;;
                    n)
                        echo "[INFO] - file '$f' skipped"
                    ;;
                    *)
                        echo "[INFO] - skip all files in package '$p'"
                        break
                    ;;
                esac
            done
            ;;
        n)
            echo '[INFO] - ok, i will skip package '%p''
            ;;
        *)
            echo '[INFO] - quit'
            exit 0
            ;;
    esac
done

cd $WD

source

Deep learning resouces

Videos

  1. Deep Learning and Neural Networks with Kevin Duh: course page
  2. NY Course by Yann LeCun: 2014 version, 2015 version
  3. ICML 2013 Deep Learning Tutorial by Yann Lecun (slides)
  4. Geoffery Hinton’s cousera course on Neural Networks for Machine Learning
  5. Large Scale Visual Recognition Challenge 2014, arxiv paper
  6. GTC Deep Learning 2015
  7. Hugo Larochelle Neural Networks [class[(https://www.youtube.com/playlist?list=PL6Xpj9I5qXYEcOhn7TqghAJ6NAPrNmUBH), slides
  8. My youtube playlist
  9. Yaser Abu-Mostafa’s Learning from Data course (youtube playlist)
  10. Stanford CS224d: Deep Learning for Natural Language Processing: syllabus, youtube playlist, reddit
  11. Neural Networks for Machine Perception: vimeo
  12. Deep Learning for NLP (without magic): page, better page, video1, video2, youtube playlist
  13. Introduction to Deep Learning with Python: video, slides, code
  14. Machine Learning course with emphasis on Deep Learning by Nando de Freitas (youtube playlist), course page, torch practicals
  15. NIPS 2013 Deep Learning for Computer Vision Tutorial – Rob Fergus: video, slides
  1. Deeplearning.net
  2. NVidia’s Deep Learning portal

Books

  1. Learning Deep Architectures for AI, Bengio (pdf)
  2. Neural Nets and Deep Learning (html, github)
  3. Deep Learning, Bengio, Goodfellow, Courville (html)
  4. Neural Nets and Learning Machines, Haykin, 2008 (amazon)

Papers

  1. ImageNet Classification with Deep Convolutional Neural Networks, Alex Krizhevsky, Ilya Sutskever, Geoffrey E Hinton, NIPS 2012 (paper)
  2. Why does unsupervised pre-training help deep learning? (paper)
  3. Hinton06 – Autoencoders (paper)
  4. Deep Learning using Linear Support Vector machines (paper)

Source contains additional materials.

Stand up every 20 minutes (mac os)

Foreword : Inspired by excellent post

Initial task: creating notification every 20 minutes can be decomposed into two parts:

  1. create notification
  2. scheduled launch

First subtask can be solved using this trivial script.

standup.sh:

#!/bin/sh

# stand up notification

osascript -e 'display notification "Stand up" with title "Healthy programmer"'

say "Stand up"

Second subtask (scheduled launch) can be solved using: daemon and agent mechanism.

Create file: com.example.stand.up.plist and place it into ~/Library/LaunchAgents/.