Skip to content

Instantly share code, notes, and snippets.

Benjamin Esham bdesham

Block or report user

Report or block bdesham

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bdesham
bdesham / submit_urls.py
Last active Jun 19, 2019
Takes a sitemap file and submits each URL to the Wayback Machine
View submit_urls.py
#!/usr/bin/env python3
# Takes a sitemap file [1] and submits each URL to the Wayback Machine [2].
#
# Usage: python3 submit_urls.py sitemap.xml
#
# The script will contact the Wayback Machine for each URL in turn and request
# that it be saved [3]. The script prints (to standard output) the HTTP status
# code received from the Wayback Machine for each URL. The output looks like
# this:
@bdesham
bdesham / sort_timings.zsh
Created Feb 24, 2018
Takes a list of commands with timing information and lists the commands from longest- to shortest-running.
View sort_timings.zsh
#!/usr/bin/env zsh
# Takes a list of commands with timing information and lists the commands from
# longest- to shortest-running.
#
# The script reads from the filename given on the command line, or from
# standard input if no filename is given. The input is expected to look like
#
# +1518804574.3228740692 colors:76> local k
# +1518804574.3228929043 colors:77> k=44
@bdesham
bdesham / field.hs
Created Oct 14, 2017
Adding a new key to the context based on a metadata key
View field.hs
-- | Creates a new field based on the item's metadata. If the metadata field is not present then no
-- field will actually be created. Otherwise, the value will be passed to the given function and the
-- result of that function will be used as the field's value.
transformedMetadataField :: String -> String -> (String -> String) -> Context a
transformedMetadataField key itemName f = field key $ \item -> do
fieldValue <- getMetadataField (itemIdentifier item) itemName
return $ maybe (fail $ "Value of " ++ itemName ++ " is missing") f fieldValue
@bdesham
bdesham / 2015-03-10-test.md
Last active Aug 29, 2015
A minimal Jekyll site showing a behavior I can’t explain
View 2015-03-10-test.md
title date layout
Test post
2015-03-10 11:32:13 -0400
standard

This is one paragraph.

{% myblock %} This paragraph is in a custom block. {% endmyblock %}

@bdesham
bdesham / Obfuscate.hs
Last active Aug 29, 2015
Obfuscate text for use in web pages
View Obfuscate.hs
{-
Replaces each character with an HTML (or XML) escape code like "&#x20;". This is
useful as lightweight protection against email-address harvesting.
Example:
ghci> obfuscate "a@example.co"
"&#97;&#x40;&#101;&#x78;&#97;&#109;&#x70;&#x6c;&#101;&#x2e;&#99;&#111;"
Compare to the Clojure version: https://gist.github.com/bdesham/3327022
-}
@bdesham
bdesham / gist:e57582dbb4fee3d3d16d
Created Dec 24, 2014
stat(1) man page from OS X 10.10.1
View gist:e57582dbb4fee3d3d16d
STAT(1) BSD General Commands Manual STAT(1)
NAME
readlink, stat -- display file status
SYNOPSIS
stat [-FLnq] [-f format | -l | -r | -s | -x] [-t timefmt] [file ...]
readlink [-n] [file ...]
@bdesham
bdesham / bigfoot-and-mathjax.html
Last active Aug 29, 2015
MathJax and Bigfoot test
View bigfoot-and-mathjax.html
<!DOCTYPE html>
<html>
<head>
<title>MathJax and Bigfoot test</title>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<link rel="stylesheet" href="bigfoot-default.css"/>
<script src="https://raw.githubusercontent.com/lemonmade/bigfoot/master/dist/bigfoot.js"></script>
@bdesham
bdesham / keybase.md
Last active Aug 29, 2015
Keybase verification for GitHub
View keybase.md

Keybase proof

I hereby claim:

  • I am bdesham on github.
  • I am bdesham (https://keybase.io/bdesham) on keybase.
  • I have a public key whose fingerprint is E663 1535 1E9B 2ACF 357F 5C34 F533 D909 7997 4D79

To claim this, I am signing this object:

@bdesham
bdesham / test.html
Created Dec 18, 2013
A simple HTML file that demonstrates some font-rendering weirdness when used with Bigfoot (http://cmsauve.com/labs/bigfoot/).
View test.html
<!DOCTYPE html>
<head>
<title>This is a test</title>
<link rel="stylesheet" href="bigfoot-default.css" type="text/css"/>
</head>
<body>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam iaculis leo ac lacus pretium iaculis. Cras eget eros mauris. Vestibulum ac sapien malesuada, pulvinar odio vel, pellentesque lectus. Duis commodo nibh vel mi commodo consequat. Nam egestas gravida eros et bibendum. Praesent vel suscipit odio. Suspendisse dignissim arcu vitae sapien auctor, vitae auctor libero dapibus.<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup> Pellentesque sagittis, justo vitae mattis tristique, nibh neque convallis metus, a dapibus turpis nisl ut metus. Curabitur consectetur sodales mauris. Donec id vestibulum augue. Aliquam sollicitudin ligula in bibendum malesuada. Praesent tincidunt, purus sed semper vestibulum, purus nulla tempor nisi, vel tincidunt enim lectus et velit. Aenean rhoncus lectus non laoreet laoreet.</p>
@bdesham
bdesham / repetition.py
Created Sep 3, 2013
Visualizing song repetition with Python. For more information, see <http://www.bdesham.info/2013/09/visualizing-repetition>.
View repetition.py
#!/usr/bin/env python
# repetition.py
#
# Usage: python repetition.py input.txt output.svg
#
# Given a text file containing song lyrics, generates an SVG image showing the
# relationships between the lines of text. For more information, read the
# article at <http://www.bdesham.info/2013/09/visualizing-repetition>.
#
You can’t perform that action at this time.