Skip to content

Instantly share code, notes, and snippets.

View gregnewman's full-sized avatar

Greg Newman gregnewman

View GitHub Profile
@gregnewman
gregnewman / pyenv+direnv on OSX.md
Created June 18, 2021 13:07 — forked from alexhayes/ pyenv+direnv on OSX.md
Awesomely easy virtualenvs on OSX using pyenv and direnv

Awesomely easy virtualenvs on OSX using pyenv and direnv

Never forget to activate that virtualenv or set that environment variable ever again...

Install

  1. Install pyenv

     brew install pyenv
    
@gregnewman
gregnewman / websters-kindle.mdown
Created August 21, 2017 19:29 — forked from jsomers/websters-kindle.mdown
How to make the Webster's 1913 your default Kindle dictionary

How to make the Webster's 1913 your default Kindle dictionary

  1. Download a Kindle-compatible version of the dictionary here. Unzip the .rar archive.

  2. Get the "Send to Kindle" program on your computer. Here's the link for the Mac.

  3. Right-click your recently downloaded (unzipped) dictionary file, and click the "Send to Kindle" menu item. It will arrive on your Kindle shortly.

  4. Once the dictionary has arrived, go to your settings -- on my newish paperwhite, it's at Home > Settings > Device Options > Language and Dictionaries > Dictionaries > English. Choose the Webster's 1913.

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@gregnewman
gregnewman / gist:3698697
Created September 11, 2012 13:58 — forked from al3xandru/gist:1169583
OmniFocus Generalized Bookmarklet
javascript:(function(){
var w=window,d=document,selectedTxt=w.getSelection?w.getSelection():(d.getSelection)?d.getSelection():(d.selection?d.selection.createRange().text:0),pageUri=w.location.href,isGMail=w.location.host.match(/mail\.google\.com/),subject=d.title,source;
if(isGMail){
var msgFrm=d.getElementById("canvas_frame"),subjectSpans;
if(msgFrm){
subjectSpans=msgFrm.contentDocument.getElementsByClassName("hP");
if(subjectSpans)subject=subjectSpans[0].innerText;
};
if(!subjectSpans){
subject=d.title.substring(d.title.indexOf("-")+1,d.title.lastIndexOf("-")).replace(/^%20+/,"").replace(/%20+$/,"")
@gregnewman
gregnewman / gist:2932735
Created June 14, 2012 20:26 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
#!/usr/bin/env ruby -w
# brew-services(1) - Easily start and stop formulas via launchctl
# ===============================================================
#
# ## SYNOPSIS
#
# [<sudo>] `brew services` `list`<br>
# [<sudo>] `brew services` `restart` <formula><br>
# [<sudo>] `brew services` `start` <formula> [<plist>]<br>
>>> import appscript
>>> things = appscript.app("Things")
>>> things.lists.get()
[app(u'/Applications/Things.app').lists.ID(u'FocusInbox'),
app(u'/Applications/Things.app').lists.ID(u'FocusToday'),
app(u'/Applications/Things.app').lists.ID(u'FocusNextActions'),
app(u'/Applications/Things.app').lists.ID(u'FocusTickler'),
app(u'/Applications/Things.app').lists.ID(u'FocusMaybe'),
app(u'/Applications/Things.app').lists.ID(u'FocusActivityLevel-1'),
app(u'/Applications/Things.app').lists.ID(u'FocusLogbook'),
emacs -q --eval '(condition-case err (progn (load "~/.emacs") (kill-emacs 0)) (error (kill-emacs 1)))'
# Source http://groups.google.com/group/gnu.emacs.help/browse_thread/thread/bed5b2bd8b237f5a?pli=1
<style type="text/css" media="screen print">
* {
font-family: Helvetica,Arial,sans-serif;
font-size: 8px;
}
table {
border-collapse: collapse;
}
</style>
@gregnewman
gregnewman / license
Created January 27, 2010 10:34 — forked from defunkt/license
#!/bin/sh -e
# Usage: license
# Prints an MIT license appropriate for totin' around.
#
# $ license > COPYING
year=`date "+%Y"`
cat <<EOF
Copyright (c) $year Chris Wanstrath
Permission is hereby granted, free of charge, to any person obtaining