May 232016
 

Not entirely sure how I managed to hose my user directory, but I did, and it followed a boot into safe mode (reboot and SHIFT) in order to update an ancient MacPorts installation; homebrew sort of replaced that for my usage. OK, no biggie. I have back ups right? I do, but those back up in recent months have been based on Apple’s Time Machine. I changed to this from Carbon Copy Cloner by means of experiment. CCC has been bullet-proof, and I have always used it for family members, but there was something enticing about the seeming simplicity of Time Machine… something that is great for restoring files, but not so great, it turns out, for a full system restore. Suffice to say that a combination of backup solutions really is the way to go.

There’s no point in documenting the failures of Time Machine to restore my system “as was”, better to say that from a hosed user directory (specifically something with ~/Applications and ~/Library), and after several attempts to restore:

Boot into guest user account and copy busted ~ dir to an external spinning platter hd.

Get new drive from Amazon of the UK; not the best price, but next day delivery, and that is pretty important right now. The Old Crucial MX100 500 GB drive may or may not be fsked, but It has gone through A LOT of write cycles over the past two years, and I could do with an additional drive in case of future failures anyway, so not pissing about, got the Samsung Evo 850, 500GB, and a few dongles. Very happy with the purchases, actually.

sammy-850-evo

sammy-850-evo and accessories

New, clean OS X 10.11.5 install

Hey… it’s an opportunity to clear out years of crud… old compilers, settings weird dot files all sorts of “system shit” that’s accumulated over the past 12 freaking years, and more than a couple of Macs, and to throw out apps that haven’t been used in Lord knows how long. It’s a bit of a PITA, but I think less so, perhaps, than dealing with all the quirks of years of accumulated cruft.

———
With the Sammy external, CMD+R boot into recovery mode, and select install new OS on the Sammy. OS X check the validity of the current system on disk and then goes and downloads El Cap. in this case. About 4 hours. Boot from the external drive. Create new admin user, log into iCloud with AppleID, then install:
## Apps
* Dropbox
* 1password
* HMA
* Firefox
Lord only knows what add ons and such I had installed. I guess these will come back to me on an as-needed basis
¡¡¡ Carbon Copy Cloner !!!
Alfred 2 because this is the way my fingers now work. And somewhat amazingly, and old post of mine proves to be surprisingly useful, and that is sort of the purpose of this blog thingamajig.  http://stephen.yearl.us/alfred-2-workflows/
* Flycut
* homebrew
brew install git (and zsh, imagemagick, lame, openssl, lua, tokyo-cabinet, urlview, npm)
brew cask install macvim
brew cask install mactex
brew install dnscrypt –with-plugins
— MUCH MUCH MORE AS AND WHEN REQUIRED

TexStudio
Skim PDF Reader

AppCleaner
Grand Perspective
Transmission

Textmate,
bundles and packages to come later
nvAlt
Sublime Text 3
IA Writer

Skype
WhatsApp
VLC
Screenflow 5
Handbrake
Pixelmator
Boom 2

Parallels
add VMs later… win 10, win 95 (yeah, really!), PC-BSD

Karabiner
Hammerspoon
Maid — a gem — deal with gems later!

## “Files”
* copy over ~/.zshrc, ~/Documents, ~/Music (Launch iTunes… all good), ~/Pictures (launch Photos… all good)
And now a working system that sort of is mine, but is not. Much tweaking remains.

Parallels VMs (Win 98, Win 10, Ubuntu Gnome) — didn’t back these up. Oh well. Never really used them much anyway.

=====
To do:

Source Tree
Newer git tools? The whole git issue is going to be interesting when I get to look at that.
Mathematica 9 — lost the license key?

Fonts — Cousine, Nitti, Yale?, Ancient Greek, Office Code Pro…Computer Modern…??
color profiles
NTFS drivers and shit
Bit torrent Sync ?
Mega ?
Cloud app ?
Google drive?
Rubies and management
Rails, pythons etc.
npm, node js etc
macports? Quite possibly the thing that got me into this mess, but then again this is a fresh install

Fluid app — protonmail, gmail, dict.cc, keybr

