Skip to content

Instantly share code, notes, and snippets.

View ndw's full-sized avatar

Norman Walsh ndw

View GitHub Profile
@ndw
ndw / utftest.pl
Created September 29, 2010 17:08
Simple Perl script to find UTF8 encoding errors in documents
#!/usr/bin/perl -- # -*- Perl -*-
use strict;
use Encode qw/encode decode/;
my $file = shift @ARGV || "-";
my $count = 0;
open (F, $file);
while (<F>) {
virgin forest and Toman, František Ladislav Čelakovský night before the St. John Toman sister speaks:" Where you go, my dear brother, at this late at night while the hobby sedlaném, pure gaudy? " "The hunters I have to Podhájí to their děvčici, suddenly I stand, I again wait for dawn. Dej, sister, give new košiličku fine linen, kamizolku pink." A spark fell below the hobby, the nurse calls the brother: "Hear, Tomanek, my advice, do not give the oak: ordered mine on the Holy Mount, after I have let you mount,'d rather give up the struggle, let my heart hurts." Toman oak did not go, he is the right path, and the hunters Podhájí new house a candle, by many together, filled parlor talk. Toman sadness is surrounded by windows with a horse loving girl melts, the groom is smiling and the father is courting the mother of sight operation. They ate, drank, talked, had a good will together, no heed to nothing, the horse that zařehtal out, and boy sighed. Our only coupled suddenly flushed, her conscience still pushing ha
@ndw
ndw / solarize-definitions-edits.el
Created January 17, 2012 21:02
My updates to the Gnus section of solarized-definitions.el
;; gnus
(gnus-cite-1 ((t (:foreground ,magenta))))
(gnus-cite-2 ((t (:foreground ,base2))))
(gnus-cite-3 ((t (:foreground ,base3))))
(gnus-cite-4 ((t (:foreground ,base1))))
(gnus-cite-5 ((t (:foreground ,magenta))))
(gnus-cite-6 ((t (:foreground ,base2))))
(gnus-cite-7 ((t (:foreground ,base3))))
(gnus-cite-8 ((t (:foreground ,base1))))
(gnus-cite-9 ((t (:foreground ,base2))))
@ndw
ndw / fixlj.pl
Created March 8, 2012 18:48
Patch unique identifier in Linux Journal EPUB files
#!/usr/bin/perl -- # -*- Perl -*-
# Fixes the bookid identifier in Linux Journal EPUB files.
# No warranty. YMMV. etc.
use strict;
use English;
use Cwd qw(abs_path);
use File::Temp qw(tempdir);
@ndw
ndw / gist:6300931
Created August 21, 2013 22:12
HTML5 "best practice"?
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
...
</head>
<body>
...
@ndw
ndw / renamezip.xpl
Created December 11, 2013 16:25
This pipeline copies a ZIP file, renaming "README.md" to "README.txt". It requires XML Calabash 1.0.16 or later (because there are a couple of bugs in earlier versions of the zip/unzip implementations).
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
xmlns:cx="http://xmlcalabash.com/ns/extensions"
xmlns:c="http://www.w3.org/ns/xproc-step"
xmlns:pxp="http://exproc.org/proposed/steps"
name="main" version="1.0">
<p:input port="parameters" kind="parameter"/>
<p:output port="result">
<p:pipe step="zip" port="result"/>
</p:output>
<p:serialization port="result" indent="true"/>
@ndw
ndw / keybase.md
Created September 18, 2014 07:50
Proving my keybase.io identity.

Keybase proof

I hereby claim:

  • I am ndw on github.
  • I am ndw (https://keybase.io/ndw) on keybase.
  • I have a public key whose fingerprint is 645D 8055 B685 E0EC 3B0B B507 3B29 6D51 CC18 5A3B

To claim this, I am signing this object:

@ndw
ndw / pipeline trace
Last active August 29, 2015 14:24
XML Calabash 2.0.0's first pipeline
XML Calabash 2.0.0 just successfully ran its first pipeline!
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="1.0"
xmlns:c="http://www.w3.org/ns/xproc-step"
xmlns:cx="http://xmlcalabash.com/ns/extensions"
xmlns:exf="http://exproc.org/standard/functions"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-inline-prefixes="cx exf xs"
name="main">
<p:output port="result"/>
@ndw
ndw / gist:b14ee530692faf5ca41c
Created October 23, 2015 03:23
Verifying myself on onename.com
Verifying that +ndw is my blockchain ID. https://onename.com/ndw
@ndw
ndw / icaldiary.py
Created May 2, 2019 13:37
Create an emacs diary file out of Mac calendars
#!/usr/bin/env python
import icalendar
from icalevents.icalevents import events
from datetime import datetime, timezone, timedelta
from dateutil.tz import UTC, gettz
import re
import tzlocal
import pytz
import os