Skip to content

Instantly share code, notes, and snippets.

View wcaleb's full-sized avatar

W. Caleb McDaniel wcaleb

View GitHub Profile
@wcaleb
wcaleb / wikitweet.py
Last active August 29, 2015 14:21
Post a tweet when my research wiki is updated
#!/usr/bin/python
# I run a wiki on Gitit at http://wiki.wcaleb.rice.edu. It's usually
# updated by pushing to the wiki's remote git repo from my local machine.
# I have a `post-receive` hook in that repo that runs this script, like so:
#
# unset GIT_DIR
# python /path/to/wikitweet.py
#
# Now, whenever I push to the repo, the script looks to see which files have
@wcaleb
wcaleb / mail.vim
Created May 18, 2015 14:12
mail.vim customized for format=flowed; put in .vim/ftplugin directory
" Vim filetype plugin file
" Language: Mail
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2009 Jun 03
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
@wcaleb
wcaleb / pandoc-webpage.py
Created October 29, 2012 21:29
My first python script, using pandoc to convert a webpage to markdown
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# pandoc-webpage.py
# Requires: pyandoc http://pypi.python.org/pypi/pyandoc/
# (Change path to pandoc binary in core.py before installing package)
# TODO: Preserve span formatting from original webpage
import urllib2
import pandoc
from bs4 import BeautifulSoup
@wcaleb
wcaleb / frederick-douglass.txt
Created November 10, 2012 21:24
An example blog post in markdown
The lives of Douglass: Part II
------------------------------
Originally posted on Tuesday, December 21, 2004
As I explained in [Part
I](http://modeforcaleb.blogspot.com/2004/12/lives-of-douglass-part-i.html),
Frederick Douglass's
[*Narrative*](http://sunsite.berkeley.edu/Literature/Douglass/Autobiography/)
marked the highpoint of his collaboration with the radical abolitionists
@wcaleb
wcaleb / calebpost.txt
Created November 21, 2012 02:00
The output of my python script, which uses pandoc to convert a list of webpages to markdown
The first twenty minutes
------------------------
Originally posted on Tuesday, August 30, 2005
Yesterday was the first day of class for the Introduction to U. S.
History that I am teaching this fall. (Here's the
[syllabus](https://jshare.johnshopkins.edu/wmcdani2/public_html/syllabus205.pdf)
I'm using; suggestions for future iterations are welcome!)
@wcaleb
wcaleb / docverter-error
Created May 5, 2013 00:56
Error response from Docverter for following command: curl http://c.docverter.com/convert -F from=markdown -F to=pdf -F smart=true -F input_files[]=@pandoc-on-ios.txt
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>RuntimeError at &#x2F;convert</title>
<script type="text/javascript">
//<!--
function toggle(id) {
var pre = document.getElementById("pre-" + id);
@wcaleb
wcaleb / gist:6354288
Last active December 21, 2015 19:29
Fix for Chicago fullnote CSL to put commas after author's name. Replace lines 970-979 of chicago-fullnote-bibliography-no-ibid.csl with these lines.
<group delimiter=", ">
<group delimiter=" ">
<group suffix=", ">
<text macro="contributors-note"/>
</group>
<group delimiter=", ">
<text macro="title-note"/>
</group>
<text macro="description-note"/>
</group>
@wcaleb
wcaleb / Pong.py
Created December 29, 2013 20:20
Pong
from scene import *
import random
BALL_RADIUS = 20
POINT_RADIUS = 5
GUTTER = 120
PAD_WIDTH = 100
PAD_HEIGHT = 20
HALF_PAD_WIDTH = PAD_WIDTH / 2
HALF_PAD_HEIGHT = PAD_HEIGHT / 2
@wcaleb
wcaleb / tweets318.json
Created January 14, 2014 16:30
Sample JSON for HIST 318
{"tweet1":
{
"username":"wcaleb",
"date_sent":"January 14, 2014",
"text":"I heart Cheerios.",
"hashtags": [],
"coordinates": null,
"has_image":false
},
"tweet2":
@wcaleb
wcaleb / json-exhibits.json
Created January 15, 2014 21:42
JSON validity exercises
### Sample JSON
#### Exhibit A
{"search":{
"field": null,
"hits": 1901,
"sort_order": null,
"do_facets": true,
"focus_item": null,