Adobe — EEK!!

Jul 222015
 

For the longest time I have had caps lock set to “no action” in System Preferences >> Keyboard>> Modifier Keys:

caps-lock-no-action

 

But recently I’ve been playing with Vim (and also finally getting around to learning how to touch type) a little more now that I have some time on my hands, and decided that I needed an escape key that wasn’t such a PITA to get to without risking breaking my left pinkie. Enter Karibiner
 

Karabiner bindings are stored in  ~/Library/Application Support/Karabiner/private.xmlthe syntax of which is pretty easy to follow, and so I have entry in this file that maps caps lock to escape on the one hand, and also as a “hyper” modifier key when pressed in conjunction with certain other keys. The “code” for this is”
 

    <!--    the "hyper key"
           caps locks mapped to escape;
           used as a super modifier when when pressed in conjunction with other keys.
           keys modified with hyper to perform specic actions definied in:
           ~/Library/Application Support/Karabiner/private.xml
           ~/.hammerspoon/init.lua
           or Keyboard Maestro
           initial mapping of caps lock to F19 done in seil.appendix
   -->
    <item>
            <name>F19 to F19</name>
            <appendix>(F19 to Hyper (ctrl+shift+cmd+opt) + F19 Only, send escape)</appendix>
            <identifier>private.f192f19_escape</identifier>
            <autogen>
                --KeyOverlaidModifier--
                KeyCode::F19,
                KeyCode::COMMAND_L,
                ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L | ModifierFlag::CONTROL_L,
                KeyCode::ESCAPE
            </autogen>
        </item>

 

But, apparently, the caps lock key is a “special” key— at least on Macbook Pro keyboards, and some additional configuration needs be done before entries to Karabiner’s private.xml will take effect. The fundamental new mapping of caps lock is therefore done in seil  (a “utility for the caps lock key and some international keys in PC keyboards.”):

seil-mapping-caps-lock

 

Here it is mapped to OS X character code 80 (the F19 key). A complete list of OS X key codes can be seen by executing:
 

grep '^ *kVK’ /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Headers/Events.h|tr -d ,|while read x y z;do printf '%d %s %s\n' $z $z ${x#kVK_};done|sort -n
Jul 212015
 
Playing with Karabiner and searching for others’ keybindings has led me somewhat down the rabbit hole of window management on OS X. There seem to be a bunch, some light-weight, some heavy. Some under active development, others that seem to be abandoned.
managing windows can be a PITA, lots of precision dragging and resizing and all to get the windows into the desired position. Several window managers exist for OS X, and a short, short list would include:
 Slate seems to have been top dog for a while, but is no longer in active development. It would seem that it was replaced by mjolnir https://github.com/sdegutis/mjolnir/ which is not a window manager _per se_ but an automation enviroment (using Lua). Indeed a little like— and superseded by:
# hammerspoon: http://www.hammerspoon.org
Two videos showing the first, moom, and the latter, hammerspoon emulating moom-like behaviour:

Moom window placement:

Hammerspoon window placement:

The keyboard shortcuts in the hammerspoon example are predicated on setting up a “hyper” key, a meta modifier in Karabiner. More on that later.
Of course all these “auxiliary” apps that make life a little easier on OS X seem to want a place on the menu bar… and that leads into apps that tidy up that menu bar:
Apr 232015
 

So, with Apple’s release of OS X 10.10.3 on Monday came the new Photo’s “app”. In their misguided wisdom our cousins in Cupertino have continued along the path of dumbing-down Mac programs that are inching ever closer to their iOS equivalents.

Their consumer editing program was iPhoto, the “pro” version, Aperture. Both are to be replaced with the very iOS/iCloud looking Photos, and whilst iPhoto and Aperture could happily share the same photo library, Photos will not.

Once Photos is launched for the first time it will offer up a very nice, very slick import facility from you old libraries.
Photos_import

But what do we find when then opening Aperture, for example? This image dialogue of seeming impending doom and woe when you realise– as you already have, since you would not have launched Aperture so early in your review of Photos– that Photos is not quite the app you really wanted to manage you lovingly assembled photo library:

