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.

Keybase proof

I hereby claim:

  • I am gregnewman on github.
  • I am gregnewman (https://keybase.io/gregnewman) on keybase.
  • I have a public key ASCAJ4KZ5kQOkASpjYUSdDoa1agPP38rdn2UswJd9zsXSQo

To claim this, I am signing this object:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/4.1.2/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'run',
1 verbose cli 'watch' ]
2 info using npm@3.8.6
3 info using node@v5.10.1
4 verbose run-script [ 'prewatch', 'watch', 'postwatch' ]
5 info lifecycle @~prewatch: @
6 silly lifecycle @~prewatch: no script for prewatch, continuing
def page(self):
modules = self.object.course_instance.published_modules
for index, module in enumerate(modules):
if module == self.object:
prev_i = index - 1
next_i = index + 1
break
previous_module = modules[prev_i] if prev_i >= 0 else None
next_module = modules[next_i] if next_i < len(modules) else None

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
from django.contrib.contenttypes.models import ContentType
def run():
def do(Table):
if Table is not None:
table_objects = Table.objects.all()
for i in table_objects:
i.save(using='slave')
@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
<!DOCTYPE html>
<html lang="en" class="sub collection">
<head>
<meta charset="utf-8" />
<title>NeonMob &mdash; buy, trade, and sell digital collectibles with your friends.</title>
<link rel="stylesheet" type="text/css" href="/static/assets/css/signup.css?430" />
<link rel="icon" type="image/ico" href="/static/assets/img/favicon.png">