Skip to content

Instantly share code, notes, and snippets.

View chauncey-garrett's full-sized avatar

Chauncey Garrett chauncey-garrett

View GitHub Profile
tell application "Aperture"
set mons to {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}
set digits to {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0"}
set ps to projects
repeat with p in ps
set nameStr to name of p
set yearNum to 0
set monthNum to 0
#coding: utf-8
import keychain
import console
import editor
import time
import re
import requests
import json
# Ways to execute a shell script in Ruby
# Example Script - Joseph Pecoraro
cmd = "echo 'hi'" # Sample string that can be used
# 1. Kernel#` - commonly called backticks - `cmd`
# This is like many other languages, including bash, PHP, and Perl
# Returns the result of the shell command
# Docs: http://ruby-doc.org/core/classes/Kernel.html#M001111
tell application "System Events"
tell process "Finder"
if window 1 exists then
tell application "Finder"
set thePath to get quoted form of POSIX path of (target of front Finder window as text)
return "cd " & thePath & return
end tell
else
display alert "Finder doesn't have a window open." as warning giving up after 2
end if
#!/usr/bin/env zsh
#
# Sym-link files to the bin dotfiles directory
#
local dir_current="$(pwd)"
local dir_bin="$HOME/.bin"
for file in "$@"
do
@chauncey-garrett
chauncey-garrett / vimless.sh
Created March 25, 2014 23:31
Use to replace less with vim for syntax highlighting, among other benefits...
# Add vi customization to less
VLESS=$(find /usr/share/vim -name 'less.sh')
if [ ! -z $VLESS ]; then
alias less=$VLESS
fi
inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a
function! s:align()
let p = '^\s*|\s.*\s|\s*$'
if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g'))
let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*'))
Tabularize/|/l1
normal! 0
call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
# alias last and save
# use `als c NAME` to chop off the last argument (for filenames/patterns)
als() {
local aliasfile chop x
[[ $# == 0 ]] && echo "Name your alias" && return
if [[ $1 == "c" ]]; then
chop=true
shift
fi
aliasfile=~/.bash_it/aliases/custom.aliases.bash
#!/bin/sh
#http://getpocket.com/import/instapaper
set -x
cat >> /tmp/import.html << "EOF"
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Instapaper: Export</title>
</head>