Screen Shot 2015-04-23 at 07.45.09

Ignore the Aperture Library. It was established the first time I launched Aperture. In actual fact I had Aperture and iPhoto happily using the iPhoto Library which scarily can no longer be found!

And the iPhoto equivalent, for reference:
Screen Shot 2015-04-23 at 08.02.01

Oh woes! I guess I will be restoring from backup!!

Except that I could not restore from backup as the size of my laptop’s SSD in relation to the size of the backup drive means that I can only keep one “most recent” backup. So I did some playing around.

After the import of the “iPhoto Library.photolibrary” Photos makes a new library called “Photos Library.photoslibrary”, but these are not really different in many ways. There are “hard” links (you can Google that yourself) between the contents of each library, they are not copies per se. Any changes one makes in iPhoto will to “iPhoto Library.photolibrary”. Any changes in Photos will be to “Photos Library.photoslibrary”

The upshot of this is one can still work in Aperture or iPhoto, and make edits. These will not be seen Photos, but if you want to see the changes made in Aperture/iPhoto reflected in Photos, you will have to delete, yes DELETE “Photos Library.photoslibrary”.

On next launch of Photos, it will think this is a new installation and ask again if you want to import.

It should go without saying that any changes you have made in Photos will be lost, so at some point you are going to have to make a choice. That choice may be an non-Apple product…. and . I would not be in the least bit surprised if at some point Adobe realises that it is really on to a winner here. Especially if it manages to sync its own library, your iPhoto/Aperture library, or libraries, Photo’s library, say certain web stores (Facebook, Instagram, Flikr, whatever), AND random directories on disk. Now how utterly awesome would that be?

I do not know if this process will work in reverse. I doubt it as iPhoto and Aperture are considered obsolete by Apple.

Sep 232014
 

I keep meaning to get around to do this, but never do. This evening I took a look at exercism.io and the installation of its CLI program had a homebrew option, so then was a good a moment as any, that and with the imminent relsease of OS 42 (X.10.10)…

$brew -v

==> 0.9.5

$sudo chown -R `whoami` /usr/local
$cd /usr/local
$git fetch origin
$git reset --hard origin/master
$brew cleanup
$brew upgrade

==> ALL OK!

$brew update

==> Err. re. tap … but mostly OK.
–exercism install–

$brew tap homebrew/binary
$brew install exercism

==> Err 🙁 “no available formula for exercism” “searching taps…”

$brew untap homebrew/binary
$brew upgrade
$brew update
$brewcleanup
$brew tap homebrew/binary
$brew install exercism

==> DICE

$exercism configure --key=MY_API_KEY

==>config at ~/.exercism.json
==> API key is in accounts at exercism.io

 

Jul 222013
 

I’ve been playing with Hazel a bit recently, mostly so I can get a handle on it to support others’ usage of a simple file automation/ housekeeping application. I like it, but it is somewhat limited in not allowed nested conditional and other basic logic statements. Anyway, what Hazel does is not much more– and very frequently less– that what I’ve been doing with ad hoc cron scripts. These are not very tidy having built built up over the years. And so I Googled and I found a x-platform, ruby based Hazel alternative in maid.

$ gem install maid

Well I get a slew of errors, so:

$ which ruby
/usr/local/bin/ruby
$ ruby -v
ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-darwin8.10.1]

This version corresponds to Apple’s default on early 2008 Macbook Pros which came preinstalled with Leopard (OS X 10.5). I guess this shows that although I am running Mountain Lion now on a mid-2012 MBP I have not had a clean OS install since April ’08, and I have never done so myself on my own machine. So, proof that:

  1. I am lazy?
  2. Upgrades work ‘plenty fine’, and Apple do a pretty good job in this regard?
  3. I’m scared of losing all the custom build of compilers, interpreters, symlinks, scripts in odd locations doing various things, settings galore… etc, etc. that make this machine mine?

Think I’ll persist on this path through Mavericks *then* start fresh with OS XI… if I am am still using an increasingly annoying Apple OS.

$ ls -la /usr/bin | grep ruby
lrwxr-xr-x     1 root   wheel        76 Jul 27  2012 ruby -&gt; ../../System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby
-rwxr-xr-x     1 root   wheel       450 Nov 18  2011 sqlite3_ruby

