Skip to content

Instantly share code, notes, and snippets.

View nicferrier's full-sized avatar

Nic Ferrier nicferrier

View GitHub Profile
nicferrier / gist:49f34d6936814a457331
Created October 30, 2014 04:36
gpging the custom file
;; read the gpg agent file and set the env vars
(let ((gpg-agent-file (expand-file-name "~/.gpg-agent-info")))
(when (file-exists-p gpg-agent-file)
(message "import gpg agent file")
(lambda (line)
(unless (equal line "")
(apply 'setenv (split-string line "="))))
nicferrier / app.js
Created May 4, 2015 22:35
nic's presentation stuff
simple little javascript to make org-mode presentations
export your org-mode to HTML with this at the end:
#+HTML: <script src="app.js"></script>
I also go to town and use a nice stylesheet.
Publish it with elnode with M-x elnode-make-js-server
nicferrier / lexical-sentinel.el
Created September 29, 2011 20:58
macro for doing lexically scoped sentinels
;;; -*- lexical-binding: t -*-
(defmacro with-process-shell-command (name buffer command &rest sentinel-forms)
`(let ((proc (start-process-shell-command ,name ,buffer ,command)))
(let ((sentinel-cb (lambda (process signal)
(set-process-sentinel proc sentinel-cb)
nicferrier / creole.el
Created October 24, 2011 22:51
most of the bits of a creole parser in emacslisp
;;; creole.el --- A parser for the Creole Wiki language
;;; Copyright (C) 2011 by Nic Ferrier
;;; Commentary:
;; This is a WikiCreole wiki parser. WikiCreole is something like the
;; Wiki language used by OddMuse, which is the EmacsWiki wiki
;; language.
nicferrier / withprocesshellcommand.el
Created October 28, 2011 19:25
a macro for doing async shell commands a little easier
(defmacro with-process-shell-command (command buffer-or-filter &rest forms)
"Run COMMAND through /in the BUFFER-OR-FILTER using FORMS as the sentinel.
FORMS is a 'cond' like you'd use in a sentinel, for example:
(with-process-shell-command \"ls\" some-buffer
((equal signal \"finished\\n\")
;; Clean up?
(with-current-buffer (get-buffer \"* log *\")
(insert \"some text\\\n\")))
(defun ispell-lookup (word)
(interactive "Mword: ")
(with-current-buffer (get-buffer-create "* ispell-lookup *")
(insert word)
(goto-char (point-min))
(switch-to-buffer-other-window (current-buffer))
nicferrier / pinboard.el
Created November 3, 2011 06:16
pinboard doodling for emacslisp using url-retrieve
(defun pinboard-get ()
"A little function to retrieve into a buffer.
The buffer is *pinboard*. We don't even switch to it."
(lambda (status &rest args)
(re-search-forward "^$" nil 't)
;;; wikiengine.el --- a WIKI engine -*- lexical-binding: t -*-
;; Copyright (C) 2011 Nic Ferrier
;; Author: Nic Ferrier - <>
;; Version: 0.1
;; Keywords: hypermedia
;; 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
(progn (setq load-path (quote ("/home/nferrier/.emacs.d/elpa/ahg-0.99" "/home/nferrier/.emacs.d/elpa/chess-1.96" "/home/nferrier/.emacs.d/elpa/creole-0.6.1"
"/home/nferrier/.emacs.d/elpa/elnode-0.9"))) (let ((target "/home/nferrier/wiki/README.creole") (header "<div id='top'></div>") (footer "<div id='footer'>
<form action='/wiki/' method='POST'>
<textarea name='wikitext'>
<input type='submit' name='send' value='send'/>
<input type='submit' name='preview' value='preview'/>
</div>")) (progn (require (quote creole)) (creole-wiki target :destination t :body-header header :body-footer footer))))
nicferrier / gist:1368492
Created November 15, 2011 21:51
new vc agnostic veh
def get_config(repo, rev=None):
"""Get the config from the veh root.
We try and work out what version control system is being used from
the location of the veh config file.
We currently only support Mercurial and GIT.
The veh.conf MUST exist in the file system though we might read a
completly different version of course."""