Ramblings of Boback

Designer - Techie - Geek & Nerd

Learning Apple Swift

Ever since Apple announced Swift at the WWDC 2014, I’ve been really excited about jumping back into programming. Especially since I can actually understand the syntax, unlike the mind fuck that was Objective C. Also, bare in mind I haven’t coded anything since 2001.

I have all these ideas which are interesting to me, and not any other iOS developer who has offered to join forces with me. Usually the conversation goes like this:

Crash Course in Photoshop for iOS Developers

Jared Sinclair gives iOS developers a quick course in Photoshop.

Beware the following caveat: this is an article about tools, not design. If this were an article about ice sculpture, it would teach you how to turn on the chainsaw. It’s up to you to sculpt an angel without losing a limb.

I like the way he hammers this statement. Made me chuckle.

Terminal Utilities Every Power User Should Know

Eight Terminal Utilities Every OS X Command Line User Should Know

The OS X Terminal opens up a world of powerful UNIX utilities and scripts. If you’re migrating from Linux, you’ll find many familiar commands work the way you expect. But power users often aren’t aware that OS X comes with a number of its own text-based utilities not found on any other operating system. Learning about these Mac-only programs can make you more productive on the command line and help you bridge the gap between UNIX and your Mac.

I consider considered myself a power user, and I only knew 4 of them…

Select and Copy Text Within Quick Look Previews

Open Terminal App, and paste this:

defaults write com.apple.finder QLEnableTextSelection -bool TRUE; killall Finder

to revert back, paste this:

defaults delete com.apple.finder QLEnableTextSelection; killall Finder

Job Done!

Re-enabling Sudo Complete on Ubuntu

I recently upgraded my XBMCUbuntu box to Frodo (v12) but a few things went missing. One of them was auto service/file completion after the “sudo” command. Quite frustrating.

But I found this little snippet of code to fix it.

complete -cf sudo

or you could put this in your “.bachrc”

if [ "$PS1" ]; then
complete -cf sudo
fi

Enable Debug Mode in Disk Utility on OS X

If you want to find out all the hidden partitions, you need to enable this. Also a good way of finding out if you have a Recovery HD partition or not.

Quit Disk Utility and open Terminal, then paste/type:

defaults write com.apple.DiskUtility DUDebugMenuEnabled 1

That’s it.

Couple of Ways to Wipe “Locked” HDs on Macs

If you use “corporate” Macs, you’ll often get frustrated with their “in-house builds” of OS X. The solution is to wipe the Mac, and install a clean OS.

But some have started to lock the HDs. So here are two ways to get around this.

Route one is to copy ZERO data blocks to the sectors of the Macs HD. You have to boot from Recover Disk/USB, and launch Terminal

dd if=/dev/null of=/dev/disks1 bs=512

Route two is a little different, but I’ve only tested Route 1. So if 1 doesn’t work, try 2.

sudo chflags 0 /Volumes/*
sudo chmod a+rx /Volumes/*

After that, you’re free to format the drive and install a clean OS… Ahhh.. Clean OS.

Take Screenshots Using Terminal

Take a screenshot from Terminal and automatially open it in mail ready to be sent.

screencapture -W -M mailme.jpg

You can click a window, and it’ll just grab that window

Also, do:

screencapture -h

Ton of options.

Protecting Zip Files With a Password in OS X

To create a password protected file in OS X, open Terminal, go to your folder, then :

The syntax is zip -e [archive] [file]

Example

zip -e foobar.zip *.txt
Enter password:_
Verify password:_

Done ;)

Removing Multiple ‘Open With’ Entries in OS X Finder

Launch terminal and paste

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user

Once the process is finished (sometimes it takes a while), you need to restart Finder via this code:

killall Finder

Job done.

Warren G. And Nate Dogg’s “Regulate” Synopsis

On a cool, clear night (typical to Southern California) Warren G travels through his neighborhood, searching for women with whom he might initiate sexual intercourse. He has chosen to engage in this pursuit alone.

Nate Dogg, having just arrived in Long Beach, seeks Warren. Ironically, Nate passes a car full of women who are excited to see him. He insists to the women that there is no cause for excitement.

How to Convert FLAC to MP3, Ubuntu Command Line

This worked great, but make sure you have “lame” and “flac”

sudo apt-get install flac
sudo apt-get install lame

Then in the folder with all the .flac files:

for f in *.flac; do flac -cd "$f" | lame -b 320 - "${f%.*}".mp3; done

How to Run a Shell Script Using Spotlight

Save your shell script with a .command suffix – this makes it double-clickable and you should also be able to run it directly from Spotlight too.

Relauch Dock/Finder/Menu Bar From Terminal

Annoying things that often happen

The Finder crashed:

killall -KILL Finder

The Dock crashed:

killall -KILL Dock

Spaces crashed:

killall -KILL Dock

The Menubar crashed/refuses to be clickable:

killall -KILL SystemUIServer

Enabling PHP in OS X Lion

Edit your

/etc/apache2/httpd.conf

and make sure the line:

LoadModule php5_module libexec/apache2/libphp5.so

exists. By default in the standard OS X config, you just need to uncomment it, then re-start Apache:

sudo apachectl restart

And you should be good to go.