$ rvm -v
rvm 1.9.0 by Wayne E. Seguin ([email protected]) [https://rvm.beginrescueend.com]
$ ls -la /Users/yearlus/.rvm/rubies/
drwxr-xr-x   8 yearlus  yearlus  272 Oct 26  2011 ruby-1.9.2-p290

update rvm:

$ cd ~/.rvm/
$ \curl -L https://get.rvm.io | bash -s -- --version latest
$ rvm -v
A RVM version 1.21.13 is installed yet 1.9.0 is loaded.
 Please do one of the following:
  * 'rvm reload'
  * open a new shell

$ rvm reload
RVM reloaded!

$ rvm -v
rvm 1.21.13 (latest) by Wayne E. Seguin &lt;[email protected]&gt;, Michal Papis &lt;[email protected]&gt; [https://rvm.io/]

$ rvm use 1.9.2
Using /Users/yearlus/.rvm/gems/ruby-1.9.2-p290
$ which ruby
/Users/yearlus/.rvm/rubies/ruby-1.9.2-p290/bin/ruby

I could fsck with .profile, but will keep flexible for now. Could also use the default flag:

$ rvm use 1.9.2 --default
$sudo gem install maid
dyld: Library not loaded: /Users/sjy2/.rvm/rubies/ruby-1.9.2-p290/lib/libruby.1.9.1.dylib Referenced from: /Users/yearlus/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
Reason: image not found

oh brother!

$ rvm list known
$ rvm list
rvm rubies=&gt; ruby-1.9.2-p290 [ x86_64 ]
$ rvm install 1.9.1
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.8/x86_64/ruby-1.9.1-p431.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
You requested building with '/usr/bin/gcc-4.2' but it is not in your path.
[/cc]

Grrrr!

[cc_dos]$ sudo rvm requirements
Aborting
Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master
Failed to update Homebrew, follow instructions here: <a href="https://github.com/mxcl/homebrew/wiki/Common-Issues">https://github.com/mxcl/homebrew/wiki/Common-Issues</a> and make sure `brew update` works before continuing.
Requirements installation failed with status: 1

Following worked (outputs omitted):

$ chown -R yearlus $(brew --prefix)/.git
$ sudo chgrp -R admin /usr/local
$ sudo chmod -R g+rwx /usr/local
$ sudo chmod -R o-w /usr/local
$ cd /usr/local &amp;&amp; git reset --hard &amp;&amp; git clean -d -f/
$rvm requirements
$brew update
$ sudo gem install maid
$ sudo gem update

FINIS!!

Jun 152013
 

2016-05-23 update:

Due to recent woes I had to revisit Alfred Workflows… basically the below remains the same with the addition of:

http://www.packal.org/workflow/packal-updater
http://www.packal.org/workflow/datetime-format-converter
http://www.packal.org/workflow/toggle-keyboard-viewer
http://www.packal.org/workflow/leo-dictionary
http://www.packal.org/workflow/eggtimer-2
http://www.packal.org/workflow/units


Wolfram Alpha:

 

And behold! Easy access to a wealth of information, unit conversions, values for scientific formulæ and constants and the…


Timer:

http://dbader.org/blog/alfred-timer-extension

Very simple countdown timer. Nothing fancy, practically zero overhead.


Evernote:

 

http://www.alfredforum.com/topic/840-evernote-71-search-create-append-text-preview-and-more-all-within-alfred/


Onelook:

https://github.com/ChewingPencils/alfred_workflows

Searches http://www.onelook.com/

So:

  • olq QUERY == quick definition
  • olb QUERY == wildcard search http://www.onelook.com/?c=faq#patterns
  • olr QUERY == reverse lookup (lets you describe a concept and get back a list of words and phrases related to that concept.

Google Translate:

https://github.com/thomashempel/AlfredGoogleTranslateWorkflow

 

“Translate” + target lang code + phrase

 

 

Feb 172013
 

Compile of KDE4 keeps failing on FreeBSD 9.1 whether by

# cd /usr/ports/x11/kde4 # make install clean

or

# pkg_add -r kde4

after STOP tried

# cd /usr/ports/x11/xorg # make install clean

–> OK. Then:

# cd /usr/ports/x11/kde4 # make install clean

Works like a charm!

————————

 

⌘ – &#x2318; – &#8984; – Cmd
⌥ – &#x2325; – &#8997; – Opt / Alt
⇧ – &#x21E7; – &#8679; – Shift
⎋ – &#x238B; – &#9099; – ESC
⇪ – &#x21ea; – &#8682; – Capslock
⏎ – &#x23ce; – &#9166; – Return
⌤ –  Enter (⇧ + ⏎)
⌫ – &#x232b; – &#9003; – the Delete / Backspace symbol
⌦ – Forward-Delete (fn + ⌫)
⌃ – Control⇥ – Tab 

To enter unicode char point, select “Unicode Hex Input” in Input sources then, for e.g. ⌥+2318 for the ⌘ symbol.  Or double-click the relevant icon in Character Viewer.

ctrl+shift+ tab == cycle chrome tabs

[space] selects the os x dialog button with blue surround… makes it blue

cmd + D  –  don’t save os x dialog
⌘ + ` –  cycle through an apps windows
⌘ + L  –  focus Chrome address bar
⌘ + ⇧ + 4  –  screenshot
Cmd + right / left arrow  –  go to end / beginning of line
Control+Shift+Eject — shutoff screen 

 VLC:

E  – frame advance

shift+cmd+ left / right arrow – short jump back / forwards 

#opens finder at path:

]$ open /path/to/files

Very nifty when combined with Alfredopt+space &gt; open /path/to/files

————————-

Chrome’s web history is a sqllite db:

~/Library/Application\ Support/Google/Chrome/Default/Web\ Data

 select * from autofill where value like '%@%' order by value;

————————-

Clear Terminal:

$  rm ~/.bash_history<br />$ sudo rm /var/log/asl/*.asl<br />$ history -c<br />$ clear

On 10.8.2, I sporadically get multiple listings for installed apps in the contextual menu. Following fixes that… for a while.

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

————————–

If ye have a Mac and you need batch processing, like say the images in this post try sips in Terminal.app:

$ sips -Z 800 *.JPG -i -s format png --out /Users/yearlus/Desktop/SR-71-rocket-imgs/png

Which basically says take every jpeg in the current directory, make the longest axis 800 pixels (preserving aspect ratio), also create a PNG version, and copy the results to a directory on my desktop.

Feb 202012
 

Macs that support AirDrop ( must have OS X Lion):

MacBook Pro (Late 2008 or newer)*
MacBook Air (Late 2010 or newer)
MacBook (Late 2008 or newer)*
iMac (Early 2009 or newer)
Mac Mini (Mid 2010 or newer)
Mac Pro (Early 2009 with AirPort Extreme card, or Mid 2010)
* The MacBook Pro (17-Inch Late 2008) and the white MacBook (Late
2008) do not support AirDrop.

================
My early 2008 Macbook pro does not but….

defaults write com.apple.NetworkBrowser BrowseAllInterfaces 1
killall Finder && open /System/Library/CoreServices/Finder.app

and… Boomshaka!:

Enabling Airdrop on an early 2008 MBP

Enabling Airdrop on an early 2008 MBP

Feb 092012
 

So I borrowed a mate’s external USB superdrive in order to get some old files off of archived CDs, and the internal optical drive in my April ’08 MacBook Pro has long since shit the bed. Requirements for the drive suggest that an Air is required (Apple website, original packaging and a call to an Apple store), and sure enough when plugged into the MBP running Lion (10.7.2)… no dice.

I’ve been toying with geting some sort of Apple certification/credential, so I’ve a not unreasonable collection of old (and new tech docs from them). Reading through that I came to the following:

as root, edit:

/Library/Preferences/SystemConfiguration/com.apple.Boot.plist

after:

<key>Kernel Flag</key>

add entry:

<string>mbasd=1</string>

Recycle the machine…. and Boomshaka!

Social Widgets powered by AB-WebLog.com.