Skip to content

Instantly share code, notes, and snippets.

View dsanson's full-sized avatar

David Sanson dsanson

View GitHub Profile
@dsanson
dsanson / extract_pandoc_bib.sh
Created August 29, 2011 03:33
produce a bibtex file with only the pubs referred to by a pandoc file
#!/bin/sh
# Generate a bibtex file just containing those publications cited in
# a given pandoc document. To use
#
# extract_pandoc_bib.sh myfile.markdown
#
# this will generate `myfile.bib`.
bib="$HOME/.pandoc/default.bib"

Here is a header

Turns out it is not just headers that aren't getting treated right. Here is some text in italics. And some bold text.

And here is another header

And another header

And another header

@dsanson
dsanson / any2pandoc.sh
Created August 30, 2011 17:52
any2pandoc.sh: script that tries to convert documents thrown at it to pandoc's extended markdown
#!/bin/sh
# any2pandoc.sh
#
# A shell script that tries its best to convert documents thrown at it
# to pandoc's extended markdown.
#
# https://gist.github.com/1181510
#
# Depends on:
@dsanson
dsanson / bibtex2markdown.rb
Created August 30, 2011 20:58
bibtex2markdown: a script for generating markdown formatted bibliographies from bibtex files using pandoc and citeproc
#!/usr/bin/env ruby
#
# This script is a wrapper around pandoc that uses pandoc's
# builtin citeproc support to generate a markdown bibliography
# from bibtex.
#
# Inspired by Jacob Barney's [bib2mkd][] script.
#
# [bib2mkd]: http://jmbarney.dyndns.org/?/linux/bib2mkd/
#
Error detected while processing function pandoc#Pandoc_Complete..pandoc#Pandoc_BibKey:
line 71:
Traceback (most recent call last):
Error detected while processing function pandoc#Pandoc_Complete..pandoc#Pandoc_BibKey:
line 71:
File "<string>", line 52, in <module>
Error detected while processing function pandoc#Pandoc_Complete..pandoc#Pandoc_BibKey:
line 71:
File "/Library/Python/2.7/site-packages/pybtex/database/input/__init__.py", line 45, in parse_file
@string{jgr = "J.~Geophys.~Res."}
@MISC{Primes,
author = "Charles Louis Xavier Joseph de la Vall{\'e}e Poussin",
note = "A strong form of the prime number theorem, 19th century",
year = 1879
}
@INBOOK{chicago,
title = "The Chicago Manual of Style",
#!/usr/bin/env ruby
require 'bibtex'
match = ARGV.join(" ")
bibfile = "/Users/david/.pandoc/default.bib"
bib = BibTeX.open(bibfile)
bib.delete('@comment') #Avoid false hits in comments
#!/usr/bin/env ruby
require 'bibtex'
match=ARGV[0]
bibfile = '/Users/david/.pandoc/default.bib'
smallbib = `bibtool -i #{bibfile} -- 'select{$key title booktitle author editor "#{match}"}'`
@dsanson
dsanson / voicesms.rb
Created September 8, 2011 19:34
Brett Terpstra's voicesms.rb command: send sms messages from the command line via google voice. Original here: http://brettterpstra.com/sms-from-the-command-line-with-google-voice/
#!/usr/bin/env ruby -Ku
require 'net/http'
require 'net/https'
require 'open-uri'
require 'cgi'
require 'optparse'
require 'jcode' if RUBY_VERSION < '1.9'
ACCOUNT = '' # Set to Google Voice account email for default account
@dsanson
dsanson / vimshortcuts.html
Created September 8, 2011 20:34
an HTML VIM movement cheatsheet for use with NerdTool
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
This is an HTML version of a great [VIM movements cheatsheet][] designed by Ted Naleid.
I made this because I wanted more control over the way the text was displayed, and I'd rather tweak CSS than mess with Omnigraffle. If you just want Ted's graphic overlaid on your desktop, you should download the [transparent version] of the VIM movements cheatsheet.
I use it with [NerdTool][]. Sadly, NerdTool can't overlay transparent HTML. So I supply a background-image URL. You'll want to change that to something on your local filesystem. Here is a [screenshot][] of the results. The background image is taken from the always great [Bibliodyssey][], resized to the size of my screen.