Skip to content

Instantly share code, notes, and snippets.

View keith's full-sized avatar

Keith Smiley keith

View GitHub Profile
@keith
keith / fish_prompt.fish
Created February 17, 2014 02:37
Mimicking %2c from zsh
set __pwd (pwd)
set __parent (basename (dirname $__pwd))
set __current (basename $__pwd)
set __full (printf "%s/%s" $__parent $__current)
set __home (echo $HOME | awk '{ print substr($1, 2, length($1) - 1); }')
set __prompt (echo "$__full" | sed -e "s|$__home|~|" -e "s|$USER|~|" -e "s|^///|/|" -e "s|^//|/|")
@keith
keith / objcvim.md
Last active August 29, 2015 13:57
Some thoughts about a Vim plugin for Objective-C developement
  • Create new classes
    • Which project when multiple projects?
      • Not running from folder that actually has the project
        • Look in current dir
        • Look at top of git/hg/svn repo (code from investigate)?
        • Ask for path?
      • Set default project in cache?
        • Cache location local directory
      • When asking projects complete file path
  • Ask if it should default
@keith
keith / links.txt
Last active August 29, 2015 14:06
emacs for vim users
@keith
keith / search_buffers.vim
Last active August 29, 2015 14:09
Filter buffers through selecta
function! Buffers()
let ids = filter(range(1, bufnr('$')),
\ 'empty(getbufvar(v:val, "&bt"))'
\ . ' && getbufvar(v:val, "&bl")')
let names = []
for id in ids
call add(names, bufname(id))
endfor
return join(names, "\n")
@keith
keith / gist:cc2307b81ee1270c64f3
Created January 19, 2015 18:59
NSWindow APIs
http://stackoverflow.com/questions/5286274/front-most-window-using-cgwindowlistcopywindowinfo
http://stackoverflow.com/questions/13426488/notification-of-active-document-change-on-os-x
https://github.com/ianyh/Amethyst/blob/master/Amethyst/AMWindowManager.m
http://stackoverflow.com/questions/12540010/how-to-identify-window-under-mouse-with-objective-c
http://stackoverflow.com/questions/15612050/cocoa-objective-c-how-to-know-which-control-is-under-the-cursor
https://github.com/jigish/slate/blob/ff5ee5a53afc05b619cf9eb78e852b83ad714de4/Slate/RunningApplications.m
http://stackoverflow.com/questions/853833/how-can-my-app-detect-a-change-to-another-apps-window
@keith
keith / Installation.md
Last active August 29, 2015 14:15
Instructions for setting up a Beowulf cluster (use at your own risk)

Installation

  1. Shut down the machine and insert a USB drive with the Ubuntu 10.04 64 bit installation disk.

  2. (Re)Boot the machine and press F12 (on Dell Optiplex 960) during the BIOS loading

  3. Choose USB drive from the list of boot devices.

    • If the machine continues to boot go back to step 2
  4. Once Ubuntu starts up choose 'Install Ubuntu 10.04 LTS' (Desktop LTS ending April 2013)

  5. Choose your timezone and keyboard layout

@keith
keith / OverrideExtension.swift
Created June 25, 2015 18:15
Overriding Extensions bug fixed in Swift 2.0
import UIKit
extension UIView {
public override var accessibilityLabel: String? {
get {
return "Hi \(super.accessibilityLabel)"
}
set {
super.accessibilityLabel = newValue
}
@keith
keith / maildir
Created July 25, 2015 16:47
Archive or delete maildir messages
#!/bin/bash
set -e
mail=~/.mail
maildirs=($mail/*)
inbox=INBOX
folders=(new cur)
archive="archive/cur"
trash="trash/cur"
@keith
keith / NSEventExtensions.swift
Created February 23, 2015 21:11
A NSEvent extension for changing event charactters
extension NSEvent {
func eventByChangingKeyToKey(key: Int) -> NSEvent? {
var char = unichar(key)
let characterString = NSString(characters: &char, length: 1)
return NSEvent.keyEventWithType(type,
location: locationInWindow,
modifierFlags: modifierFlags,
timestamp: timestamp,
windowNumber: windowNumber,
@keith
keith / v
Created September 30, 2015 02:39
vim profiling helper executable
#!/bin/sh
exec vim --startuptime ~/.cache/vim/"$(date -j -f "%a %b %d %T %Z %Y" "$(date)" "+%s")".log "$@"