Skip to content

Instantly share code, notes, and snippets.

View wcaleb's full-sized avatar

W. Caleb McDaniel wcaleb

View GitHub Profile
@wcaleb
wcaleb / duesoon.sh
Created May 15, 2012 15:54
A shell script to remind me of tasks that are due soon, using this system: http://wcm1.web.rice.edu/plain-text-gtd.html
#!/bin/sh
TODAY=$(date +%m)
FILE=~/.duesoon
# This may be more complex than need be, but it permits months with or without leading zeroes
let THISMO=$TODAY-0
if [ $THISMO = 12 ]; then
let NEXTMO=01
else
@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.html
Created November 10, 2012 21:22
An example blog post in HTML
<html>
<head>
<title>Mode for Caleb: The lives of Douglass: Part II</title>
<style type="text/css">
body{margin:0px;padding:0px;background:#fff;color:#000000;font:1.5em "Trebuchet MS",Verdana,Arial,Sans-Serif;font-size:13px;}
a{text-decoration:none; color:#C4372D;}
a:hover{border-bottom:solid 1px;}
#logo{padding:0px;margin:0px;}
div#mainClm{float:right;width:60%;padding:30px 7% 10px 3%;border-left:dotted 1px #000;border-right:dotted 1px #000;text-align:left;border-bottom:dotted 1px #000;}
div#sideBar{width:200px;margin:20px;padding-top:20px;padding-left:5px;padding-right:5px;text-align:left;}
@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 / blookup.py
Last active March 20, 2020 22:10
Use OttoBib.com and ISBNdb.com to generate a formatted bibliographic citation from an author-title search string. More explanation here: <http://wcm1.web.rice.edu/get-citations-with-isbndb-and-ottobib.html>
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# blookup.py
# by Caleb McDaniel <http://wcm1.web.rice.edu>
# Uses ottobib.com and isbndb.com to turn an author-title search string
# into a formatted bibliographic citation.
# Example:
# blookup.py "blight race and reunion"
@wcaleb
wcaleb / docvert.py
Created April 28, 2013 19:43
Wrapper script for sending documents to Docverter.com using standard python libraries.
#! /usr/bin/env python
# -*- coding: utf-8 -*-
## docvert.py
## by W. Caleb McDaniel
## http://wcm1.web.rice.edu
## This is a wrapper script for sending documents to Docverter
## for conversion from markdown to PDF. It offers a python
## alternative to using cURL. For more information, see:
@wcaleb
wcaleb / iMDtoPDF.py
Last active December 29, 2020 07:52
iMDtoPDF
#! /usr/bin/env python
# -*- coding: utf-8 -*-
## iMDtoPDF.py
## by W. Caleb McDaniel
## http://wcm1.web.rice.edu
## This is a wrapper script for sending documents to Docverter
## for conversion from markdown to PDF using Pandoc. Typically
## Docverter calls are made with cURL; this script uses httplib.
@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 / GrandmaPics.py
Last active December 29, 2020 07:48
GrandmaPics
# Clear console
import console
console.clear()
print "Tap a photo to fetch a new one!"
print "Finding cute grandkid photos ..."
from scene import *
import urllib2
import random