@ wrote... (6 years, 4 months ago)

Packages change pretty frequently when you're using Homebrew on OSX, including Python.

I noticed that I had several instances of lots of large packages installed (Boot, MacVim, Python, etc) so I ran brew cleanup and that freed up approx 9 gigs of disk! Unfortunately it also broke many virtual environments since the version of python that they were pointing at no longer existed.

What to do what to do…

Based on this Stack Overflow question I wrote a script to update a single virtual environment or all of them.

Note, this only updates virtual enviroments created with virtualenvwrapper. Also, you may have to reinstall your packages, but hopefully not.

#!/bin/bash

if [ -z "$1" ]; then
    echo "usage: $0 virtualenv|all"
    exit 1
fi

if [ -z "$WORKON_HOME" ]; then
    echo "you must export WORKON_HOME"
    exit 1
fi

if [ "$1" = "all" ]; then
    echo "udpating all virtualenvs"
    cd $WORKON_HOME

    for name in $(find . -type d -maxdepth 1 -mindepth 1|xargs -n1 basename); do
        $0 $name
    done

    exit 0
fi

cd $WORKON_HOME
virtenv="$WORKON_HOME/$1"

echo "deleteing $1"

rm -f  $virtenv/.Python
rm -f  $virtenv/bin/pip
rm -f  $virtenv/bin/pip2
rm -f  $virtenv/bin/pip2.7
rm -f  $virtenv/bin/python
rm -f  $virtenv/bin/python2
rm -f  $virtenv/bin/python2.7
rm -fr $virtenv/include
rm -f  $virtenv/lib/python2.7/* 2> /dev/null
rm -fr $virtenv/lib/python2.7/distutils
rm -f  $virtenv/lib/python2.7/site-packages/easy_install.*
rm -fr $virtenv/lib/python2.7/site-packages/pip
rm -fr $virtenv/lib/python2.7/site-packages/pip-*.dist-info
rm -fr $virtenv/lib/python2.7/site-packages/setuptools
rm -fr $virtenv/lib/python2.7/site-packages/setuptools-*.dist-info

source `which virtualenvwrapper.sh`

echo "creating $1"
mkvirtualenv -q $1
Category: tech, Tags: osx, python, virtualenv
Comments: 0
@ wrote... (8 years, 3 months ago)

NameChanger is a quick and easy way to bulk rename files on OSX. But it took a bit of trial and error for me to figure out how to use back references when I wanted to use a regular expression. This brand of regex syntax uses $.

Quick howto:

  1. select and drag some files into the left pane
  2. eg file: 301 - some.show.name.avi -> Some.Show.s3e01.avi
  3. left box: ^(\d)(\d\d).*, middle box: regular expression, right box: Some.Show.s$1e$2.avi
  4. click the rename button
Category: tech, Tags: osx, regex
Comments: 0
@ wrote... (10 years, 5 months ago)

Helped along greatly by http://yourmacguy.wordpress.com/2012/06/29/osx-automount/

Apple seems to change how nfs/nis/anything unix works with each release. On Snow Leopard my nis and nfs worked great, but after my upgrade to Mountain Lion, less so.

My nis already “works”. As in, ypcat passwd does what you'd expect but permissions and ownership over nfs are still buggered. I'll update this post or make a new one when I have that figured out.

Here's how I got /home to automount a Linux nfs server.

sudo mkdir /etc/automounts
# /etc/auto_master 
# Automounter master map
#
+auto_master        # Use directory service
/net            -hosts      -nobrowse,hidefromfinder,nosuid
#/home          auto_home   -nobrowse,hidefromfinder
/Network/Servers    -fstab
/-          -static

/home /etc/automounts/home
# /etc/automounts/home 
* -fstype=nfs,rw,bg,hard,intr,tcp fs.burgundywall.com:/tank/home/&
sudo automount -vc
ls /home/username

Update: I gave up and just added myself to a local group so that I can edit files on my webserver and get on with my life. Damn you apple.

# as root
dscl . create /Groups/apache gid 48 # where 48 is the group number on linux
dseditgroup -o edit -p -a kneufeld -t user apache # type in your root password
# open a new terminal window and it will have the new permissions
Category: tech, Tags: nfs, osx
Comments: 0
@ wrote... (10 years, 7 months ago)

Holy crap what a disappointment. I've been jonesing for an upgrade for about 6 months now (my current desktop is a Mac Mini 2009) and was eagerly awaiting an updated mini.

So the new mini has a new Ivy Bridge cpu. Whoop-dee-doo.

It only has one Thunderbolt port but at least it does have USB 3.

It only has Intel 4000 graphics. That's a crappy gpu that uses main memory. The reason I wanted a newer mini was so I could play a video game made in the last 5 years. As far as video games go, this mini is worse than the last one and only marginally better than my 3 year old one!

Looks like it's Hackintosh for me because this mini sucks.

Category: tech, Tags: hardware, osx
Comments: 0
@ wrote... (11 years, 2 months ago)

To autostart the very excellent SickBeard and SABnzbd on OSX (Snow Leopard in my case) you need to create two plist files and then tell launchd to start them.

more…

Category: tech, Tags: osx
Comments: 6
@ wrote... (12 years ago)

If you want to randomly change the wallpaper on mac osx you can use the built-in functionality. However, if you want to pick an image from a subdirectory you need to use this little script.

more…

Category: tech, Tags: osx
Comments: 0
@ wrote... (13 years, 1 month ago)

EventSync from fbevents.net is a great app to sync OSX iCal with Facebook. However, if you ever do something to your calendar and EventSync is no longer updating your calendar then do the following from a terminal.

rm -r "~/Library/Application Support/SyncServices/Local/clientdata/com.llsoftware.fbevents"
Category: tech, Tags: osx
Comments: 0
@ wrote... (13 years, 6 months ago)

Despite my previous post on how to get Time Machine backing up to a network drive, this turned out to be flaky. So far using iSCSI has been bomb proof and without having to do anything arcane, it is likely a lot more reliable.

more…

Category: tech, Tags: linux, osx
Comments: 0
@ wrote... (13 years, 7 months ago)

Open files with jEdit from the terminal is a pain. Here's a script to help.

more…

Category: tech, Tags: osx
Comments: 0
@ wrote... (14 years, 2 months ago)

I recently got one of the new mac mini's because it can finally run dual monitors. Yay Apple. Anyhow, this Time Machine thing sounded pretty cool so I kept trying to figure out how to get it to backup to my network drive but nothing seemed to work.

more…

Category: tech, Tags: osx
Comments: 0