Skip to content

Instantly share code, notes, and snippets.

View eager's full-sized avatar

Christian Eager eager

View GitHub Profile

Keybase proof

I hereby claim:

  • I am eager on github.
  • I am eager (https://keybase.io/eager) on keybase.
  • I have a public key ASDVDU6jd8r-lo99UPDpY7hJZQVu-zExwi27Zt--W00ePAo

To claim this, I am signing this object:

@eager
eager / Copy as GitHub-Flavored Markdown.sh
Created March 20, 2014 21:04
Sequel Pro Bundle scripts
# Bundle Scope: Data Table
# Menu Label: Copy as GFM
# Menu Category: Copy
# Input: Selected Rows (TSV) AND exclude BLOB
# Tooltip: Copies the selected rows excluding any BLOB data GitHub-Flavored-Markdown table-formatted into the pasteboard
cat | perl -e '
# read first line to get the column names (header)
$firstLine = <>;
@eager
eager / gist:2362276
Created April 11, 2012 20:29
Example ThisService script using node and LMGTFY
#!/usr/local/bin/node
// Unfortunately, /usr/bin/env node doesn’t work if node is in /usr/local/bin
var spawn = require('child_process').spawn,
textutil = spawn('textutil', ['-stdin', '-stdout', '-format', 'html', '-convert', 'rtf'])
pbcopy = spawn('pbcopy')
textutil.stdout.pipe(pbcopy.stdin)
process.stdin.resume()
#!/usr/local/bin/node
// ThisService node.js service script example, by Christian Eager
// Service type: Acts on input
//
// Node.js does *not* ship with OS X
// Download and installation instructions are available at http://nodejs.org
process.stdin.resume()
// Makes the data event emit a string instead of a Buffer
@eager
eager / gist:2301786
Created April 4, 2012 14:30
Change auto-hiding Mac OS X Dock show delay to 0
# From http://hints.macworld.com/article.php?story=20120326061614691
defaults write com.apple.Dock autohide-delay -float 0 && killall Dock
@eager
eager / gist:1314108
Created October 25, 2011 20:17
Bash colorized outputs
#!/bin/bash
# Text color variables
txtund=$(tput sgr 0 1) # Underline
txtbld=$(tput bold) # Bold
txtred=$(tput setaf 1) # Red
txtgrn=$(tput setaf 2) # Green
txtylw=$(tput setaf 3) # Yellow
txtblu=$(tput setaf 4) # Blue
txtpur=$(tput setaf 5) # Purple
@eager
eager / safe_mv.sh
Created July 23, 2011 20:47
A bash function for moving a file to a folder, using a sequential rename if the file already exists.
#!/bin/sh
# Usage: safe_mv dir1/file.txt dir2
# If dir2 contains "file.txt", the moved file will be renamed to "file1.txt"
function safe_mv() {
FULL_PATH=$1
FILE_NAME=$(basename $FULL_PATH)
FILE_NAME_WITHOUT_EXT=${FILE_NAME%.*}
EXT=${FILE_NAME#*.}
# Trim any trailing slashes
@eager
eager / gitproxytoggle.rb
Created July 23, 2011 00:54
Toggle git proxies on and off
#!/usr/bin/env ruby -w
require 'fileutils'
module Git
class Setting
attr_reader :key
attr_reader :value
attr_reader :text
@eager
eager / gist:786477
Created January 19, 2011 17:20
Resize a Fake.app window with AppleScript
set myHeight to 600
set myWidth to 800
tell application "Fake"
set theWindow to window 1
-- bounding rect is { left, top, right, bottom }. The index is one-based.
-- Note: this is the size of the window. The actual viewport size will be smaller.
set theBounds to the bounds of theWindow
set (item 3 of theBounds) to ((item 1 of theBounds) + myWidth)
set (item 4 of theBounds) to ((item 2 of theBounds) + myHeight)
# Cycle all npm packages
npm ls installed | ack -o '^(?!npm)[\w-]+'