Skip to content

Instantly share code, notes, and snippets.

@kmlawson
kmlawson / PDF-word-count.scpt
Last active December 18, 2015 15:08
Very simple pdf word count in Skim PDF reader using AppleScript. Assumes file you want word count for is open.
-- This is a really stripped down and simple version of
-- Daniel Shockley's DocInfo, which I had trouble getting
-- to work on pandoc converted unicode files.
-- Thanks to him for the original script:
-- DocInfo (for Skim)
-- version 1.0, Daniel A. Shockley, http://www.danshockley.com
-- http://www.danshockley.com/files/DocInfo.scpt
tell application "Skim"
set docName to name of document 1
@kmlawson
kmlawson / vim-life-word-count
Created May 15, 2013 13:32
Vimscript for a live word count. Mixed match code from stackoverflow and added check for empty file: http://stackoverflow.com/questions/114431/fast-word-count-function-in-vim
function! WC()
if getline(1) != ''
if &modified || !exists("b:wordcount")
let l:old_status = v:statusmsg
let position = getpos(".")
execute "silent normal g\<c-g>"
let b:wordcount = str2nr(split(v:statusmsg)[11])
let v:statusmsg = l:old_status
call setpos('.', position)
return b:wordcount
@kmlawson
kmlawson / anki1.0.rb
Created July 16, 2012 21:34
This open source script is for Mac OS X or Linux, with Ruby installed. You can run the script via the command line with "ruby anki1.0.rb" for example. This version of the script is very simple: it extracts certain statistics from your Anki decks (edit the
(*
Copyright 2009 Konrad M. Lawson
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of